Commit a6df9d90 by Martin Liska Committed by Martin Liska

Do not ICE for incomplete types in ICF (PR ipa/85607).

2018-05-22  Martin Liska  <mliska@suse.cz>

	PR ipa/85607
	* ipa-icf.c (sem_item::add_type): Do not ICE for incomplete types.
2018-05-22  Martin Liska  <mliska@suse.cz>

	PR ipa/85607
	* g++.dg/ipa/pr85607.C: New test.

From-SVN: r260502
parent 4515e413
2018-05-22 Martin Liska <mliska@suse.cz>
PR ipa/85607
* ipa-icf.c (sem_item::add_type): Do not ICE for incomplete types.
2018-05-22 Richard Biener <rguenther@suse.de> 2018-05-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/85863 PR tree-optimization/85863
......
...@@ -1580,7 +1580,13 @@ sem_item::add_type (const_tree type, inchash::hash &hstate) ...@@ -1580,7 +1580,13 @@ sem_item::add_type (const_tree type, inchash::hash &hstate)
} }
else if (RECORD_OR_UNION_TYPE_P (type)) else if (RECORD_OR_UNION_TYPE_P (type))
{ {
gcc_checking_assert (COMPLETE_TYPE_P (type)); /* Incomplete types must be skipped here. */
if (!COMPLETE_TYPE_P (type))
{
hstate.add_int (RECORD_TYPE);
return;
}
hashval_t *val = optimizer->m_type_hash_cache.get (type); hashval_t *val = optimizer->m_type_hash_cache.get (type);
if (!val) if (!val)
...@@ -1591,8 +1597,6 @@ sem_item::add_type (const_tree type, inchash::hash &hstate) ...@@ -1591,8 +1597,6 @@ sem_item::add_type (const_tree type, inchash::hash &hstate)
hashval_t hash; hashval_t hash;
hstate2.add_int (RECORD_TYPE); hstate2.add_int (RECORD_TYPE);
gcc_assert (COMPLETE_TYPE_P (type));
for (f = TYPE_FIELDS (type), nf = 0; f; f = TREE_CHAIN (f)) for (f = TYPE_FIELDS (type), nf = 0; f; f = TREE_CHAIN (f))
if (TREE_CODE (f) == FIELD_DECL) if (TREE_CODE (f) == FIELD_DECL)
{ {
......
2018-05-22 Martin Liska <mliska@suse.cz>
PR ipa/85607
* g++.dg/ipa/pr85607.C: New test.
2018-05-22 Richard Biener <rguenther@suse.de> 2018-05-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/85863 PR tree-optimization/85863
......
// { dg-do compile }
/* { dg-options "-O2" } */
class A; // { dg-message "forward declaration of 'class A'" }
A *a; // { dg-warning "'a' has incomplete type" }
int
main (int argc, char **argv)
{
delete a; // { dg-warning "delete" "warn" }
// { dg-message "note" "note" { target *-*-* } .-1 }
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment