Bug 19121 - [4.0 Regression] ICE: in merge_alias_info, at tree-ssa-copy.c:236
Summary: [4.0 Regression] ICE: in merge_alias_info, at tree-ssa-copy.c:236
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Diego Novillo
URL:
Keywords: ice-checking, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2004-12-21 22:02 UTC by Václav Haisman
Modified: 2005-01-18 03:52 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-01-06 22:56:07


Attachments
Preprocessed source. (78.23 KB, text/plain)
2004-12-21 22:03 UTC, Václav Haisman
Details
a little reduced (38.35 KB, text/plain)
2004-12-21 23:25 UTC, Andrew Pinski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Václav Haisman 2004-12-21 22:02:53 UTC
Perl compilation problem at -O3:

wilx@logout:::~/tmp/perl-5.8.6> gcc -c -DPERL_CORE -DHAS_FPSETMASK
-DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include -O3 -Wall
-save-temps toke.c
gcc: warning: -pipe ignored because -save-temps specified
toke.c: In function 'Perl_yylex':
toke.c:2193: internal compiler error: in merge_alias_info, at tree-ssa-copy.c:236
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

wilx@logout:::~/tmp/perl-5.8.6> gcc -v
Reading specs from /home/4/wilx/lib/gcc/i386-unknown-freebsd4.10/4.0.0/specs
Configured with: ../srcdir/configure --disable-nls
--enable-version-specific-runtime-libs --enable-dwarf2 --with-cpu=pentium3
--with-arch=pentium3 --with-system-zlib --disable-shared --prefix=/home/4/wilx
--enable-languages=c,c++ --disable-sjlj-exceptions --enable-shared=libstdc++
--enable-shared=libobjc --with-gc=zone
Thread model: posix
gcc version 4.0.0 20041215 (experimental)
Comment 1 Václav Haisman 2004-12-21 22:03:42 UTC
Created attachment 7800 [details]
Preprocessed source.
Comment 2 Andrew Pinski 2004-12-21 22:12:35 UTC
I can confirm this on the mainline, I am reducing it right now.
Comment 3 Andrew Pinski 2004-12-21 23:25:21 UTC
Created attachment 7801 [details]
a little reduced

This is as far as I have gotten (6899 lines).
Comment 4 Andrew Pinski 2004-12-21 23:41:16 UTC
Note there is another bug with "-O3 -fno-strict-aliasing  -fno-tree-dominator-opts".
Comment 5 Andrew Pinski 2004-12-22 02:25:17 UTC
Reduced testcase (24 lines or so, yes it looks nothing like the original):
typedef struct interpreter {
  char Itokenbuf[256];
} PerlInterpreter;
static inline void S_missingterm(char *s)
{
  char tmpbuf[3] = "";
  char q;
  if (!s)
    s = tmpbuf;
  q = strchr(s,'"') ? '\'' : '"';
}
void S_scan_heredoc(PerlInterpreter *my_perl, char *s, int i)
{
  char term;
  term = *my_perl->Itokenbuf;
  if (i)
  {
    *s = term;
    S_missingterm(my_perl->Itokenbuf);
  }
  else
    S_missingterm(my_perl->Itokenbuf);
}
Comment 6 Andrew Pinski 2004-12-22 02:27:49 UTC
(In reply to comment #5)
> Reduced testcase (24 lines or so, yes it looks nothing like the original):
Also note that -O2 is only needed to get the ICE.
Comment 7 Andrew Pinski 2004-12-22 02:35:03 UTC
It worked with 20041017.
Comment 8 Andrew Pinski 2004-12-22 23:13:35 UTC
I can also reproduce it this on powerpc-darwin.
Comment 9 Andrew Pinski 2004-12-23 05:56:27 UTC
This is definitely an problem in the aliasing code:
  D.1126_6 = &my_perl_5->Itokenbuf[0];
  term_7 = *D.1126_6;
  if (i_8 != 0) goto <L0>; else goto <L6>;
<L0>:;
  *s_18 = term_7;
  s_19 = &my_perl_5->Itokenbuf[0];
  s_20 = s_19;
  tmpbuf = "";
  if (s_20 == 0B) goto <L1>; else goto <L2>;
<L1>:;
  s_27 = &tmpbuf;

  # s_1 = PHI <s_20(1), s_27(2)>;
<L2>:;

What DOM did was combined the two "&my_perl_5->Itokenbuf[0]" so s_19 = D.1126_6
and then say that s_20 will never be zero as we already loaded from D.1126_6 so it turned s_20==0 to 
false, then prograted D.1126_6 into the PHI of s_1 which causes the ICE.
Comment 10 Andrew Pinski 2004-12-23 06:21:34 UTC
Note this works on the tree cleanup branch.
Comment 11 Andrew Pinski 2004-12-23 20:33:47 UTC
: Search converges between 2004-10-26-161001-trunk (#611) and 2004-11-03-014001-trunk 
(#612).
Comment 12 Diego Novillo 2005-01-18 03:52:57 UTC
Fixed.  http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01071.html.
Comment 13 GCC Commits 2005-01-18 03:54:41 UTC
Subject: Bug 19121

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dnovillo@gcc.gnu.org	2005-01-18 03:54:38

Modified files:
	gcc            : ChangeLog tree-ssa-alias.c tree-ssa-copy.c 
	                 tree-ssa.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/compile: pr19121.c 

Log message:
	PR tree-optimization/19121
	* tree-ssa-alias.c (compute_flow_sensitive_aliasing): When
	adding aliases to a name tag, also add them to the pointer's
	type tag.
	* tree-ssa-copy.c (merge_alias_info): Do not merge flow
	sensitive alias info at all.  Only check that the two pointers
	have compatible pointed-to sets.
	* tree-ssa.c (verify_name_tags): Verify that the alias set of
	a pointer's type tag is a superset of the alias set of the
	pointer's name tag.
	
	testsuite/ChangeLog:
	
	PR tree-optimization/19121
	* gcc.c-torture/compile/pr19121.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7163&r2=2.7164
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-alias.c.diff?cvsroot=gcc&r1=2.65&r2=2.66
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-copy.c.diff?cvsroot=gcc&r1=2.21&r2=2.22
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa.c.diff?cvsroot=gcc&r1=2.70&r2=2.71
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4899&r2=1.4900
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr19121.c.diff?cvsroot=gcc&r1=NONE&r2=1.1