Bug 57864 - [4.7 Regression] ICE in bitmap_set_replace_value, at tree-ssa-pre.c:862
Summary: [4.7 Regression] ICE in bitmap_set_replace_value, at tree-ssa-pre.c:862
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.7.3
: P2 normal
Target Milestone: 4.7.4
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2013-07-09 11:22 UTC by Joachim Klein
Modified: 2014-05-07 08:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.7.2, 4.8.0
Known to fail: 4.7.3
Last reconfirmed: 2013-08-27 00:00:00


Attachments
Reduced testcase, crashes 4.7.3 when compiled with -O3 -m64 (272 bytes, text/plain)
2013-07-09 11:22 UTC, Joachim Klein
Details
slightly reduced test case in plain C (226 bytes, text/plain)
2013-07-09 17:10 UTC, Mikael Pettersson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Klein 2013-07-09 11:22:57 UTC
Created attachment 30482 [details]
Reduced testcase, crashes 4.7.3 when compiled with -O3 -m64

The attached reduced testcase produces an ICE on 4.7.3 when compiled with -O3. -O2 is fine, as is 4.7.2 and 4.8.0. Compilation with -m32 likewise passes.

$ /opt/gccs/4.7.3/bin/g++--4.7.3 -c -O3 -m64 testcase.cpp 
testcase.cpp: In function ‘void _ZL3fn1P1Xib.constprop.0(X*, bool)’:
testcase.cpp:18:1: internal compiler error: in bitmap_set_replace_value, at tree-ssa-pre.c:862

This seems to be related to bug 55888 and bug 55107.





Full details:

$ /opt/gccs/4.7.3/bin/g++--4.7.3 -v -c -O3 -m64 testcase.cpp 
Using built-in specs.
COLLECT_GCC=/opt/gccs/4.7.3/bin/g++--4.7.3
Target: x86_64-unknown-linux-gnu
Configured with: ../src/gcc-4.7.3/configure --prefix=/opt/gccs/4.7.3 --program-suffix=--4.7.3 --enable-languages=c,c++ --disable-bootstrap
Thread model: posix
gcc version 4.7.3 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-c' '-O3' '-m64' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /opt/gccs/4.7.3/libexec/gcc/x86_64-unknown-linux-gnu/4.7.3/cc1plus -quiet -v -D_GNU_SOURCE testcase.cpp -quiet -dumpbase testcase.cpp -m64 -mtune=generic -march=x86-64 -auxbase testcase -O3 -version -o /tmp/ccm58ig9.s
GNU C++ (GCC) version 4.7.3 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.4.5, GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/opt/gccs/4.7.3/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/gccs/4.7.3/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../include/c++/4.7.3
 /opt/gccs/4.7.3/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../include/c++/4.7.3/x86_64-unknown-linux-gnu
 /opt/gccs/4.7.3/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../include/c++/4.7.3/backward
 /opt/gccs/4.7.3/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/include
 /opt/gccs/4.7.3/include
 /opt/gccs/4.7.3/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.7.3 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.4.5, GMP version 4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4073671a6c09c56d7812f3b7ae137fde
testcase.cpp: In function ‘void _ZL3fn1P1Xib.constprop.0(X*, bool)’:
testcase.cpp:18:1: internal compiler error: in bitmap_set_replace_value, at tree-ssa-pre.c:862
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Mikael Pettersson 2013-07-09 17:10:52 UTC
Created attachment 30486 [details]
slightly reduced test case in plain C

Doesn't depend on C++, this plain C version also ICEs 4.7.3.
Comment 2 Mikael Pettersson 2013-07-09 20:01:39 UTC
The ICE on 4.7 branch started with the PR55107 backport in r195755.
Comment 3 Richard Biener 2013-08-27 13:34:49 UTC
Confirmed, mine.  I _think_ I have fixed a duplicate of this on trunk/4.8 ...
Comment 4 Richard Biener 2014-05-06 13:27:35 UTC
Caused by

static pre_expr
phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
                 basic_block pred, basic_block phiblock)
{
...
    case NAME:
      {
...
           if (TREE_CODE (def) == SSA_NAME)
              def = VN_INFO (def)->valnum;

picking up VN inserted expressions.  I re-wrote this as part of

2012-09-24  Richard Guenther  <rguenther@suse.de>

       * tree-ssa-pre.c (bitmap_find_leader, create_expression_by_pieces,
       find_or_generate_expression): Remove dominating stmt argument.
       (find_leader_in_sets, phi_translate_1, bitmap_find_leader,
       create_component_ref_by_pieces_1, create_component_ref_by_pieces,
       do_regular_insertion, do_partial_partial_insertion): Adjust.
       (compute_avail): Do not set uids.

and that fixed it.  I am going to try backporting that change in isolation.
Comment 5 Richard Biener 2014-05-07 08:04:47 UTC
Author: rguenth
Date: Wed May  7 08:04:15 2014
New Revision: 210142

URL: http://gcc.gnu.org/viewcvs?rev=210142&root=gcc&view=rev
Log:
2014-05-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/57864
	* gcc.dg/torture/pr57864.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr57864.c
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 6 Richard Biener 2014-05-07 08:05:48 UTC
Author: rguenth
Date: Wed May  7 08:05:17 2014
New Revision: 210143

URL: http://gcc.gnu.org/viewcvs?rev=210143&root=gcc&view=rev
Log:
2014-05-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/57864
	* gcc.dg/torture/pr57864.c: New testcase.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr57864.c
Modified:
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Comment 7 Richard Biener 2014-05-07 08:06:29 UTC
Author: rguenth
Date: Wed May  7 08:05:57 2014
New Revision: 210144

URL: http://gcc.gnu.org/viewcvs?rev=210144&root=gcc&view=rev
Log:
2014-05-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/57864
	* tree-ssa-pre.c (phi_translate_1): Backport NAME case
	simplification from mainline.  Do not lookup the VN
	value-number here.

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

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr57864.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/tree-ssa-pre.c
Comment 8 Richard Biener 2014-05-07 08:07:07 UTC
Fixed.
Comment 9 Richard Biener 2014-05-07 08:07:16 UTC
Author: rguenth
Date: Wed May  7 08:06:45 2014
New Revision: 210145

URL: http://gcc.gnu.org/viewcvs?rev=210145&root=gcc&view=rev
Log:
2014-05-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/57864
	* gcc.dg/torture/pr57864.c: New testcase.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr57864.c
Modified:
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog