Bug 91200 - ICE on valid code at -O1: verify_ssa failed
Summary: ICE on valid code at -O1: verify_ssa failed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 7.5
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-18 13:47 UTC by Zhendong Su
Modified: 2019-09-02 12:59 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 10.0, 7.4.1, 8.3.1, 9.1.1
Known to fail:
Last reconfirmed: 2019-07-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhendong Su 2019-07-18 13:47:52 UTC
It appears to be a recent regression.

[512] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/home/suz/software/gcctk/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --disable-multilib --enable-languages=c,c++,lto --prefix=/home/suz/software/gcctk/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.0 20190718 (experimental) [trunk revision 273570] (GCC) 
[513] % 
[513] % gcctk -O0 small.c
[514] % gcc-9.1.0 -O1 small.c
[515] % 
[515] % gcctk -O1 small.c
small.c: In function ‘main’:
small.c:6:5: error: definition in block 4 does not dominate use in block 3
    6 | int main ()
      |     ^~~~
for SSA_NAME: i_20 in statement:
# VUSE <.MEM_13>
cstore_6 = MEM <int *[2]> [(void *)&h][i_20];
during GIMPLE pass: cselim
small.c:6:5: internal compiler error: verify_ssa failed
0xed1acb verify_ssa(bool, bool)
	../../gcc-source-trunk/gcc/tree-ssa.c:1208
0xb861d7 execute_function_todo
	../../gcc-source-trunk/gcc/passes.c:1970
0xb87102 execute_todo
	../../gcc-source-trunk/gcc/passes.c:2017
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.
[516] % 


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


int printf (const char *, ...);

char a;
int b, c, **d;

int main ()
{
  int f = -128, *g, *h[2] = {0, 0}, i;
  printf("0");
  if (a)
    {
      while (f > a) {
        int *j = &i;
        *j |= 0;
      }
      h[i] = &c;
    }
  if (h[1])
    {
      int **k = &g;
      *k = &f;
      while (i)
        {
          int **l[] = {&g};
        }
      int **m = &g;
      *d = *m = &b;
    }
  return 0;
}
Comment 1 Richard Biener 2019-07-19 07:47:07 UTC
Latent issue - mine.
Comment 2 Richard Biener 2019-07-19 07:58:25 UTC
So we're applying cselim to

  if (a.0_1 != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 766958447]:
  # i_20 = PHI <i_22(D)(2)>
  h[i_20] = &c;

  <bb 4> [local count: 168730858]:
  # i_21 = PHI <i_22(D)(2), i_20(3)>

where bb3 has only a single stmt but the PHI node precludes simply inserting
the stmt elsewhere.

The PHI node is left from non-iterating FRE which isn't able to do all
simplification in one go.
Comment 3 Richard Biener 2019-07-19 12:25:25 UTC
Author: rguenth
Date: Fri Jul 19 12:24:53 2019
New Revision: 273602

URL: https://gcc.gnu.org/viewcvs?rev=273602&root=gcc&view=rev
Log:
2019-07-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91200
	* tree-ssa-phiopt.c (cond_store_replacement): Check we have
	no PHI nodes in middle-bb.

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

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr91200.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-phiopt.c
Comment 4 Richard Biener 2019-07-31 15:41:07 UTC
Author: rguenth
Date: Wed Jul 31 15:40:36 2019
New Revision: 273939

URL: https://gcc.gnu.org/viewcvs?rev=273939&root=gcc&view=rev
Log:
2019-07-31  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2019-07-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91200
	* tree-ssa-phiopt.c (cond_store_replacement): Check we have
	no PHI nodes in middle-bb.

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

	2019-07-15  Richard Biener  <rguenther@suse.de>

	PR middle-end/91162
	* tree-cfg.c (move_block_to_fn): When releasing a virtual PHI
	node make sure to replace all uses with something valid.

	* gcc.dg/autopar/pr91162.c: New testcase.

	2019-07-12  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91145
	* tree-vect-slp.c (vect_build_slp_tree_2): Fix reduction
	chain check.

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

	2019-07-11  Richard Biener  <rguenther@suse.de>

	PR middle-end/91131
	* gimplify.c (gimplify_compound_literal_expr): Force a temporary
	when the object is volatile and we have not cleared it even though
	there are no nonzero elements.

	* gcc.target/i386/pr91131.c: New testcase.

	2019-07-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91126
	* tree-ssa-sccvn.c (n_walk_cb_data::push_partial_def): Adjust
	native encoding offset for BYTES_BIG_ENDIAN.
	(vn_reference_lookup_3): Likewise.

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

Added:
    branches/gcc-9-branch/gcc/testsuite/gcc.dg/autopar/pr91162.c
    branches/gcc-9-branch/gcc/testsuite/gcc.dg/torture/pr91126.c
    branches/gcc-9-branch/gcc/testsuite/gcc.dg/torture/pr91145.c
    branches/gcc-9-branch/gcc/testsuite/gcc.dg/torture/pr91200.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/i386/pr91131.c
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/gimplify.c
    branches/gcc-9-branch/gcc/testsuite/ChangeLog
    branches/gcc-9-branch/gcc/tree-cfg.c
    branches/gcc-9-branch/gcc/tree-ssa-phiopt.c
    branches/gcc-9-branch/gcc/tree-ssa-sccvn.c
    branches/gcc-9-branch/gcc/tree-vect-slp.c
Comment 5 Richard Biener 2019-08-30 11:39:51 UTC
Author: rguenth
Date: Fri Aug 30 11:39:19 2019
New Revision: 275100

URL: https://gcc.gnu.org/viewcvs?rev=275100&root=gcc&view=rev
Log:
2019-08-30  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2019-08-12  Richard Biener  <rguenther@suse.de>

	PR lto/91375
	* tree.c (free_lang_data_in_type): Do not free TYPE_BINFO dependent on
	flag_devirtualize.

	2019-07-31  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91293
	* tree-vect-slp.c (vect_build_slp_tree_2): Do not swap operands
	of reduction stmts.

	* gcc.dg/vect/pr91293-1.c: New testcase.
	* gcc.dg/vect/pr91293-2.c: Likewise.
	* gcc.dg/vect/pr91293-3.c: Likewise.

	2019-07-31  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91280
	* tree-ssa-structalias.c (get_constraint_for_component_ref):
	Decompose MEM_REF manually for offset handling.

	* g++.dg/torture/pr91280.C: New testcase.

	2019-07-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91200
	* tree-ssa-phiopt.c (cond_store_replacement): Check we have
	no PHI nodes in middle-bb.

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

	2019-07-15  Richard Biener  <rguenther@suse.de>

	PR middle-end/91162
	* tree-cfg.c (move_block_to_fn): When releasing a virtual PHI
	node make sure to replace all uses with something valid.

	* gcc.dg/autopar/pr91162.c: New testcase.

	2019-07-11  Richard Biener  <rguenther@suse.de>

	PR middle-end/91131
	* gimplify.c (gimplify_compound_literal_expr): Force a temporary
	when the object is volatile and we have not cleared it even though
	there are no nonzero elements.

	* gcc.target/i386/pr91131.c: New testcase.

	2019-07-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91126
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Adjust
	native encoding offset for BYTES_BIG_ENDIAN.

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

Added:
    branches/gcc-8-branch/gcc/testsuite/g++.dg/torture/pr91280.C
    branches/gcc-8-branch/gcc/testsuite/gcc.dg/autopar/pr91162.c
    branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr91126.c
    branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr91200.c
    branches/gcc-8-branch/gcc/testsuite/gcc.dg/vect/pr91293-1.c
    branches/gcc-8-branch/gcc/testsuite/gcc.dg/vect/pr91293-2.c
    branches/gcc-8-branch/gcc/testsuite/gcc.dg/vect/pr91293-3.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr91131.c
Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/gimplify.c
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
    branches/gcc-8-branch/gcc/tree-cfg.c
    branches/gcc-8-branch/gcc/tree-ssa-phiopt.c
    branches/gcc-8-branch/gcc/tree-ssa-sccvn.c
    branches/gcc-8-branch/gcc/tree-ssa-structalias.c
    branches/gcc-8-branch/gcc/tree-vect-slp.c
    branches/gcc-8-branch/gcc/tree.c
Comment 6 Richard Biener 2019-09-02 12:56:55 UTC
Author: rguenth
Date: Mon Sep  2 12:56:24 2019
New Revision: 275317

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

	Backport from mainline
	2019-07-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91200
	* tree-ssa-phiopt.c (cond_store_replacement): Check we have
	no PHI nodes in middle-bb.

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

	2019-07-15  Richard Biener  <rguenther@suse.de>

	PR middle-end/91162
	* tree-cfg.c (move_block_to_fn): When releasing a virtual PHI
	node make sure to replace all uses with something valid.

	* gcc.dg/autopar/pr91162.c: New testcase.

	2019-07-11  Richard Biener  <rguenther@suse.de>

	PR middle-end/91131
	* gimplify.c (gimplify_compound_literal_expr): Force a temporary
	when the object is volatile and we have not cleared it even though
	there are no nonzero elements.

	* gcc.target/i386/pr91131.c: New testcase.

	2019-07-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91126
	* tree-ssa-sccvn.c (n_walk_cb_data::push_partial_def): Adjust
	native encoding offset for BYTES_BIG_ENDIAN.
	(vn_reference_lookup_3): Likewise.

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

	2019-07-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91126
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Adjust
	native encoding offset for BYTES_BIG_ENDIAN.

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

	2019-04-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/90278
	* tree-ssa-forwprop.c (pass_forwprop::execute): Transfer/clean
	EH on comparison simplification.

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

	2019-04-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/90020
	* tree-ssa-sccvn.c (vn_reference_may_trap): New function.
	* tree-ssa-sccvn.h (vn_reference_may_trap): Declare.
	* tree-ssa-pre.c (compute_avail): Use it to not put
	possibly trapping references after a call that might not
	return into EXP_GEN.
	* gcse.c (compute_hash_table_work): Do not elide
	marking a block containing a call if the call might not
	return.

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

Added:
    branches/gcc-7-branch/gcc/testsuite/gcc.dg/autopar/pr91162.c
    branches/gcc-7-branch/gcc/testsuite/gcc.dg/torture/pr90020.c
    branches/gcc-7-branch/gcc/testsuite/gcc.dg/torture/pr90278.c
    branches/gcc-7-branch/gcc/testsuite/gcc.dg/torture/pr91126.c
    branches/gcc-7-branch/gcc/testsuite/gcc.dg/torture/pr91200.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/pr91131.c
Modified:
    branches/gcc-7-branch/gcc/ChangeLog
    branches/gcc-7-branch/gcc/gcse.c
    branches/gcc-7-branch/gcc/gimplify.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
    branches/gcc-7-branch/gcc/tree-cfg.c
    branches/gcc-7-branch/gcc/tree-ssa-forwprop.c
    branches/gcc-7-branch/gcc/tree-ssa-phiopt.c
    branches/gcc-7-branch/gcc/tree-ssa-pre.c
    branches/gcc-7-branch/gcc/tree-ssa-sccvn.c
    branches/gcc-7-branch/gcc/tree-ssa-sccvn.h
Comment 7 Richard Biener 2019-09-02 12:59:02 UTC
Fixed.