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

            Bug ID: 115539
           Summary: Misoptimization of application at -O2 -g on x86-64
                    causing segfaults on valid memory accesses where it
                    works on both clang and gcc at -g (no -O2)
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: melodygoad18 at gmail dot com
  Target Milestone: ---

Hi. I maintain a program that gets misoptimized at -O2 -g on gcc 14.1.1. This
wasn't happening on GCC 12 or 13 AFAIR, and it also doesn't happen on Windows.
Only on Linux. This also doesn't happen on clang with the same flags or on gcc
with simply -g. The problem is in the fastreadl_fetch function, where it
crashes on a perfectly valid memory access, but only if it's compiled with gcc
14.1.1 with -O2 -g flags on Linux. gdb is able to access the memory when it
crashes too, so it's most likely a compiler bug.

Reply via email to