-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect type of clad tape in reverse mode #218
Comments
@grimmmyshini yeah the culprit is an
We can either strip till the |
Which AST node causes the type mismatch? Is it |
Yeah this node causes type mismatch because the type of
While a is stored in the tape without the Implicit Cast to float
Yeah |
Minimum reproducible example:
results in the following failed assertion
Assertion `(isGenericMethod || ((*I)->isVariablyModifiedType() || (*I).getNonReferenceType()->isObjCRetainableType() || getContext() .getCanonicalType((*I).getNonReferenceType()) .getTypePtr() == getContext() .getCanonicalType((*Arg)->getType()) .getTypePtr())) && "type mismatch in call argument!"' failed.
The possible culprit here is revealed while looking at the code dump
The problem here is the fact that the tape is initialized with a different type that is being pushed to it. This happens because we initialize the tape with a variable wrapped under implicit casts (the cast type is dependent on the expression result and type promotion) hence we miss the actual type of the variable. There are two possible solutions to this problem:
Strip all implicit casts before deciding the type of the tape
Build another implicit cast while pushing to the tape
Out of which, the first options seems the suitable solution to me.
May be related to #214
The text was updated successfully, but these errors were encountered: