This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/81861] [8.0 Regression] ASan pr64820.c testcase segfaults with LTO and -fstack-protector-strong
- From: "m.ostapenko at samsung dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Aug 2017 18:20:36 +0000
- Subject: [Bug lto/81861] [8.0 Regression] ASan pr64820.c testcase segfaults with LTO and -fstack-protector-strong
- Auto-submitted: auto-generated
- References: <bug-81861-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81861
--- Comment #6 from Maxim Ostapenko <m.ostapenko at samsung dot com> ---
Created attachment 41990
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41990&action=edit
Untested fix
The problem is that LTO doesn't propagate changed
ix86_stack_protector_guard_reg value:
6654 /* Save the initial options in case the user does function specific
6655 options. */
6656 if (main_args_p)
6657 target_option_default_node = target_option_current_node
6658 = build_target_option_node (opts); <== save flags
6659
...
6695 ix86_stack_protector_guard_reg = DEFAULT_TLS_SEG_REG; <== missed
change
Thus ix86_stack_protector_guard_reg becomes left ADDR_SPACE_GENERIC in ltrans
stage that confuses optimizer later (wrong constant propagation in this case).
Moving options saving down fixes the issue, although I'm not sure this is a
correct fix.