Bug 34226 - [4.6/4.7/4.8 Regression][frv] ICE in default_secondary_reload, at targhooks.c:612
Summary: [4.6/4.7/4.8 Regression][frv] ICE in default_secondary_reload, at targhooks.c...
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P5 normal
Target Milestone: 4.6.4
Assignee: Rask Ingemann Lambertsen
URL:
Keywords: build, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2007-11-25 14:25 UTC by Rask Ingemann Lambertsen
Modified: 2012-11-09 23:32 UTC (History)
7 users (show)

See Also:
Host:
Target: frv-unknown-elf
Build:
Known to work: 4.2.2
Known to fail: 4.3.0
Last reconfirmed: 2007-11-27 13:38:08


Attachments
patch v1 (369 bytes, patch)
2007-11-26 18:14 UTC, Rask Ingemann Lambertsen
Details | Diff
patch v2 (627 bytes, patch)
2007-12-01 22:39 UTC, Rask Ingemann Lambertsen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rask Ingemann Lambertsen 2007-11-25 14:25:54 UTC
$ echo 'int main (int argc, char *argv[]) { return 0; }' >/tmp/test.c
$ ./xgcc -B./ /tmp/test.c -S -o /dev/null
/tmp/test.c:1: internal compiler error: in default_secondary_reload, at targhooks.c:612
Please submit a full bug report,
...
This happens with revision 130402. Revision 129967 worked. Configure flags:
--target frv-unknown-elf --enable-checking=yes,rtl --with-newlib --enable-sim --disable-gdb --disable-nls
Comment 1 Richard Biener 2007-11-25 17:27:36 UTC
Looks like a possible bug in the .md:

          gcc_assert (insn_data[(int) icode].n_operands == 3);

but more information would be appreciated here.
Comment 2 Steven Bosscher 2007-11-26 13:31:51 UTC
Note, it is only a regression if it worked in a previous _released_ version of GCC.  You have not filled out the "known-to-..."-fields.  Did this work in earlier releases?
Comment 3 Rask Ingemann Lambertsen 2007-11-26 17:27:55 UTC
This seems to have started with revision 130333, but I don't think that change is to blame:

(gdb) bt
#0  frv_secondary_reload_class (class=ICC_REGS, mode=BImode, x=0x2b0f0ec48d80, in_p=0) at /n/12/rask/src/all/gcc/config/frv/frv.c:6347
#1  0x000000000073430a in default_secondary_reload (in_p=0 '\0', x=0x2b0f0ec48d80, reload_class=GPR_REGS, reload_mode=BImode, sri=0x7fff9c430880)
    at /n/12/rask/src/all/gcc/targhooks.c:595
#2  0x00000000006bca5c in secondary_reload_class (in_p=1 '\001', class=GPR_REGS, mode=VOIDmode, x=0x7) at /n/12/rask/src/all/gcc/reload.c:525
#3  0x00000000006aa82f in init_regs () at /n/12/rask/src/all/gcc/regclass.c:1285
#4  0x0000000000737032 in backend_init_target () at /n/12/rask/src/all/gcc/toplev.c:2040
#5  0x000000000073751a in toplev_main (argc=<value optimized out>, argv=<value optimized out>) at /n/12/rask/src/all/gcc/toplev.c:2086
#6  0x00002b0f0ea1d4ca in __libc_start_main () from /lib/libc.so.6
#7  0x0000000000403c2a in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb) fin
Run till exit from #0  frv_secondary_reload_class (class=ICC_REGS, mode=BImode, x=0x2b0f0ec48d80, in_p=0) at /n/12/rask/src/all/gcc/config/frv/frv.c:6347
default_secondary_reload (in_p=0 '\0', x=0x2b0f0ec48d80, reload_class=GPR_REGS, reload_mode=BImode, sri=0x7fff9c430880)
    at /n/12/rask/src/all/gcc/targhooks.c:597
Value returned is $16 = GPR_REGS

The next few lines of code read:
  if (class != NO_REGS)
    {
      enum insn_code icode = (in_p ? reload_in_optab[(int) reload_mode]
                              : reload_out_optab[(int) reload_mode]);

(gdb) print icode
$19 = 0
(gdb) print insn_data[0]->name
$20 = 0xb8e5ba "*movqi_load"
(gdb) print insn_data[0]->n_operands
$21 = 2 '\002'

   I.e. we get the wrong icode.

(gdb) print reload_in_optab
$22 = {0 <repeats 45 times>}
(gdb) print reload_out
$23 = {0 <repeats 45 times>}

   I would have expected a default of CODE_FOR_nothing, not 0. I think this is a problem with the new lazy optab initialization. We now call backend_init_target() and init_regs() before calling init_optabs().
Comment 4 Rask Ingemann Lambertsen 2007-11-26 18:14:13 UTC
Created attachment 14643 [details]
patch v1

This patch makes the ICE go away.
Comment 5 Mark Mitchell 2007-11-27 22:22:12 UTC
FRV is not a primary or secondary platform.  Is there a test-case for this on another platform?
Comment 6 Rask Ingemann Lambertsen 2007-12-01 22:39:56 UTC
Created attachment 14678 [details]
patch v2

The first patch caused build failure on sh and arm, this one fixes that.
Comment 7 Rask Ingemann Lambertsen 2007-12-16 12:55:21 UTC
It's the dataflow merge (125624) that broke it. Revision 125623 with 130333 on top is fine, but 125624 with 125851 (so it builds) and 130333 on top fails.
The patch in comment #6 has one testsuite regression on arm-unknown-elf:
FAIL: gcc.dg/struct/wo_prof_malloc_size_var.c (internal compiler error)
FAIL: gcc.dg/struct/wo_prof_malloc_size_var.c (test for excess errors)
Comment 8 pinskia@gmail.com 2007-12-16 13:00:21 UTC
Subject: Re:  [4.3 Regression][frv] ICE in default_secondary_reload, at targhooks.c:612

On 16 Dec 2007 12:55:21 -0000, rask at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
> The patch in comment #6 has one testsuite regression on arm-unknown-elf:
> FAIL: gcc.dg/struct/wo_prof_malloc_size_var.c (internal compiler error)
> FAIL: gcc.dg/struct/wo_prof_malloc_size_var.c (test for excess errors)

That is not a regression ....  Just an already existing failure.

-- Pinski
Comment 9 Rask Ingemann Lambertsen 2007-12-16 13:39:21 UTC
> That is not a regression ....  Just an already existing failure.

Unmodified trunk revision 130944 doesn't have it:
diff -u build/arm-unknown-elf-results-unpatched/summary build/arm-unknown-elf-results-patched/summary
--- build/arm-unknown-elf-results-unpatched/summary     2007-12-15 02:26:10.000000000 +0100
+++ build/arm-unknown-elf-results-patched/summary       2007-12-16 04:17:59.000000000 +0100
@@ -17,6 +17,9 @@
 FAIL: gcc.dg/memcpy-1.c scan-tree-dump-times optimized "nasty_local" 0
 FAIL: gcc.dg/pr30957-1.c scan-rtl-dump loop2_unroll "Expanding Accumulator"
 FAIL: gcc.dg/var-expand1.c scan-rtl-dump loop2_unroll "Expanding Accumulator"
+FAIL: gcc.dg/struct/wo_prof_malloc_size_var.c (internal compiler error)
+FAIL: gcc.dg/struct/wo_prof_malloc_size_var.c (test for excess errors)
+UNRESOLVED: gcc.dg/struct/wo_prof_malloc_size_var.c compilation failed to produce executable
 FAIL: gcc.dg/struct/wo_prof_single_str_global.c execution test
 FAIL: gcc.dg/struct/wo_prof_single_str_local.c execution test
 FAIL: gcc.dg/struct/wo_prof_single_str_pointer.c execution test
Comment 10 Rask Ingemann Lambertsen 2007-12-16 15:18:39 UTC
> That is not a regression ....  Just an already existing failure.
OK, looks like an intermittent failure which happens about one out of four times.
Comment 11 Joseph S. Myers 2008-03-15 00:42:02 UTC
Update milestone after 4.3.0 release.
Comment 12 Mike Stein 2008-03-28 17:34:38 UTC
A simple
'int main (int argc, char *argv[]) { return 0; }'
still fails with "error: in default_secondary_reload, at
targhooks.c:612" in rev. 133684 (trunk).

                                           
Comment 13 Adrian Bunk 2008-04-25 20:46:58 UTC
Rask, what is the status of your patch?

It would be nice if this bug was fixed.
Comment 14 Richard Biener 2008-06-06 14:58:18 UTC
4.3.1 is being released, adjusting target milestone.
Comment 15 Joseph S. Myers 2008-08-27 22:03:01 UTC
4.3.2 is released, changing milestones to 4.3.3.
Comment 16 Richard Biener 2009-01-24 10:20:01 UTC
GCC 4.3.3 is being released, adjusting target milestone.
Comment 17 Richard Biener 2009-08-04 12:28:36 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 18 Richard Biener 2010-05-22 18:11:48 UTC
GCC 4.3.5 is being released, adjusting target milestone.
Comment 19 Richard Biener 2011-06-27 12:13:44 UTC
4.3 branch is being closed, moving to 4.4.7 target.
Comment 20 Jakub Jelinek 2012-03-13 12:46:45 UTC
4.4 branch is being closed, moving to 4.5.4 target.
Comment 21 Steven Bosscher 2012-11-09 23:32:29 UTC
Doesn't ice for me at trunk r193358.