https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84728

            Bug ID: 84728
           Summary: internal compiler error: Segmentation fault
                    (is_gimple_variable())
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
                CC: webrown.cpp at gmail dot com
  Target Milestone: ---

Input:

void a(int b) {
  asm("" : "=m" (b) : "0" (({ ; })));
}

Output:

$ xgcc -x c++ -S -g -O1 -
<stdin>: In function 'void a(int)':
<stdin>:2:37: warning: matching constraint does not allow a register
<stdin>:2:37: warning: matching constraint does not allow a register
<stdin>:2:31: internal compiler error: Segmentation fault
0x3152ce9 crash_signal
        /home/vegard/git/gcc/gcc/toplev.c:325
0x20f0ce8 is_gimple_variable
        /home/vegard/git/gcc/gcc/gimple-expr.h:83
0x20f0ce8 is_gimple_id
        /home/vegard/git/gcc/gcc/gimple-expr.h:94
0x20f0ce8 is_gimple_addressable
        /home/vegard/git/gcc/gcc/gimple-expr.h:121
0x20f0ce8 is_gimple_lvalue(tree_node*)
        /home/vegard/git/gcc/gcc/gimple-expr.c:595
0x222358a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/vegard/git/gcc/gcc/gimplify.c:12355
0x2242d00 gimplify_asm_expr
        /home/vegard/git/gcc/gcc/gimplify.c:6289
0x2219681 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/vegard/git/gcc/gcc/gimplify.c:11766
0x2228401 gimplify_stmt(tree_node**, gimple**)
        /home/vegard/git/gcc/gcc/gimplify.c:6658
0x221a50d gimplify_cleanup_point_expr
        /home/vegard/git/gcc/gcc/gimplify.c:6400
0x221a50d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/vegard/git/gcc/gcc/gimplify.c:11811
0x2228401 gimplify_stmt(tree_node**, gimple**)
        /home/vegard/git/gcc/gcc/gimplify.c:6658
0x221bc6b gimplify_statement_list
        /home/vegard/git/gcc/gcc/gimplify.c:1767
0x221bc6b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/vegard/git/gcc/gcc/gimplify.c:11863
0x2228401 gimplify_stmt(tree_node**, gimple**)
        /home/vegard/git/gcc/gcc/gimplify.c:6658
0x22316c9 gimplify_body(tree_node*, bool)
        /home/vegard/git/gcc/gcc/gimplify.c:12635
0x2233a20 gimplify_function_tree(tree_node*)
        /home/vegard/git/gcc/gcc/gimplify.c:12800
0x199ff87 cgraph_node::analyze()
        /home/vegard/git/gcc/gcc/cgraphunit.c:670
0x19b305b analyze_functions
        /home/vegard/git/gcc/gcc/cgraphunit.c:1131
0x19b7d71 symbol_table::finalize_compilation_unit()
        /home/vegard/git/gcc/gcc/cgraphunit.c:2691

$ xgcc --version
xgcc (GCC) 8.0.1 20180306 (experimental)

Built from git 11a93d7a09b871b3b9a2eb108eb91ad83d94e070 (r258271).

7.3.0 fails more gracefully with:

<source>: In function 'void a(int)':
<source>:2:37: warning: matching constraint does not allow a register
   asm("" : "=m" (b) : "0" (({ ; })));
                                     ^
<source>:2:37: warning: matching constraint does not allow a register
<source>:2:37: error: memory input 1 is not directly addressable
Compiler returned: 1

Test case was minimised by C-Reduce.

Reply via email to