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

            Bug ID: 112812
           Summary: Regression: ASAN + stack-protector breaks alignment of
                    stack variables
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tonyb at cybernetics dot com
  Target Milestone: ---

Created attachment 56755
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56755&action=edit
Test case

The combination of -fsanitize=address and -fstack-protector-strong causes gcc
13 to misalign stack variables.  Attached is a test program that requests
64-byte alignment of a stack variable.  With -fsanitize=address and
-fstack-protector-strong, the address is aligned on a 32-byte boundary but not
a 64-byte boundary.  With other combinations of options the alignment is
correct.  Running on x86_64.

Compile options:
gcc -m64 -Wall -O2 -U_FORTIFY_SOURCE -fstack-protector-strong
-fsanitize=address -fno-omit-frame-pointer

Test fails with gcc version 13.2.1 20231201
Configured with: ../gcc/configure --host=x86_64-pc-linux-gnu
--enable-languages=c

I believe gcc 12 did not have this bug.  I noticed the problem when UBSan
complained about a misaligned pointer which led back to a stack variable after
upgrading from gcc 12.3 to gcc 13.2.
  • [Bug c/112812] New: Regression: ... tonyb at cybernetics dot com via Gcc-bugs

Reply via email to