Bug 13177 - [tree-ssa] ICE in calculate_live_on_entry, at tree-ssa-live.c:753
Summary: [tree-ssa] ICE in calculate_live_on_entry, at tree-ssa-live.c:753
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: tree-ssa
: P2 normal
Target Milestone: tree-ssa
Assignee: Daniel Berlin
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-11-24 18:03 UTC by Anthony Green
Modified: 2003-12-03 23:50 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-12-01 04:41:44


Attachments
Preprocessed source (51.68 KB, application/octet-stream)
2003-11-24 18:03 UTC, Anthony Green
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Green 2003-11-24 18:03:04 UTC
Found builing frv-elf gdb with tree-ssa compiler.  I'll upload the .i file.

$ gcc --version
gcc (GCC) 3.5-tree-ssa 20031123 (merged 20031111)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


$ gcc -O1 -c completer.i
symbol_start_213 is defined  in BB19, by:
symbol_start_213 = pretmp.261_30
It is also live-on-entry to entry BB 0 So it appears to have multiple defs.
../../src/HEAD-2003-11-23/gdb/completer.c: In function `location_completer':
 
../../src/HEAD-2003-11-23/gdb/completer.c:200: internal compiler error: in
calculate_live_on_entry, at tree-ssa-live.c:753
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Anthony Green 2003-11-24 18:03:56 UTC
Created attachment 5205 [details]
Preprocessed source
Comment 2 Anthony Green 2003-11-24 18:06:12 UTC
I'm also seeing this bug building gdb for mn10300-elf, sh-elf, sh64-elf,
mips-elf,  and v850-elf.
Comment 3 Falk Hueffner 2003-11-24 18:28:59 UTC
Confirmed. Test case:

void make_file_symbol_completion_list (char *);
void location_completer (char *text)
{
  char *p, *symbol_start = text;
  for (p = text; *p != '\0'; ++p) {
    if (*p == '\\' && p[1] == '\'')
      p++;
    else if (*p == ':')
      symbol_start = p + 1;
    else 
      symbol_start = p + 1;
    make_file_symbol_completion_list(symbol_start);
  }
}

Needs -O.
Comment 4 Andrew Macleod 2003-11-24 18:34:42 UTC
THis appears to be a bug in PRE. I traced out the basic block flow, and PRE has
apparently inserted the specified stmt (p_201 = pretmp.344_32) in BB 9.
p_201 is only used in a PHI node in block 25:

# BLOCK 25
  # PRED: 18 (false,exec) 23 (false,exec) 55 53 24 (fallthru,exec)
  # pretmp.344_34 = PHI <p_201(18), p_201(24), pretmp.344_68(53),
pretmp.344_79(55), pretmp.344_32(23)>;

I can trace a path from BB0 to BB25 through BB18 which does not include BB9, and
so p_201 is undefined on that path:

BB0->BB3->BB26->BB4->BB5->BB7->BB8->BB17->BB18->BB25

So the error is correct, The assignment is incorrectly placed for some reason.

The problem goes away with -fno-tree-pre.

Andrew


PS, with the enw smaller testcase, the same thing can be seen:

  # BLOCK 4
  # PRED: 2 (true,exec) 3
  # pretmp.4_5 = PHI <pretmp.4_25(3), pretmp.4_26(2)>;
<L3>:;
  if (T.1_13 == 58) goto <L6>; else goto <L5>;
  # SUCC: 5 (false,exec) 6 (true,exec)

  # BLOCK 5
  # PRED: 4 (false,exec)
<L5>:;
  symbol_start_20 = pretmp.4_5;
  # SUCC: 6 (fallthru,exec)

  # BLOCK 6
  # PRED: 4 (true,exec) 9 5 (fallthru,exec)
  # symbol_start_1 = PHI <symbol_start_2(9), pretmp.4_5(4), pretmp.4_5(5)>;
  # pretmp.4_6 = PHI <symbol_start_20(4), pretmp.4_5(5), pretmp.4_24(9)>;
<L6>:;

The assignemnt symbol_start_20 is in block 5, but it is used in the PHI node
coming from block 4.

Andrew
Comment 5 Andrew Pinski 2003-11-24 19:38:50 UTC
dberlin is the PRE guy, he should look into.
Comment 6 GCC Commits 2003-12-03 23:35:56 UTC
Subject: Bug 13177

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	dberlin@gcc.gnu.org	2003-12-03 23:35:52

Modified files:
	gcc            : ChangeLog.tree-ssa tree-ssa-pre.c 

Log message:
	2003-12-03  Daniel Berlin  <dberlin@dberlin.org>
	
	Fix PR 13177
	* tree-ssa-pre.c (code_motion): Do phi nodes last, and rearrange
	how we decide what temporary to choose so that we get it right.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.960&r2=1.1.2.961
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-pre.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.4.112&r2=1.1.4.113

Comment 7 GCC Commits 2003-12-03 23:37:51 UTC
Subject: Bug 13177

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	dberlin@gcc.gnu.org	2003-12-03 23:37:48

Added files:
	gcc/testsuite/gcc.c-torture/compile: 20031203-1.c 

Log message:
	Testcase for PR 13177 fix

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20031203-1.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=NONE&r2=1.1.2.1

Comment 8 Andrew Pinski 2003-12-03 23:50:44 UTC
Fixed.