Input: void a(struct b &c) { asm ("" : "+r" (c)); } Output: $ xgcc -x c++ -S - <stdin>: In function 'void a(b&)': <stdin>:2:19: internal compiler error: in create_tmp_var, at gimple-expr.c:476 0x20f1583 create_tmp_var(tree_node*, char const*) /home/vegard/git/gcc/gcc/gimple-expr.c:476 0x2218dd6 create_tmp_from_val /home/vegard/git/gcc/gcc/gimplify.c:516 0x2218dd6 lookup_tmp_var /home/vegard/git/gcc/gcc/gimplify.c:537 0x2218dd6 internal_get_tmp_var /home/vegard/git/gcc/gcc/gimplify.c:590 0x221b55c get_formal_tmp_var(tree_node*, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:618 0x221b55c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:12383 0x22469bd gimplify_asm_expr /home/vegard/git/gcc/gcc/gimplify.c:6328 0x221cc11 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11766 0x222b991 gimplify_stmt(tree_node**, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:6658 0x221da9d gimplify_cleanup_point_expr /home/vegard/git/gcc/gcc/gimplify.c:6400 0x221da9d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /home/vegard/git/gcc/gcc/gimplify.c:11811 0x222b991 gimplify_stmt(tree_node**, gimple**) /home/vegard/git/gcc/gcc/gimplify.c:6658 0x2234c59 gimplify_body(tree_node*, bool) /home/vegard/git/gcc/gcc/gimplify.c:12635 0x2236fb0 gimplify_function_tree(tree_node*) /home/vegard/git/gcc/gcc/gimplify.c:12800 0x19a3517 cgraph_node::analyze() /home/vegard/git/gcc/gcc/cgraphunit.c:670 0x19b65eb analyze_functions /home/vegard/git/gcc/gcc/cgraphunit.c:1131 0x19bb301 symbol_table::finalize_compilation_unit() /home/vegard/git/gcc/gcc/cgraphunit.c:2691 $ xgcc --version xgcc (GCC) 8.0.1 20180303 (experimental) Built from git 0d86c284d085d29782d862600a79aa1ff0ee0c47 (r258221). 4.1.2 gives the same thing. Clang gives: input.cc:2:19: error: dereference of pointer to incomplete type 'struct b' asm ("" : "+r" (c)); ^ input.cc:1:15: note: forward declaration of 'b' void a(struct b &c) { ^ 1 error generated. Test case was minimised by C-Reduce.
Assertion failure here: #1 0x0000000000cc4a0b in create_tmp_var (type=type@entry=<record_type 0x7ffff1a079d8 b>, prefix=<optimized out>) at ../../src/gcc/gimple-expr.c:476 476 gcc_assert (!TREE_ADDRESSABLE (type) && COMPLETE_TYPE_P (type));
Fixed in GCC 10.