Bug 35768 - gcc.c-torture/compile/20010226-1.c:22: ICE: in do_output_reload, at reload1.c:7331
Summary: gcc.c-torture/compile/20010226-1.c:22: ICE: in do_output_reload, at reload1.c...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-30 17:27 UTC by John David Anglin
Modified: 2008-04-10 22:52 UTC (History)
2 users (show)

See Also:
Host: hppa*-*-*
Target: hppa*-*-*
Build: hppa*-*-*
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2008-03-30 17:27:43 UTC
Executing on host: /home/dave/gnu/gcc-4.4/objdir/gcc/xgcc -B/home/dave/gnu/gcc-4.4/objdir/gcc/   -O0  -w -fno-show-column -c  -o 20010226-1.o /home/dave/gnu/gcc
-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c    (timeout = 300)
/home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c: In 
function 'foo':
/home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c:22: 
error: VOIDmode on an output
(insn 30 29 31 2 /home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/
20010226-1.c:6 (parallel [
            (const_int 1 [0x1])
            (unspec_volatile [
                    (mem:BLK (scratch) [0 A8])                ] 1)
            (use (reg:SI 20 %r20 [108]))
            (use (reg:SI 19 %r19 [109]))            (use (reg:SI 28 %r28 [110]))            (clobber (scratch))
        ]) 244 {dcacheflush} (nil))/home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c:22: internal compiler error: in do_output_reload, at reload1.c:7331
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
compiler exited with status 1
output is:
/home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c: In function 'foo':
/home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c:22: error: VOIDmode on an output
(insn 30 29 31 2 /home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c:6 (parallel [
            (const_int 1 [0x1])
            (unspec_volatile [
                    (mem:BLK (scratch) [0 A8])
                ] 1)
            (use (reg:SI 20 %r20 [108]))
            (use (reg:SI 19 %r19 [109]))
            (use (reg:SI 28 %r28 [110]))
            (clobber (scratch))
        ]) 244 {dcacheflush} (nil))
/home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c:22: internal compiler error: in do_output_reload, at reload1.c:7331
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

FAIL: gcc.c-torture/compile/20010226-1.c  -O0  (internal compiler error)
FAIL: gcc.c-torture/compile/20010226-1.c  -O0  (test for excess errors)
Excess errors:
/home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c:22: error: VOIDmode on an output
(insn 30 29 31 2 /home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c:6 (parallel [
            (const_int 1 [0x1])
            (unspec_volatile [
                    (mem:BLK (scratch) [0 A8])
                ] 1)
            (use (reg:SI 20 %r20 [108]))
            (use (reg:SI 19 %r19 [109]))
            (use (reg:SI 28 %r28 [110]))
            (clobber (scratch))
        ]) 244 {dcacheflush} (nil))
/home/dave/gnu/gcc-4.4/gcc/gcc/testsuite/gcc.c-torture/compile/20010226-1.c:22: internal compiler error: in do_output_reload, at reload1.c:7331
Comment 1 John David Anglin 2008-03-30 23:58:49 UTC
(gdb) p debug_rtx (rl->out)
(scratch)
Comment 2 John David Anglin 2008-03-31 00:03:14 UTC
Richard, does match_scratch now require a mode?  The pattern causing
the problem was written without a mode so that it could handle both
SImode and DImode.
Comment 3 dave 2008-03-31 16:06:41 UTC
Subject: Re:  gcc.c-torture/compile/20010226-1.c:22: ICE: in do_output_reload, at reload1.c:7331

This was introduced in revision 133531.

Dave
Comment 4 rsandifo@nildram.co.uk 2008-03-31 16:11:00 UTC
Subject: Re:  gcc.c-torture/compile/20010226-1.c:22: ICE: in do_output_reload, at reload1.c:7331

"danglin at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
> Richard, does match_scratch now require a mode?  The pattern causing
> the problem was written without a mode so that it could handle both
> SImode and DImode.

Hmm.  Well, the use of a modeless "match_scratch" in a matching context
is OK.  It's the use of a modeless "(scratch)" rtx (and thus a modeless
"match_scratch" in an expander or named insn) that's the problem.

It does seem odd for an output "(scratch)" to have no mode.  From a
quick check, it seems PA is the only port to use voidless "(scratch)"
rtxes for output operands that really do need reloads.  Other ports
either add the mode to the "match_scratch" or get the associated
expander to call "gen_rtx_SCRATCH (mode)".  See s390.md for an
example of the latter.

I suppose the assumption in pa.md is that the scratch output reload
should be in the same mode as the input operand.  However, the point
of my patch was that they needn't be: matched input-output operands
can have different modes, and in every other case except the PA one,
the mode of the output value determines the mode of the output reload
register.

If we want to continue to allow this, the fix is to change:

  if (rl->out && reg_rtx)

into:

  if (rl->out
      && reg_rtx
      && !(GET_CODE (rl->out) == SCRATCH && GET_MODE (rl->out) == VOIDmode))

in reload1.c.

What do you think?  Should pa.md be changed (probably along the same
lines as s390.md) or do you want to go with the reload change?

Richard
Comment 5 dave 2008-03-31 23:06:12 UTC
Subject: Re:  gcc.c-torture/compile/20010226-1.c:22: ICE: in do_output_reload, at reload1.c:7331

> I suppose the assumption in pa.md is that the scratch output reload
> should be in the same mode as the input operand.

I think the constraint should be changed from "=&0" to "+&0" to indicate
that the operand is both read and written.  Possibly, this will fix the
problem.

Dave
Comment 6 rsandifo@nildram.co.uk 2008-04-01 08:52:12 UTC
Subject: Re:  gcc.c-torture/compile/20010226-1.c:22: ICE: in do_output_reload, at reload1.c:7331

"dave at hiauly1 dot hia dot nrc dot ca" <gcc-bugzilla@gcc.gnu.org> writes:
>> I suppose the assumption in pa.md is that the scratch output reload
>> should be in the same mode as the input operand.
>
> I think the constraint should be changed from "=&0" to "+&0" to indicate
> that the operand is both read and written.  Possibly, this will fix the
> problem.

Well, "=" is correct for matching operands; "+" isn't.  As I say,
the problem is simply that we have something that is logically an
output value -- (scratch) -- but that does not have a mode.
Changing "=" to "+" wouldn't solve that; the (scratch) would
still be an output value.

Richard
Comment 7 John David Anglin 2008-04-05 23:30:53 UTC
Testing backend fix.
Comment 8 John David Anglin 2008-04-10 22:51:29 UTC
Subject: Bug 35768

Author: danglin
Date: Thu Apr 10 22:50:49 2008
New Revision: 134182

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134182
Log:
	PR target/35768
	* pa.md: Define mode iterator P.  Define mode attribute dwc.
	(dcacheflush): Update pattern to use iterator P and attribute dwc.
	(icacheflush): Likewise.
	* pa.h (INITIALIZE_TRAMPOLINE): Use dcacheflushsi/icacheflushsi if
	!TARGET_64BIT, and dcacheflushdi/icacheflushdi if TARGET_64BIT.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/pa/pa.h
    trunk/gcc/config/pa/pa.md

Comment 9 John David Anglin 2008-04-10 22:52:55 UTC
Fixed.