Bug 79740 - [7 Regression] ICE on -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in VN_INFO_GET, at tree-ssa-sccvn.c:407 })
Summary: [7 Regression] ICE on -Os and above in both 32-bit and 64-bit modes on x86_64...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 7.0.1
: P1 normal
Target Milestone: 7.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 45397 79777
  Show dependency treegraph
 
Reported: 2017-02-27 22:01 UTC by Chengnian Sun
Modified: 2017-03-01 12:44 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-02-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chengnian Sun 2017-02-27 22:01:50 UTC
$ 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.1/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.1 20170227 (experimental) [trunk revision 245760] (GCC) 
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:15:1: internal compiler error: in VN_INFO_GET, at tree-ssa-sccvn.c:407
 }
 ^
0xddcc76 VN_INFO_GET(tree_node*)
        ../../gcc-source-trunk/gcc/tree-ssa-sccvn.c:406
0xdb52c8 eliminate_insert
        ../../gcc-source-trunk/gcc/tree-ssa-pre.c:4133
0xdb52c8 eliminate_dom_walker::before_dom_children(basic_block_def*)
        ../../gcc-source-trunk/gcc/tree-ssa-pre.c:4267
0x1307ca7 dom_walker::walk(basic_block_def*)
        ../../gcc-source-trunk/gcc/domwalk.c:265
0xdb5b0f eliminate
        ../../gcc-source-trunk/gcc/tree-ssa-pre.c:4728
0xdb5e6d execute
        ../../gcc-source-trunk/gcc/tree-ssa-pre.c:5162
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ 
$ cat small.c
int a;
short b;
short fn1(unsigned short p1) { return p1 << a; }

int main() {
  short c;
  int d = 4;
  for (; b;) {
    c = d + 1;
    fn1(c);
    d = 0;
  }
  d++;
  return 0;
}
$
Comment 1 Marek Polacek 2017-02-27 22:04:46 UTC
Confirmed.
Comment 2 Marek Polacek 2017-02-27 22:15:34 UTC
Started with r245752.
Comment 3 Richard Biener 2017-02-28 09:13:21 UTC
Mine.
Comment 4 Richard Biener 2017-02-28 09:46:03 UTC
Testing patch.
Comment 5 Richard Biener 2017-02-28 15:32:56 UTC
Author: rguenth
Date: Tue Feb 28 15:32:24 2017
New Revision: 245780

URL: https://gcc.gnu.org/viewcvs?rev=245780&root=gcc&view=rev
Log:
2017-02-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/79740
	* tree-ssa-sccvn.c (vn_nary_op_insert_into): Allow redundant
	inserts.
	(visit_nary_op): Insert the nary into the hashtable if we
	pattern-matched sth.
	* tree-ssa-pre.c (eliminate_insert): Robustify.

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

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr79740.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-pre.c
    trunk/gcc/tree-ssa-sccvn.c
Comment 6 Richard Biener 2017-02-28 15:37:20 UTC
Fixed.
Comment 7 Arnd Bergmann 2017-03-01 12:20:23 UTC
(In reply to Richard Biener from comment #6)
> Fixed.

I still see an identical ICE with ARM64 on r245806. Opening a new PR.