Bug ID: 81817
           Summary: ICE in lto1 with -fopenmp offloading and nested
                    #pragma omp target
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, lto, openmp
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot
          Reporter: igor.venevtsev at intel dot com
                CC: marxin at gcc dot
  Target Milestone: ---

Nested #pragma omp target regions cause gcc crash with ICE at lto phase.

Yes, this program is ill-formed according OpenMP specification, but ICE is not
a good behavior;)

Simple reproducer:

bash-4.3$ cat target-in-target.c
int main(void)
    #pragma omp target
      int x = 1;
      #pragma omp target
        int y = x;
    return 0;

To reproduce using Intel Xeon Phi emulation:

1. Build offload and host compilers as described in

2. Execute
bash-4.3$ ./gcc -fopenmp target-in-target.c
target-in-target.c: In function ‘main’:
target-in-target.c:6:15: warning: ‘target’ construct inside of ‘target’ region
       #pragma omp target
lto1: internal compiler error: in input_varpool_node, at lto-cgraph.c:1425
0x965fd0 input_varpool_node
0x965fd0 input_cgraph_1
0x965fd0 input_symtab()
0x6151b3 read_cgraph_and_symbols
0x6151b3 lto_main()
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <> for instructions.
mkoffload-intelmic: fatal error:
./x86_64-pc-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc returned 1 exit
compilation terminated.
lto-wrapper: fatal error:
returned 1 exit status
compilation terminated.
/usr/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status

3. gcc version:
bash-4.3$ ./gcc -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: ../trunk/configure --prefix=/tmp/LTO-ICE/install
--disable-bootstrap --disable-multilib --disable-libsanitizer
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
Thread model: posix
gcc version 8.0.0 20170809 (experimental) (GCC)

Reply via email to