[Bug middle-end/44081] Incorrect nonnull assumed in code generation
nordq at ya dot ru
gcc-bugzilla@gcc.gnu.org
Sun Dec 26 22:57:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44081
Valeriy <nordq at ya dot ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nordq at ya dot ru
--- Comment #11 from Valeriy <nordq at ya dot ru> 2010-12-26 22:57:48 UTC ---
/*
nonnull_2.c
gcc -O0 nonnull_2.c
gcc -O1 nonnull_2.c
gcc -O3 nonnull_2.c
00000000 if (0 or 8) <- Ok
00000004 else
00000008 if (0 or 8)
gcc -O2 nonnull_2.c
gcc -Os nonnull_2.c
00000000 else <- Error
00000004 else
00000008 if (0 or 8)
*/
#include <stdio.h>
static void attribute_nonnull_2(int i1, int *i2, int *i3)
__attribute__((__nonnull__(2)));
static void attribute_nonnull_2(int i1, int *i2, int *i3) {
*i2 = i1;
if (i3 == 0 || i3 == (int *) 8)
printf("%p if (0 or 8)\n", i3);
else
printf("%p else \n", i3);
}
int i2a;
int main(int argc, char *argv[]) {
attribute_nonnull_2(1, &i2a, (int *) 0);
attribute_nonnull_2(2, &i2a, (int *) 4);
attribute_nonnull_2(3, &i2a, (int *) 8);
return 0;
}
More information about the Gcc-bugs
mailing list