http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58564

            Bug ID: 58564
           Summary: possible wrong code bug at -O0
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: regehr at cs dot utah.edu

regehr@john-home ~ $ clang -O0 -w small.c ; ./a.out
0
regehr@john-home ~ $ gcc-4.4 -O0 -w small.c ; ./a.out
0
regehr@john-home ~ $ gcc-4.6 -O0 -w small.c ; ./a.out
0
regehr@john-home ~ $ gcc-4.7 -O0 -w small.c ; ./a.out
1
regehr@john-home ~ $ gcc -O0 -w small.c ; ./a.out
1
regehr@john-home ~ $ cat small.c 
int printf(const char *, ...);
int a, b;
short *c;
short **d = &c;
int main() {
  b = (0, 0 > ((&c == d) & (1 && a ^ 1))) | 0U;
  printf("%d\n", b);
  return 0;
}
regehr@john-home ~ $ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r203005-install/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/regehr/z/compiler-source/gcc/configure
--prefix=/home/regehr/z/compiler-install/gcc-r203005-install
--enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 4.9.0 20130928 (experimental) (GCC)

Reply via email to