Bug 91162 - [7 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.c:86 (error: invalid 'PHI' argument)
Summary: [7 Regression] ICE: tree check: expected class 'type', have 'exceptional' (er...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 10.0
: P2 normal
Target Milestone: 7.5
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2019-07-14 07:57 UTC by Arseny Solokha
Modified: 2019-09-02 12:59 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-unknown-linux-gnu
Build:
Known to work: 10.0, 7.4.1, 8.3.0, 8.3.1, 9.1.1
Known to fail: 7.4.0, 8.3.0, 9.1.0
Last reconfirmed: 2019-07-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2019-07-14 07:57:09 UTC
gcc-10.0.0-alpha20190707 snapshot (r273184) ICEs when compiling the following testcase w/ -O1 -ftree-parallelize-loops=2 -fno-tree-dominator-opts --param parloops-min-per-thread=30:

void
zf (__int128 ct)
{
  __int128 *rk = &ct;

  if (0)
    {
      int jj;

 t9:
      for (jj = 0; jj < 60; ++jj)
        {
        }

      __builtin_unreachable ();
    }

  while (*rk < 1)
    ++*rk;

  goto t9;
}

% x86_64-unknown-linux-gnu-gcc-10.0.0-alpha20190707 -O1 -ftree-parallelize-loops=2 -fno-tree-dominator-opts --param parloops-min-per-thread=30 -c qv6ltsdb.c              
qv6ltsdb.c: In function 'zf':
qv6ltsdb.c:2:1: error: invalid 'PHI' argument
    2 | zf (__int128 ct)
      | ^~
_51
during GIMPLE pass: ompexpssa
qv6ltsdb.c:2:1: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.c:86
0x70656e tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*)
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190707/work/gcc-10-20190707/gcc/tree.c:9950
0x61d053 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190707/work/gcc-10-20190707/gcc/tree.h:3340
0x61d053 useless_type_conversion_p(tree_node*, tree_node*)
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190707/work/gcc-10-20190707/gcc/gimple-expr.c:86
0xd94001 verify_gimple_phi
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190707/work/gcc-10-20190707/gcc/tree-cfg.c:4978
0xd94001 verify_gimple_in_cfg(function*, bool)
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190707/work/gcc-10-20190707/gcc/tree-cfg.c:5307
0xc6e519 execute_function_todo
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190707/work/gcc-10-20190707/gcc/passes.c:1963
0xc6f2c6 execute_todo
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190707/work/gcc-10-20190707/gcc/passes.c:2017
Comment 1 Martin Liška 2019-07-15 07:39:08 UTC
Confirmed, started with r269765.
Comment 2 Richard Biener 2019-07-15 08:07:03 UTC
I will have a look.
Comment 3 Richard Biener 2019-07-15 08:47:53 UTC
So somehow autopar doesn't deal with virtual operands being live across the
moved region.  move_block_to_fn simply releases virtual PHI defs which leaves
uses of it in the IL.  It later calls update_ssa anyways so replacing the
defs uses with its bare symbol will do the correct thing.
Comment 4 Richard Biener 2019-07-15 12:49:18 UTC
Author: rguenth
Date: Mon Jul 15 12:48:47 2019
New Revision: 273492

URL: https://gcc.gnu.org/viewcvs?rev=273492&root=gcc&view=rev
Log:
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.

Added:
    trunk/gcc/testsuite/gcc.dg/autopar/pr91162.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-cfg.c
Comment 5 Richard Biener 2019-07-15 12:54:41 UTC
Fixed on trunk sofar.
Comment 6 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 7 Richard Biener 2019-07-31 15:42:45 UTC
Latent, so exploring further backport.
Comment 8 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 9 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 10 Richard Biener 2019-09-02 12:59:26 UTC
Fixed.