https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68217

            Bug ID: 68217
           Summary: Wrong constant folding
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ishiura-compiler at ml dot kwansei.ac.jp
  Target Milestone: ---

GCC-6.0.0 miscompiles the following code.

$ cat error.c

int main(void){
    volatile int a = -1;
    long long b = -9223372036854775807LL-1; // LLONG_MIN
    long long x = (a & b); // x == 0x8000000000000000
    if ( x < 1LL ) { ; } else { __builtin_abort(); }
    return 0;
}

$ gcc-6.0 error.c -O3 && ./a.out
[1]    26572 abort (core dumped)  ./a.out

$ gcc-6.0 -v
Using built-in specs.
COLLECT_GCC=gcc-6.0
COLLECT_LTO_WRAPPER=$HOME/opt/gcc-6.0.0/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=$HOME/opt/gcc-6.0.0
--enable-languages=c --program-suffix=-6.0
Thread model: posix
gcc version 6.0.0 20151105 (experimental) (GCC)

Reply via email to