diff mbox

mn10300: Fix an ICE

Message ID 0f849537da2ed4ba59a53da920e3e0e6b1ea4f9c.1416885944.git.segher@kernel.crashing.org
State New
Headers show

Commit Message

Segher Boessenkool Nov. 25, 2014, 3:37 a.m. UTC
`lcc' is not an insn but just a pattern.  This caused a build error in
libgcc.
Tested with a cross compiler build (which fails without and succeeds
with the patch).  Not tested much more; this compiler really likes to
ICE, something with ipa-icf.

Is this okay for trunk?


Segher


2014-11-24  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/
	* config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Remove
	PATTERN call.

---
 gcc/config/mn10300/mn10300.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Law Nov. 25, 2014, 4:44 p.m. UTC | #1
On 11/24/14 20:37, Segher Boessenkool wrote:
> `lcc' is not an insn but just a pattern.  This caused a build error in
> libgcc.
> Tested with a cross compiler build (which fails without and succeeds
> with the patch).  Not tested much more; this compiler really likes to
> ICE, something with ipa-icf.
>
> Is this okay for trunk?
>
>
> Segher
>
>
> 2014-11-24  Segher Boessenkool  <segher@kernel.crashing.org>
>
> gcc/
> 	* config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Remove
> 	PATTERN call.
OK.

A good example of a case that would have been caught if we get to a 
point where stuff in the insn chain are not RTX objects, but something 
else entirely.

jeff
Segher Boessenkool Nov. 25, 2014, 5:14 p.m. UTC | #2
On Tue, Nov 25, 2014 at 09:44:35AM -0700, Jeff Law wrote:
> On 11/24/14 20:37, Segher Boessenkool wrote:
> >`lcc' is not an insn but just a pattern.  This caused a build error in
> >libgcc.

> A good example of a case that would have been caught if we get to a 
> point where stuff in the insn chain are not RTX objects, but something 
> else entirely.

Hey, it already did ICE, easy to catch.  But you mean "wouldn't even
compile" I guess :-)


Segher
Jeff Law Nov. 25, 2014, 5:15 p.m. UTC | #3
On 11/25/14 10:14, Segher Boessenkool wrote:
> On Tue, Nov 25, 2014 at 09:44:35AM -0700, Jeff Law wrote:
>> On 11/24/14 20:37, Segher Boessenkool wrote:
>>> `lcc' is not an insn but just a pattern.  This caused a build error in
>>> libgcc.
>
>> A good example of a case that would have been caught if we get to a
>> point where stuff in the insn chain are not RTX objects, but something
>> else entirely.
>
> Hey, it already did ICE, easy to catch.  But you mean "wouldn't even
> compile" I guess :-)
Exactly.  This kind of problem is something I want to catch at compile 
time rather than at runtime.

jeff
David Malcolm Nov. 25, 2014, 8:21 p.m. UTC | #4
On Tue, 2014-11-25 at 10:15 -0700, Jeff Law wrote:
> On 11/25/14 10:14, Segher Boessenkool wrote:
> > On Tue, Nov 25, 2014 at 09:44:35AM -0700, Jeff Law wrote:
> >> On 11/24/14 20:37, Segher Boessenkool wrote:
> >>> `lcc' is not an insn but just a pattern.  This caused a build error in
> >>> libgcc.
> >
> >> A good example of a case that would have been caught if we get to a
> >> point where stuff in the insn chain are not RTX objects, but something
> >> else entirely.
> >
> > Hey, it already did ICE, easy to catch.  But you mean "wouldn't even
> > compile" I guess :-)
> Exactly.  This kind of problem is something I want to catch at compile 
> time rather than at runtime.

Right.  FWIW I have a set of patches that converts PATTERN() to
requiring a const rtx_insn * rather than a const_rtx, but so far they
only compile on x86_64.  Extending them to cover all archs would have
caught this at compile time, I guess, since "lcc" would have been just
an rtx.

Presumably something for the next stage1.
diff mbox

Patch

diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 20330f0..1fc64ed 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -3217,7 +3217,7 @@  mn10300_insert_setlb_lcc (rtx label, rtx branch)
     lcc = gen_Lcc (comparison, label);    
 
   rtx_insn *jump = emit_jump_insn_before (lcc, branch);
-  mark_jump_label (XVECEXP (PATTERN (lcc), 0, 0), jump, 0);
+  mark_jump_label (XVECEXP (lcc, 0, 0), jump, 0);
   JUMP_LABEL (jump) = label;
   DUMP ("Replacing branch insn...", branch);
   DUMP ("... with Lcc insn:", jump);