Bug 57026 - [4.9 Regression] ice: SSA corruption
Summary: [4.9 Regression] ice: SSA corruption
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks: 56982
  Show dependency treegraph
 
Reported: 2013-04-21 18:34 UTC by David Binderman
Modified: 2013-04-23 08:08 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-04-22 00:00:00


Attachments
C source code (91.18 KB, text/x-csrc)
2013-04-21 18:34 UTC, David Binderman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2013-04-21 18:34:26 UTC
Created attachment 29910 [details]
C source code

I just tried to compile the package GREYCstoration-2.8-15.fc20
on gcc-4.9 trunk dated 20130421 on an AMD x86_64 box.

The compiler said

Unable to coalesce ssa_names 97 and 101 which are marked as MUST COALESCE.
image_depth_97(ab) and  image_depth_101(ab)
coders/png.c: In function 'WriteOnePNGImage':
coders/png.c:6287:23: internal compiler error: SSA corruption
 static MagickPassFail WriteOnePNGImage(MngInfo *mng_info,
                       ^
0x9b1baf fail_abnormal_edge_coalesce
    ../../src/trunk/gcc/tree-ssa-coalesce.c:934
0x9b1baf coalesce_partitions
    ../../src/trunk/gcc/tree-ssa-coalesce.c:1236
0x9b1baf coalesce_ssa_name()
    ../../src/trunk/gcc/tree-ssa-coalesce.c:1373
0x969ba3 remove_ssa_form
    ../../src/trunk/gcc/tree-outof-ssa.c:900
0x969ba3 rewrite_out_of_ssa(ssaexpand*)
    ../../src/trunk/gcc/tree-outof-ssa.c:1133
0x5f5f44 gimple_expand_cfg
    ../../src/trunk/gcc/cfgexpand.c:4480
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Preprocessed source code attached. Flag -O2 required.
Comment 1 Jakub Jelinek 2013-04-22 06:55:04 UTC
Reduced testcase:
typedef struct __jmp_buf_tag { char buf[1024]; } jmp_buf[1];
extern int setjmp (jmp_buf);
extern int bar (unsigned int *);
extern jmp_buf *baz (void);
struct C { int c1; unsigned int c2, c3, c4; };

void
foo (struct C *x, const int *y, unsigned int *z, unsigned int e, unsigned int g)
{
  unsigned int d;
  unsigned long f;
  setjmp (*baz ());
  f = d;
  if ((x->c1 || x->c2) && g && (!e || d >= 8))
    d = 16;
  else
    d = 8;
  if ((!x->c3 && !x->c4 || *y == 0) && !e && bar (z))
    *z = f;
}

Guess caused by http://gcc.gnu.org/r198096
Comment 2 Richard Biener 2013-04-22 12:33:29 UTC
I will have a look.
Comment 3 Richard Biener 2013-04-22 12:50:10 UTC
VRP does

   setjmp (_3(ab));
-  f_12 = (long unsigned int) d_1(ab);
...
-  <bb 15>:
-  _26 = (unsigned int) f_12;
+  <bb 16>:
+  _26 = d_1(ab);
   *z_23(D) = _26;

that's obviously not ok.
Comment 4 Richard Biener 2013-04-23 08:08:55 UTC
Author: rguenth
Date: Tue Apr 23 08:08:25 2013
New Revision: 198175

URL: http://gcc.gnu.org/viewcvs?rev=198175&root=gcc&view=rev
Log:
2013-04-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/57026
	* tree-vrp.c (simplify_conversion_using_ranges): Do not propagate
	from SSA names occuring in abnormal PHI nodes.

	* gcc.dg/torture/pr57026.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr57026.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c