You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While doing the upgrade to clang 17 sources, I found that a compiler assert was failing in a new test that was added to clang-17: test/Sema/pointer-subtraction.c.
void a(void) {
char *f = (char *)0;
f = (char *)((char *)0 - f); // expected-warning {{performing pointer subtraction with a null pointer has undefined behavior}};
f = (char *)((char *)0 - f); // expected-warning {{performing pointer subtraction with a null pointer has undefined behavior}}
}
I tracked the assert failure to incorrect IR being created for inverse expressions for casts in lib/AST/ExprUtils.cpp in the InverseUtil class. The problem is that some cast operators need to be inverted too. For example CK_IntegralToPointer needs to be inverted to CK_PointerToIntegral.
The text was updated successfully, but these errors were encountered:
While doing the upgrade to clang 17 sources, I found that a compiler assert was failing in a new test that was added to clang-17:
test/Sema/pointer-subtraction.c
.A minimal cut-down case is:
I tracked the assert failure to incorrect IR being created for inverse expressions for casts in lib/AST/ExprUtils.cpp in the
InverseUtil
class. The problem is that some cast operators need to be inverted too. For exampleCK_IntegralToPointer
needs to be inverted toCK_PointerToIntegral
.The text was updated successfully, but these errors were encountered: