[Bug libgomp/81691] libgomp.fortran/target2.f90 fails for nvptx at -O0 and -O1

2017-08-10 Thread igor.venevtsev at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81691

Igor Venevtsev  changed:

   What|Removed |Added

 CC||igor.venevtsev at intel dot com

--- Comment #3 from Igor Venevtsev  ---
Confirm, also fail for intelmic accelerator target

[Bug lto/81816] New: ICE in lto1 with -fopenmp offloading and nested #pragma omp target

2017-08-11 Thread igor.venevtsev at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81816

Bug ID: 81816
   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 gnu.org
  Reporter: igor.venevtsev at intel dot com
CC: marxin at gcc dot gnu.org
  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
https://gcc.gnu.org/wiki/Offloading#How_to_try_offloading_enabled_GCC

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
../../trunk/gcc/lto-cgraph.c:1423
0x965fd0 input_cgraph_1
../../trunk/gcc/lto-cgraph.c:1547
0x965fd0 input_symtab()
../../trunk/gcc/lto-cgraph.c:1856
0x6151b3 read_cgraph_and_symbols
../../trunk/gcc/lto/lto.c:2857
0x6151b3 lto_main()
../../trunk/gcc/lto/lto.c:3310
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
mkoffload-intelmic: fatal error:
./x86_64-pc-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc returned 1 exit
status
compilation terminated.
lto-wrapper: fatal error:
/tmp/LTO-ICE/install/libexec/gcc/x86_64-pc-linux-gnu/8.0.0//accel/x86_64-intelmicemul-linux-gnu/mkoffload
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.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/tmp/LTO-ICE/install/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=x86_64-intelmicemul-linux-gnu
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
--target=x86_64-pc-linux-gnu
--enable-offload-targets=x86_64-intelmicemul-linux-gnu=/tmp/LTO-ICE/install
--enable-languages=c,c++,fortran,lto
Thread model: posix
gcc version 8.0.0 20170809 (experimental) (GCC)
bash-4.3$

[Bug lto/81817] New: ICE in lto1 with -fopenmp offloading and nested #pragma omp target

2017-08-11 Thread igor.venevtsev at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81817

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 gnu.org
  Reporter: igor.venevtsev at intel dot com
CC: marxin at gcc dot gnu.org
  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
https://gcc.gnu.org/wiki/Offloading#How_to_try_offloading_enabled_GCC

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
../../trunk/gcc/lto-cgraph.c:1423
0x965fd0 input_cgraph_1
../../trunk/gcc/lto-cgraph.c:1547
0x965fd0 input_symtab()
../../trunk/gcc/lto-cgraph.c:1856
0x6151b3 read_cgraph_and_symbols
../../trunk/gcc/lto/lto.c:2857
0x6151b3 lto_main()
../../trunk/gcc/lto/lto.c:3310
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
mkoffload-intelmic: fatal error:
./x86_64-pc-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc returned 1 exit
status
compilation terminated.
lto-wrapper: fatal error:
/tmp/LTO-ICE/install/libexec/gcc/x86_64-pc-linux-gnu/8.0.0//accel/x86_64-intelmicemul-linux-gnu/mkoffload
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.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/tmp/LTO-ICE/install/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=x86_64-intelmicemul-linux-gnu
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
--target=x86_64-pc-linux-gnu
--enable-offload-targets=x86_64-intelmicemul-linux-gnu=/tmp/LTO-ICE/install
--enable-languages=c,c++,fortran,lto
Thread model: posix
gcc version 8.0.0 20170809 (experimental) (GCC)
bash-4.3$

[Bug lto/81816] ICE in lto1 with -fopenmp offloading and nested #pragma omp target

2017-08-25 Thread igor.venevtsev at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81816

--- Comment #2 from Igor Venevtsev  ---
Created attachment 42048
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42048&action=edit
simple reproducer

[Bug lto/81816] ICE in lto1 with -fopenmp offloading and nested #pragma omp target

2017-08-25 Thread igor.venevtsev at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81816

--- Comment #3 from Igor Venevtsev  ---
Created attachment 42049
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42049&action=edit
Proposed so-called 'patch';)

I've got an idea to replace target construct by its body in outer context. It
fixes ICE, but breaks a lot of OpenACC tests;) And yes, without ICE nested
target region will be lowered to GOMP_target_ext() call in target context and
this behavior is undefined according to OpenMP specification. Maybe the place
of transformation is not correct or else the transformation itself is
absolutely wrong. I attached the 'patch' in hope it could be useful.