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

            Bug ID: 70506
           Summary: [CilkPlus] error: location references block not in
                    block tree
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: ice-checking
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iverbin at gcc dot gnu.org
  Target Milestone: ---

$ cat test.c
void foo  ()
{
  int i, x = 0;

  _Cilk_for (i = 0; i < 100; i++)
    x++;

  _Cilk_for (i = 0; i < 100; i++)
    x++;
}

$ gcc -c -fcilkplus test.c
test.c: In function ‘foo._cilk_for_fn.0’:
test.c:10:1: error: location references block not in block tree
 }
 ^
D.1952 = .omp_data_i->x;
test.c:10:1: error: location references block not in block tree
D.1953 = D.1952 + 1;
test.c:10:1: error: location references block not in block tree
.omp_data_i->x = D.1953;
test.c:10:1: internal compiler error: verify_gimple failed
0xe31754 verify_gimple_in_cfg(function*, bool)
        gcc/tree-cfg.c:5125
0xcd17a8 execute_function_todo
        gcc/passes.c:1958
0xcd0941 do_per_function
        gcc/passes.c:1652
0xcd1984 execute_todo
        gcc/passes.c:2010
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


Here is DECL_INITIAL (fn->decl) block for foo._cilk_for_fn.0:

 <block 0x... used
    vars <var_decl 0x... x
        type <integer_type 0x... int sizes-gimplified public SI
            size <integer_cst 0x... constant 32>
            unit size <integer_cst 0x... constant 4>
            align 32 symtab 0 alias set -1 canonical type 0x... precision 32
min <integer_cst 0x... -2147483648> max <integer_cst 0x... 2147483647>
            pointer_to_this <pointer_type 0x...>>
        used SI file test.c line 3 col 10 size <integer_cst 0x... 32> unit size
<integer_cst 0x... 4>
        align 32 context <function_decl 0x... foo._cilk_for_fn.0>
        value-expr <component_ref 0x... type <integer_type 0x... int>

            arg 0 <mem_ref 0x... type <record_type 0x... .omp_data_s.0>
                nothrow arg 0 <parm_decl 0x... .omp_data_i>
                arg 1 <integer_cst 0x... constant 0>> arg 1 <field_decl 0x...
x>>>>


However, similar OpenMP testcase works fine, because corresponding DECL_INITIAL
(fn->decl) contains a subblock:

 <block 0x... used
    vars <var_decl 0x... x
        type <integer_type 0x... int sizes-gimplified public SI
            size <integer_cst 0x... constant 32>
            unit size <integer_cst 0x... constant 4>
            align 32 symtab 0 alias set -1 canonical type 0x... precision 32
min <integer_cst 0x... -2147483648> max <integer_cst 0x... 2147483647>
            pointer_to_this <pointer_type 0x...>>
        used SI file test.c line 3 col 10 size <integer_cst 0x... 32> unit size
<integer_cst 0x... 4>
        align 32 context <function_decl 0x... foo._omp_fn.0>
        value-expr <component_ref 0x... type <integer_type 0x... int>

            arg 0 <mem_ref 0x... type <record_type 0x... .omp_data_s.0>
                nothrow arg 0 <parm_decl 0x... .omp_data_i>
                arg 1 <integer_cst 0x... constant 0>> arg 1 <field_decl 0x...
x>>>
    subblocks <block 0x... used
        vars <var_decl 0x... i type <integer_type 0x... int>
            used SI file test.c line 3 col 7 size <integer_cst 0x... 32> unit
size <integer_cst 0x... 4>
            align 32 context <function_decl 0x... foo._omp_fn.0>> supercontext
<block 0x...>>>

Reply via email to