https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106764
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- At the point where the CALL_EXPR is built: Breakpoint 5, build_function_call_vec (loc=258624, arg_loc=..., function=<var_decl 0x7ffff7251cf0 a>, params=0x0, origtypes=0x0, orig_fundecl=<tree 0x0>) at /home/apinski/src/upstream-gcc/gcc/gcc/c/c-typeck.cc:3250 3250 fntype = TREE_TYPE (function); function is: (gdb) p debug_tree(function) <var_decl 0x7ffff7251cf0 a type <pointer_type 0x7ffff73e5930 type <function_type 0x7ffff726e9d8 type <integer_type 0x7ffff72615e8 int> QI size <integer_cst 0x7ffff7242e88 constant 8> unit-size <integer_cst 0x7ffff7242ea0 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff726e9d8 pointer_to_this <pointer_type 0x7ffff73e5930>> unsigned DI size <integer_cst 0x7ffff7242d98 constant 64> unit-size <integer_cst 0x7ffff7242db0 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff73e5930> used public static unsigned read DI defer-output t.c:1:3 size <integer_cst 0x7ffff7242d98 64> unit-size <integer_cst 0x7ffff7242db0 8> align:64 warn_if_not_align:0> And the type is fine. And then the code in duplicate_decls goes and replaces the type to be error_mark_node. And then we don't check for error_mark_node later on during gimplification. Trying to figure out the best place to put the check for error_mark_node now. Note while looking into the gimplification code, I found some odd looking code dealing with the location so I filed PR 107737.