public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103085] New: [12 Regression] -fPIC and -fstack-protector-strong broken AArch64
@ 2021-11-04 17:18 tnfchris at gcc dot gnu.org
  2021-11-04 19:30 ` [Bug target/103085] " wilco at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-11-04 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103085
           Summary: [12 Regression] -fPIC and -fstack-protector-strong
                    broken AArch64
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnfchris at gcc dot gnu.org
                CC: wilco at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-*

-fPIC and -fstack-protector-strong are broken since
g:a195c7270e4705a06a9aaade0d721d5f52ca2275

The following testcase

---

struct A {
  int operator*();
  void operator++();
  friend bool operator!=(A, A);
};
class B {
public:
  A begin();
  A end();
};
class C {
  void emitMaps();
  B Events;
};
void C::emitMaps() {
  for (auto a : Events)
    ;
}

----

ICEs with gcc -O2 -g -fstack-protector-strong -fPIC -c -std=c++11

foo.cpp: In member function 'void C::emitMaps()':
foo.cpp:18:1: error: unrecognizable insn:
   18 | }
      | ^
(insn 4 3 5 2 (set (reg:DI 96)
        (const:DI (unspec:DI [
                    (symbol_ref:DI ("__stack_chk_guard") [flags 0xc0] <var_decl
0xffffb7a96360 __stack_chk_guard>)
                    (const_int 0 [0])
                ] UNSPEC_SALT_ADDR))) "foo.cpp":15:20 -1
     (nil))
during RTL pass: vregs
foo.cpp:18:1: internal compiler error: in extract_insn, at recog.c:2769
0x750627 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-fsf/gcc/rtl-error.c:108
0x750653 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-fsf/gcc/rtl-error.c:116
0x10e332b extract_insn(rtx_insn*)
        ../../gcc-fsf/gcc/recog.c:2769
0xdf6477 instantiate_virtual_regs_in_insn
        ../../gcc-fsf/gcc/function.c:1611
0xdf6477 instantiate_virtual_regs
        ../../gcc-fsf/gcc/function.c:1985
0xdf6477 execute
        ../../gcc-fsf/gcc/function.c:2034

because the salt address is no longer folded away.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/103085] [12 Regression] -fPIC and -fstack-protector-strong broken AArch64
  2021-11-04 17:18 [Bug target/103085] New: [12 Regression] -fPIC and -fstack-protector-strong broken AArch64 tnfchris at gcc dot gnu.org
@ 2021-11-04 19:30 ` wilco at gcc dot gnu.org
  2021-11-05  7:23 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: wilco at gcc dot gnu.org @ 2021-11-04 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-11-04
           Assignee|unassigned at gcc dot gnu.org      |wilco at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Wilco <wilco at gcc dot gnu.org> ---
Yes there is something hacky about the way the salt thingy works. It adds some
unspec around a memory operand and still expects the standard movdi pattern to
recognize it.

It looks like adding support for CONST in Usw constraint and stripping the salt
before checking the symbol in mov_operand_p fixes it. I'm testing a patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/103085] [12 Regression] -fPIC and -fstack-protector-strong broken AArch64
  2021-11-04 17:18 [Bug target/103085] New: [12 Regression] -fPIC and -fstack-protector-strong broken AArch64 tnfchris at gcc dot gnu.org
  2021-11-04 19:30 ` [Bug target/103085] " wilco at gcc dot gnu.org
@ 2021-11-05  7:23 ` rguenth at gcc dot gnu.org
  2021-11-05 15:37 ` cvs-commit at gcc dot gnu.org
  2021-11-05 15:38 ` wilco at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-05  7:23 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |12.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/103085] [12 Regression] -fPIC and -fstack-protector-strong broken AArch64
  2021-11-04 17:18 [Bug target/103085] New: [12 Regression] -fPIC and -fstack-protector-strong broken AArch64 tnfchris at gcc dot gnu.org
  2021-11-04 19:30 ` [Bug target/103085] " wilco at gcc dot gnu.org
  2021-11-05  7:23 ` rguenth at gcc dot gnu.org
@ 2021-11-05 15:37 ` cvs-commit at gcc dot gnu.org
  2021-11-05 15:38 ` wilco at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-05 15:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Wilco Dijkstra <wilco@gcc.gnu.org>:

https://gcc.gnu.org/g:b33b2678342c655ff8ddb9fab379b26f656adc03

commit r12-4942-gb33b2678342c655ff8ddb9fab379b26f656adc03
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date:   Fri Nov 5 15:05:15 2021 +0000

    AArch64: Fix PR103085

    The stack protector implementation hides symbols in a const unspec, which
means
    movdi/movsi patterns must always support const on symbol operands and
    explicitly strip away the unspec. Do this for the recently added GOT
    alternatives. Add a test to ensure stack-protector tests GOT accesses as
well.

    2021-11-05  Wilco Dijkstra  <wdijkstr@arm.com>

            PR target/103085
            * config/aarch64/aarch64.c (aarch64_mov_operand_p): Strip the salt
            first.
            * config/aarch64/constraints.md: Support const in Usw.

    gcc/testsuite/
            PR target/103085
            * gcc.target/aarch64/pr103085.c: New test

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/103085] [12 Regression] -fPIC and -fstack-protector-strong broken AArch64
  2021-11-04 17:18 [Bug target/103085] New: [12 Regression] -fPIC and -fstack-protector-strong broken AArch64 tnfchris at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-11-05 15:37 ` cvs-commit at gcc dot gnu.org
@ 2021-11-05 15:38 ` wilco at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: wilco at gcc dot gnu.org @ 2021-11-05 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Wilco <wilco at gcc dot gnu.org> ---
Fixed

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-05 15:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 17:18 [Bug target/103085] New: [12 Regression] -fPIC and -fstack-protector-strong broken AArch64 tnfchris at gcc dot gnu.org
2021-11-04 19:30 ` [Bug target/103085] " wilco at gcc dot gnu.org
2021-11-05  7:23 ` rguenth at gcc dot gnu.org
2021-11-05 15:37 ` cvs-commit at gcc dot gnu.org
2021-11-05 15:38 ` wilco at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).