Bug 70775 - [7 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: Segmentation fault
Summary: [7 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: Segmentation fault
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 7.0
: P1 normal
Target Milestone: 7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-24 01:17 UTC by Zhendong Su
Modified: 2016-05-04 14:31 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-04-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhendong Su 2016-04-24 01:17:20 UTC
The following code causes an ICE when compiled with the current gcc trunk at -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It is a regression from 5.3.x.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160423 (experimental) [trunk revision 235384] (GCC) 
$ 
$ gcc-trunk -O2 -c small.c
$ gcc-5.3 -O3 -c small.c
$ 
$ gcc-trunk -O3 -c small.c
small.c: In function ‘fn2’:
small.c:17:1: internal compiler error: Segmentation fault
 fn2 ()
 ^~~
0xb6718f crash_signal
        ../../gcc-source-trunk/gcc/toplev.c:333
0x74e89c vec_safe_length<loop*, va_gc>
        ../../gcc-source-trunk/gcc/vec.h:524
0x74e89c loop_depth
        ../../gcc-source-trunk/gcc/cfgloop.h:444
0x74e89c flow_loop_nested_p(loop const*, loop const*)
        ../../gcc-source-trunk/gcc/cfgloop.c:64
0xdb7837 vect_is_simple_reduction
        ../../gcc-source-trunk/gcc/tree-vect-loop.c:2627
0xdb9011 vect_force_simple_reduction
        ../../gcc-source-trunk/gcc/tree-vect-loop.c:3026
0xdb9011 vect_analyze_scalar_cycles_1
        ../../gcc-source-trunk/gcc/tree-vect-loop.c:865
0xdbc807 vect_analyze_scalar_cycles
        ../../gcc-source-trunk/gcc/tree-vect-loop.c:939
0xdbc807 vect_analyze_loop_2
        ../../gcc-source-trunk/gcc/tree-vect-loop.c:1845
0xdbc807 vect_analyze_loop(loop*)
        ../../gcc-source-trunk/gcc/tree-vect-loop.c:2264
0xdd7611 vectorize_loops()
        ../../gcc-source-trunk/gcc/tree-vectorizer.c:532
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.
$ 
$ 


------------------------------------------


struct S
{
  int f1;
  int f2;
} a;

int b, c, d, e;
short f;

int
fn1 (int p1, unsigned p2)
{
  return p1 + p2;
}

void
fn2 ()
{
  struct S g;
  int h;
  for (; c; c++)
    for (f = -3; f < 3; f = fn1 (f, 8))
      {
        a.f1 = e;
        if (b)
          a = g;
        else
          for (; h; h++)
            d = b;
      }
}
Comment 1 Jakub Jelinek 2016-04-24 20:33:24 UTC
Started with r235292.
Comment 2 Richard Biener 2016-04-25 07:52:33 UTC
Probably a latent issue.
Comment 3 bin cheng 2016-04-26 11:11:19 UTC
Author: amker
Date: Tue Apr 26 11:10:47 2016
New Revision: 235436

URL: https://gcc.gnu.org/viewcvs?rev=235436&root=gcc&view=rev
Log:
	PR tree-optimization/70771
	PR tree-optimization/70775
	* tree-if-conv.c (if_convertible_phi_p): Remove check on special
	virtual PHI nodes.  Delete parameter.
	(if_convertible_loop_p_1): Delete argument to above function.
	(predicate_all_scalar_phis): Delete code handling single-argument
	PHIs.
	(tree_if_conversion): Mark and update virtual SSA.

	gcc/testsuite/ChangeLog
	PR tree-optimization/70771
	PR tree-optimization/70775
	* gcc.dg/pr70771.c: New test.
	* gcc.dg/pr70771.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr70771.c
    trunk/gcc/testsuite/gcc.dg/pr70775.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-if-conv.c
Comment 4 Marek Polacek 2016-05-04 14:21:45 UTC
Fixed?
Comment 5 bin cheng 2016-05-04 14:31:47 UTC
Yes, fixed.