https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81007
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- (gdb) p debug_tree (field) <field_decl 0x7ffff69ea720 p type <error_mark 0x7ffff6891ed0> nonlocal VOID file t.ii line 3 col 5 align 1 offset_align 1 context <record_type 0x7ffff69e8f18 A> chain <type_decl 0x7ffff69ea688 A>> (gdb) up #5 0x0000000000edadbd in ipa_polymorphic_call_context::restrict_to_inner_class (this=0x7fffffffcca0, otr_type=<record_type 0x7ffff69e8e70 B>, consider_placement_new=false, consider_bases=false) at /space/rguenther/src/svn/early-lto-debug/gcc/ipa-polymorphic-call.c:273 273 pos = int_bit_position (fld); (gdb) l 268 for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld)) 269 { 270 if (TREE_CODE (fld) != FIELD_DECL) 271 continue; 272 273 pos = int_bit_position (fld); I don't think we should try to deal with error stuff in optimization so... Index: gcc/gimplify.c =================================================================== --- gcc/gimplify.c (revision 249003) +++ gcc/gimplify.c (working copy) @@ -3067,6 +3067,10 @@ gimplify_arg (tree *arg_p, gimple_seq *p static bool maybe_fold_stmt (gimple_stmt_iterator *gsi) { + /* Do not fold if we may have invalid IL somewhere. */ + if (seen_error ()) + return false; + struct gimplify_omp_ctx *ctx; for (ctx = gimplify_omp_ctxp; ctx; ctx = ctx->outer_context) if ((ctx->region_type & (ORT_TARGET | ORT_PARALLEL | ORT_TASK)) != 0) which delays the ICE until cgraphbuild... (pass_build_cgraph_edges). So ... Index: gcc/cgraphbuild.c =================================================================== --- gcc/cgraphbuild.c (revision 249003) +++ gcc/cgraphbuild.c (working copy) @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. #include "gimple-walk.h" #include "ipa-utils.h" #include "except.h" +#include "diagnostic-core.h" /* Context of record_reference. */ struct record_reference_ctx @@ -305,6 +306,7 @@ public: /* opt_pass methods: */ virtual unsigned int execute (function *); + virtual bool gate (function *) { return ! seen_error (); } }; // class pass_build_cgraph_edges unsigned int