[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-11-05 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

Segher Boessenkool  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #18 from Segher Boessenkool  ---
Fixed on trunk, 9, 8.  Closing.

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-11-05 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #17 from Segher Boessenkool  ---
Author: segher
Date: Tue Nov  5 17:20:00 2019
New Revision: 277856

URL: https://gcc.gnu.org/viewcvs?rev=277856=gcc=rev
Log:
backport for PR91289

Backport from trunk
2019-10-26  Segher Boessenkool  

PR target/91289
* config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Don't add an
immediate to r0; use r11 instead.  Save and restore r11 to r0 around
this.

Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/config/rs6000/rs6000.c

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-11-05 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #16 from Segher Boessenkool  ---
Author: segher
Date: Tue Nov  5 17:17:03 2019
New Revision: 277855

URL: https://gcc.gnu.org/viewcvs?rev=277855=gcc=rev
Log:
backport for PR91289

Backport from trunk
2019-10-26  Segher Boessenkool  

PR target/91289
* config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Don't add an
immediate to r0; use r11 instead.  Save and restore r11 to r0 around
this.

Modified:
branches/gcc-9-branch/gcc/ChangeLog
branches/gcc-9-branch/gcc/config/rs6000/rs6000.c

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-10-26 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

Segher Boessenkool  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
  Known to fail||7.4.0, 8.3.0, 9.2.0

--- Comment #15 from Segher Boessenkool  ---
Fixed on trunk (so far).

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-10-26 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #14 from Segher Boessenkool  ---
Author: segher
Date: Sat Oct 26 16:38:59 2019
New Revision: 277472

URL: https://gcc.gnu.org/viewcvs?rev=277472=gcc=rev
Log:
rs6000: Fix allocate_stack in a corner case (PR91289)

When we have -fstack-limit-symbol with sysv we can end up with a non-
existing instruction (you cannot add an immediate to register 0).  Fix
this by using register 11 instead.  It might be used for something else
already though, so save and restore its value around this.  In
optimizing compiles these extra moves are usually removed again: the
restore by cprop_hardreg, and then the save by rtl_dce.


PR target/91289
* config/rs6000/rs6000-logue.c (rs6000_emit_allocate_stack): Don't add
an immediate to r0; use r11 instead.  Save and restore r11 to r0 around
this.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000-logue.c

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-10 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #13 from Alan Modra  ---
(In reply to Segher Boessenkool from comment #9)
> My patch do not clobber r11, that's the point of it :-)

Eh, I shouldn't look at patches late at night.  Even simple ones.

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-10 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #12 from Segher Boessenkool  ---
Thanks for testing!

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-10 Thread philipp.spilger at kip dot uni-heidelberg.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #11 from Philipp Spilger  ---
(In reply to Segher Boessenkool from comment #6)
> Created attachment 46853 [details]
> Proposed patch
> 
> Could you try this patch?

The proposed patch works back-ported to 8.1 (residing in rs6000.c then) during
compile-time (i.e. nothing breaks) and functionally for an example use case.
Will try on vanilla 9.1.

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-10 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #10 from Segher Boessenkool  ---
The prologue is not necessarily inserted as the first bb, so it's not clear
to me that CA is never live there.

The code copying r11 to r0, and back, is removed by the usual optimisations
btw, in all normal cases.

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-10 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #9 from Segher Boessenkool  ---
My patch do not clobber r11, that's the point of it :-)

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-10 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #8 from Alan Modra  ---
Ah, no addsi3_carry won't work.  You'll need a special version of elf_low that
trashes CA.

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-10 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #7 from Alan Modra  ---
I doubt the patch will work in all cases.  r11 might be in use.

BTW, trashing CA in the prologue won't matter since XER is volatile over
function calls.  So addic could be used.  (I know, just not in elf_low so there
would be a bit of messing around to use addsi3_carry.)

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

Segher Boessenkool  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |segher at gcc dot 
gnu.org

--- Comment #6 from Segher Boessenkool  ---
Created attachment 46853
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46853=edit
Proposed patch

Could you try this patch?

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #5 from Segher Boessenkool  ---
(BTW, using addic here is wrong: addic clobbers CA, which may not be free).

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

Segher Boessenkool  changed:

   What|Removed |Added

  Known to work||4.8.5
  Known to fail||5.1.0

--- Comment #4 from Segher Boessenkool  ---
(I don't have working GCC 5 and GCC 6 compilers handy, but based on comment 1,
I've marked those versions as failing as well).

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-09-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

Segher Boessenkool  changed:

   What|Removed |Added

 Target|powerpc |powerpc*-*-*
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-09-07
 CC||segher at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Segher Boessenkool  ---
Confirmed.  Any target.  Needs -O0 -m32 -fstack-limit-symbol=symbol_name .

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-07-31 Thread philipp.spilger at kip dot uni-heidelberg.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

--- Comment #2 from Philipp Spilger  ---
Only reverting the "elf_low" insn changes of this commit leads to no encounter
of the problem, i.e. the following diff "resolves" the problem on
gcc-9_1_0-release.

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index ad80592765d0..f797008eac9b 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -10138,11 +10138,13 @@
   "lis %0,%1@ha")

 (define_insn "elf_low"
-  [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
-   (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
+  [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
+   (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b,!*r")
   (match_operand 2 "" "")))]
"TARGET_ELF && !TARGET_64BIT && !flag_pic"
-   "la %0,%2@l(%1)")
+   "@
+la %0,%2@l(%1)
+addic %0,%1,%K2")

 (define_insn "*pltseq_tocsave_"
   [(set (match_operand:P 0 "memory_operand" "=m")

[Bug target/91289] powerpc-eabi: Usage of -fstack-limit-symbol leads to internal compiler error during RTL pass

2019-07-31 Thread mueller at kip dot uni-heidelberg.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91289

Eric Müller  changed:

   What|Removed |Added

 CC||mueller at kip dot 
uni-heidelberg.
   ||de

--- Comment #1 from Eric Müller  ---
We did a quick search for changes to the "elf_low" insn which is mentioned in 
the error message and found commit 55a56a6f323e876a0368f268f2bf85a5739c7498
("PR target/64180", 2014-12-10 by segher).

After reverting this commit (based on "gcc-9_1_0-release") we do not encounter
the problem anymore; the generated assembly looks okay.