Bug 47489 - ICE with -fdump-rtl-mach-slim and -O1 on mips (and other targets which have SEQUENCEs)
Summary: ICE with -fdump-rtl-mach-slim and -O1 on mips (and other targets which have ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.6.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-01-27 11:23 UTC by Joachim Breitner
Modified: 2012-08-06 11:18 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.8.0
Known to fail: 4.6.3, 4.7.1
Last reconfirmed: 2012-01-05 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Breitner 2011-01-27 11:23:43 UTC
Hi,

I have hit a ICE and could reduce it to the following minimal example:

$ cat bug-demo.c
int func() {
	return 0;
}

$ build-mips/gcc/cc1 -O1 -fdump-rtl-mach-slim  bug-demo.c 
 func
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <early_local_cleanups> <emutls> <whole-program> <ipa-profile> <inline> <pure-const> <static-var>Assembling functions:
 func
bug-demo.c: In function ‘func’:
bug-demo.c:3:1: internal compiler error: in print_pattern, at sched-vis.c:602
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

It does not happen with -fdump-rtl-mach, i.e. without slim.

I could not reproduce it by passing individual "-f..." flags instead of -O2, even though the output of "--help", which mentions which flags are enabled/disabled, is identical.

This is gcc-4.6 snapshot 20101225, configured using the command line:
../gcc-4.6-20101225/configure --prefix=$PWD/../install  --disable-bootstrap --disable-multilib --enable-stage1-languages=c --disable-lib{gcj,ada,ssp,mudflap,gomp} --enable-languages=c --target=mips-linux


Thanks,
Joachim
Comment 1 Andrey Belevantsev 2011-01-28 09:43:05 UTC
Confirmed.  This is because we deliberately abort on SEQUENCEs here since 2002 (rev. 54497) because of:

    2002-06-05  David S. Miller  <davem@redhat.com>

        Delete SEQUENCE rtl usage outside of reorg and ssa passes.

So either we reinstate the hunk deleted back there like with patch below, or we document that slim dumps cannot be requested for machine reorg and later passes.

diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c
index 25a0b60..331ccbf 100644
--- a/gcc/sched-vis.c
+++ b/gcc/sched-vis.c
@@ -599,8 +599,19 @@ print_pattern (char *buf, const_rtx x, int verbose)
       }
       break;
     case SEQUENCE:
-      /* Should never see SEQUENCE codes until after reorg.  */
-      gcc_unreachable ();
+      {
+       int i;
+
+       sprintf (t1, "%%{");
+       for (i = 0; i < XVECLEN (x, 0); i++)
+         {
+           print_insn (t2, XVECEXP (x, 0, i), verbose);
+           sprintf (t3, "%s%s;", t1, t2);
+           strcpy (t1, t3);
+         }
+       sprintf (buf, "%s%%}", t1);
+      }
+      break;
     case ASM_INPUT:
       sprintf (buf, "asm {%s}", XSTR (x, 0));
       break;
Comment 2 Steven Bosscher 2012-08-06 11:18:34 UTC
Accidentally fixed for GCC 4.8 by r190133.
(http://gcc.gnu.org/viewcvs?view=revision&revision=190113)