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

            Bug ID: 112550
           Summary: Difference in output from -O0 to -01 ?
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 56594
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56594&action=edit
C source code

For the attached C code, with this bash script:

$ cat qwe.sh
CC="/home/dcb38/gcc/results/bin/gcc"
FLAGS="-w -ftrivial-auto-var-init=zero -fno-strict-aliasing"

echo bug 981
$CC -O0 $FLAGS bug981.c -o 1.exe
$CC -O1 $FLAGS bug981.c -o 2.exe
./1.exe 1 > 1.out
./2.exe 1 > 2.out
diff 1.out 2.out | head -5

$ source ./qwe.sh
bug 981
38c38
< ...checksum after hashing g_130[i][j] : 19463610
---
> ...checksum after hashing g_130[i][j] : 65FD073B
40c40
$ /home/dcb38/gcc/results/bin/gcc -v 2>&1 | grep exp
gcc version 14.0.0 20231115 (experimental) (081fddbbcf979022) 
$ 

I don't understand why such a trivial change from -O0 to -O1 would cause
such a difference.

Is there perhaps another -f flag I should use to get no difference ?

Reply via email to