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
// -O2 -Wallexternvoidknowable(void);
externvoidunknowable(void);
voidtest(void)
{
charbuf[8];
// The end of "buf" is undefined. That shouldn't make// __builtin_constant_p() undefined nor true, though.// It should just be false.if (__builtin_constant_p(buf[sizeof(buf)-1])) {
knowable();
} else {
unknowable();
}
}
Clang is incorrectly resolving __builtin_constant_p() to true (or undefined) instead of false. GCC correctly resolves it to false (and emits a warning about using buf uninitialized).