[Bug c/116723] New: performance differs in -ffinite-loop with only type changing
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116723 Bug ID: 116723 Summary: performance differs in -ffinite-loop with only type changing Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bouncy12578 at gmail dot com Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) $ gcc -O3 -ffinite-loops case1.c - o out1.o && ./out1.o 1 $ gcc -O3 -ffinite-loops case1.c - o out2.o && ./out2.o (no results, a infinite loop) case1.c: #include "stdio.h" #include "stdint.h" union U0 { int16_t f0; int32_t f1; } g; int func_1(union U0 p) { p.f1 = 0; for (p.f0 = 1; (p.f0 != (-18)); p.f0 = (int16_t)(3 - p.f0)); return 1; } int main () { printf("%d", func_1(g)); return 0; } case2.c: #include "stdio.h" #include "stdint.h" union U0 { uint16_t f0; int32_t f1; }g; int func_1(union U0 p) { p.f1 = 0; for (p.f0 = 1; (p.f0 != (-18)); p.f0 = (uint16_t)(3 - p.f0)); return 1; } int main () { printf("%d", func_1(g)); return 0; } The change between these two files is line 5 and line 12, from int16_t to uint16_t. With -O3 and -ffinite-loops optimization, case1.c outputs result "1", while case2.c is considered as an infinite loop.
[Bug middle-end/116723] performance differs in -ffinite-loop with only type changing
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116723 --- Comment #2 from Ye Xiong --- (In reply to Andrew Pinski from comment #1) > (p.f0 != (-18)) > > For uint16_t, this is always true and is an always infinite loop. While for > int16_t it is not and the loop is removed because you supplied -ffinite-loop. > > -ffinite-loop does NOT remove always infinite loops by design and is what is > required by the C++ standard even. > > So invalid by design. However, if swap the two types in the union (in case1.c) like: case3.c union U0 { int32_t f0; int16_t f1; } g; int func_1(union U0 p) { p.f1 = 0; for (p.f0 = 1; (p.f0 != (-18)); p.f0 = (int32_t) (3 - p.f0)); return 1; } Although p.f0 is a signed int, it will outputs "1" (with -O3 and -ffinite-loops). Even weirder, only change the type of p1 from int16_t to int32_t the basis of case3.c: case4.c union U0 { int32_t f0; int32_t f1; } g; int func_1(union U0 p) { p.f1 = 0; for (p.f0 = 1; (p.f0 != (-18)); p.f0 = (int32_t) (3 - p.f0)); return 1; } It will be seen as an infinite loop again.
[Bug middle-end/117143] New: program crash under -O3 optimization or higher with function optimization flags assigned
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117143 Bug ID: 117143 Summary: program crash under -O3 optimization or higher with function optimization flags assigned Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bouncy12578 at gmail dot com Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) $ cat a.c __attribute__((optimize("-ftree-pre"))) static void f(int) { unsigned l; j: for (l = 0; l <= 2; l++) { int x[] = {0}; if (l) goto j; } } int main() { f(0); } $ gcc a.c -o case -O3 && ./case Segmentation fault (core dumped) $ gcc a.c -o case && ./case (infinite loop, the program won't stop) This bug can be reproduced on gcc 12, 13 (15 not tested). Any further modification would eliminate bug. The program is a designed inifinite loop. It would crash under -O3(or higher) optimization. -O0, -O1, -O2 won't cause segmentation fault. The __attribute__ in function f() cannot be moved, and can be substituted by some of the optimization flags but cannot be substituted by optimization level such as O1, O2, O3, etc.
[Bug middle-end/117243] New: program crash under -O3 optimization or higher
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117243 Bug ID: 117243 Summary: program crash under -O3 optimization or higher Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bouncy12578 at gmail dot com Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=gcc-14 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/14/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 14-20240412-0ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-14/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr --with-gcc-major-version-only --program-suffix=-14 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-14-OQFzmN/gcc-14-14-20240412/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-14-OQFzmN/gcc-14-14-20240412/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=yes,extra,rtl --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f] (Ubuntu 14-20240412-0ubuntu1) $ cat a.c void foo(int a, int b) { int i, j; j: for (b=0; b<2; b++) { int c[1][1]; int i, j; for (i = 0; i < 1; i++) for (j = 0; j < 1; j++) c[i][j] = 1; if (b) goto j; } } int main() { foo(1, 2); } $ gcc a.c -O3 && ./a.out Segmentation fault (core dumped) $ gcc a.c && ./a.out (infinite loop, the program won't stop) This bug can be reproduced on gcc 14 and trunk. Any further modification would eliminate bug. The program is a designed inifinite loop. It would crash under -O3(or higher) optimization. -O0, -O1, -O2 won't cause segmentation fault. Interestingly, if param b in func foo is unsigned, the bug can be reproduced on gcc 13(12 or lower cannot reproduce it)
[Bug middle-end/117243] program crash under -O3 optimization or higher
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117243 --- Comment #6 from Ye Xiong --- (In reply to Sam James from comment #1) > Trunk works. When param b is unsigned, trunk will crash.
[Bug middle-end/117243] program crash under -O3 optimization or higher
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117243 --- Comment #5 from Ye Xiong --- (In reply to Sam James from comment #1) > Trunk works.
[Bug middle-end/117243] program crash under -O3 optimization or higher
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117243 --- Comment #7 from Ye Xiong --- (In reply to Ye Xiong from comment #6) > (In reply to Sam James from comment #1) > > Trunk works. > > When param b is unsigned, trunk will crash. The original reduced file is: #include void foo(uint32_t a, uint8_t b) { int i, j; lbl: for (b = 0; (b <= 7); b += 1) { uint8_t c[1][1]; int i, j, k; for (i = 0; i < 1; i++) { for (j = 0; j < 1; j++) { c[i][j] = 1; } } if (b) goto lbl; } } int main() { foo(1, 2); } this version will crash on -O3 or higher on trunk version, we reduced a bit more but seems the bug would eliminate on trunk version.
[Bug middle-end/116749] New: program crash under -O3 optimization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116749 Bug ID: 116749 Summary: program crash under -O3 optimization Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bouncy12578 at gmail dot com Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) $ cat case.c int main () { int g=0; int l1[1]; int *l2 = &g; int i; for (i=0; i<1; i++) l1[i] = (1); for (g=0; g; ++g) { int *l3[1] = {&l1[0]}; } *l2 = *l1; b: for (i=0; i<2; ++i) { if (i) goto b; if (g) continue; } return 0; } $ gcc case.c -o case -O3 && ./case Segmentation fault (core dumped) $ gcc case.c -o case && ./case (infinite loop, the program won't stop) This bug can be reproduced on gcc 12 or higher. Any further modification would eliminate bug. The program is a designed inifinite loop. It would crash under -O3(or higher) optimization. -O0, -O1, -O2 won't cause segmentation fault
[Bug middle-end/116906] New: floating point exception under -O2 optimization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116906 Bug ID: 116906 Summary: floating point exception under -O2 optimization Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bouncy12578 at gmail dot com Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=gcc-14 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/14/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 14-20240412-0ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-14/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr --with-gcc-major-version-only --program-suffix=-14 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-14-OQFzmN/gcc-14-14-20240412/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-14-OQFzmN/gcc-14-14-20240412/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=yes,extra,rtl --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f] (Ubuntu 14-20240412-0ubuntu1) $ cat case.c #include int a = 1, b = 0; uint64_t safe_mod(uint64_t a, uint64_t b) { if (b == 0) return a; else return a % b; } int f(uint64_t p) { int c = 0; j: b = safe_mod( (c = ((a &= (0 < p)) && 1), 1), p); if (!c) goto j; return 0; } int main() { f(b); } $ gcc case.c -o case -O2 && ./case Floating point exception (core dumped) $ gcc case.c -o case -O3 && ./case (infinite loop, the program won't stop) This bug can be reproduced on gcc 11 or higher(gcc 15 not tested). Any further modification would eliminate bug. The program is a designed infinite loop. It would crash only under -O2 optimization. Other optimization levels won't cause crash. btw, could you tell me where is gcc 15 available? Thanks a lot.
[Bug middle-end/118258] New: dead code causes missed optimization at -O2
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118258 Bug ID: 118258 Summary: dead code causes missed optimization at -O2 Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: bouncy12578 at gmail dot com Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=gcc-14 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/14/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 14-20240412-0ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-14/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr --with-gcc-major-version-only --program-suffix=-14 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-14-OQFzmN/gcc-14-14-20240412/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-14-OQFzmN/gcc-14-14-20240412/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=yes,extra,rtl --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f] (Ubuntu 14-20240412-0ubuntu1) $ cat case.c #include int g1, g2 = 0L; volatile int8_t g3; volatile int8_t *g4 = &g3; uint8_t g5; int8_t g6; int main() { if (g2) { int8_t *l = &g3; for (g5 = 0; g5 <= 1; g5 += 1) { *l ^= 1; g4 = (l = &g6, (void *)0); for (g6 = 1; (g6 >= 0); g6 -= 1) g1 = 0; } } else { for (int i = 0; i > -23; i = (uint16_t)(i - 1)) { g3 = (g1 == 0 ? 0 : 1 % g1); } } return 0; } $ gcc case.c -o case -O2 && ./case Floating point exception (core dumped) $ gcc case.c -o case -O0 && ./case (infinite loop, the program won't stop) This bug can be reproduced from gcc 9 or higher(but works on trunk). Any further modification would eliminate bug. The program is a designed infinite loop. It would crash under -O2 optimization for gcc 9-14, -O3(and -Ofast) for gcc 9-11.
[Bug c++/119999] New: Wrong Pointer Comparison in GCC 10/11/12/13 with -Os/-Oz Flags
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11 Bug ID: 11 Summary: Wrong Pointer Comparison in GCC 10/11/12/13 with -Os/-Oz Flags Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bouncy12578 at gmail dot com Target Milestone: --- *** gcc version: $ gcc -v Using built-in specs. COLLECT_GCC=gcc-13 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.1.0-8ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada ,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-l inker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --e nable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-defaul t-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet -- with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-IvzKaI/gcc -13-13.1.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-IvzKaI/gcc-13-13.1.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.1.0 (Ubuntu 13.1.0-8ubuntu1~22.04) *** Program: $ cat a.cpp #include int a = 0; static int b = 1; void f(int * p){ l: assert (p == &a); if (b) goto l; } int * g(){ return &a; } int main(int argc, char* argv[]){ f(g()); return 0; } *** Command Lines: $ gcc a.cpp -o a.out -Os && ./a.out a.out: a.cpp:7: void f(int*): Assertion `p == &a' failed. Aborted fail in gcc 10/11/12/13 with -Os/-Oz