[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-23 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #21 from vries at gcc dot gnu.org ---
Author: vries
Date: Fri Jan 23 12:54:16 2015
New Revision: 220038

URL: https://gcc.gnu.org/viewcvs?rev=220038&root=gcc&view=rev
Log:
Make fopenacc an LTO option

2015-01-23  Tom de Vries  

PR libgomp/64672
* lto-opts.c (lto_write_options): Output non-explicit conservative
-fno-openacc.
* lto-wrapper.c (merge_and_complain): Handle merging -fopenacc.
(append_compiler_options): Pass -fopenacc through.

* c.opt (fopenacc): Mark as LTO option.

* lang.opt (fopenacc): Mark as LTO option.

* testsuite/libgomp.oacc-c-c++-common/abort-5.c: New test.

Added:
trunk/libgomp/testsuite/libgomp.oacc-c-c++-common/abort-5.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/lang.opt
trunk/gcc/lto-opts.c
trunk/gcc/lto-wrapper.c
trunk/libgomp/ChangeLog


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-23 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

vries at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |vries at gcc dot gnu.org


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-23 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #20 from rguenther at suse dot de  ---
On Thu, 22 Jan 2015, vries at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672
> 
> --- Comment #17 from vries at gcc dot gnu.org ---
> (In reply to rguent...@suse.de from comment #13)
> > On Wed, 21 Jan 2015, vries at gcc dot gnu.org wrote:
> > > tentative patch, adding flag_ltrans || flag_wpa to the GOACC builtin guard
> > > conditions
> > 
> > Would be in_lto_p instead.
> > 
> 
> That actually doesn't work. in_lto_p is still false at the time when
> lto_define_builtins is called.

Huh, interesting - we should probably fix that and do in_lto_p = true
as the very first thing in lto_init.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #19 from Jakub Jelinek  ---
If the LTO marker in *.opt works, no objection from me.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-22 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #18 from vries at gcc dot gnu.org ---
(In reply to rguent...@suse.de from comment #15)
> On Wed, 21 Jan 2015, vries at gcc dot gnu.org wrote:
> 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672
> > 
> > --- Comment #14 from vries at gcc dot gnu.org ---
> > (In reply to rguent...@suse.de from comment #13)
> > > But I prever -fopenmp/-fopenacc as LTO
> > > options.
> > > 
> > 
> > What is the rationale for the preference ?
> 
> Might be required for -fparallelize-loops or vectorization to work (not 
> sure)?
> 

I'm not aware of any related problems there.

Jakub,

AFAIU, the last patch (makes fopenacc an LTO option, adds lto-wrapper handling)
handles the objections you raised in PR64707 comment 2.

Is the last patch ok, or do you still prefer the 'flag_ltrans || flag_wpa' one?


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-22 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #17 from vries at gcc dot gnu.org ---
(In reply to rguent...@suse.de from comment #13)
> On Wed, 21 Jan 2015, vries at gcc dot gnu.org wrote:
> > tentative patch, adding flag_ltrans || flag_wpa to the GOACC builtin guard
> > conditions
> 
> Would be in_lto_p instead.
> 

That actually doesn't work. in_lto_p is still false at the time when
lto_define_builtins is called.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-22 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #16 from vries at gcc dot gnu.org ---
Created attachment 34536
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34536&action=edit
tentative patch, makes fopenacc an LTO option, adds lto-wrapper handling


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-21 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #15 from rguenther at suse dot de  ---
On Wed, 21 Jan 2015, vries at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672
> 
> --- Comment #14 from vries at gcc dot gnu.org ---
> (In reply to rguent...@suse.de from comment #13)
> > But I prever -fopenmp/-fopenacc as LTO
> > options.
> > 
> 
> What is the rationale for the preference ?

Might be required for -fparallelize-loops or vectorization to work (not 
sure)?

> If we go with -fopenmp/-fopenacc as LTO options, we still have to address what
> happens when combining different settings for -fopenmp/-fopenacc in lto. 
> AFAIU,
> we have to add handling them as 'union' options in lto-wrapper.c.

Yes.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-21 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #14 from vries at gcc dot gnu.org ---
(In reply to rguent...@suse.de from comment #13)
> But I prever -fopenmp/-fopenacc as LTO
> options.
> 

What is the rationale for the preference ?

If we go with -fopenmp/-fopenacc as LTO options, we still have to address what
happens when combining different settings for -fopenmp/-fopenacc in lto. AFAIU,
we have to add handling them as 'union' options in lto-wrapper.c.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-21 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #13 from rguenther at suse dot de  ---
On Wed, 21 Jan 2015, vries at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672
> 
> --- Comment #12 from vries at gcc dot gnu.org ---
> Created attachment 34516
>   --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34516&action=edit
> tentative patch, adding flag_ltrans || flag_wpa to the GOACC builtin guard
> conditions

Would be in_lto_p instead.  But I prever -fopenmp/-fopenacc as LTO
options.

> Tentative patch, updated according to PR64707 comment 2


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-21 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #12 from vries at gcc dot gnu.org ---
Created attachment 34516
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34516&action=edit
tentative patch, adding flag_ltrans || flag_wpa to the GOACC builtin guard
conditions

Tentative patch, updated according to PR64707 comment 2


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-21 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #11 from vries at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #10)
> > Perhaps for consistency, we should mark both fopenmp and fopenacc
> > as LTO options?
> 
> Not sure to understand. Is it not what the patch at
> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00085.html does?
> 

That patch marks _only_ fopenacc as LTO option.


(In reply to vries from comment #9)
> I verified this by adding -ftree-parallelize-loops=0, and found that indeed
> support for omp builtins was dropped in lto1:
> ...
> (gdb) p builtin_info.decl[BUILT_IN_OMP_GET_THREAD_NUM]
> $3 = (tree_node *) 0x0
> ...

Using this information, I've managed to trigger a libgomp testsuite failure for
fopenmp, filed as PR 64707: 'FAIL: libgomp.c/target-9.c with
-ftree-parallelize-loops=0'.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-20 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #10 from Dominique d'Humieres  ---
> Perhaps for consistency, we should mark both fopenmp and fopenacc
> as LTO options?

Not sure to understand. Is it not what the patch at
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00085.html does?

If yes, it works for my tests.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-20 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #9 from vries at gcc dot gnu.org ---
I tried the example, and added -fopenmp. In lto1, I observed:
...
(gdb) p flag_openmp
$2 = 0
(gdb) p flag_openacc
$3 = 0
(gdb) p flag_tree_parallelize_loops
$4 = 1
(gdb) p flag_offload_abi 
$5 = OFFLOAD_ABI_UNSET
...

So, the enabler in this code in builtins.def is flag_tree_parallelize_loops,
not flag_openmp:
...
#define DEF_GOMP_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
  DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE,\
   false, true, true, ATTRS, false, \
   (flag_openmp || flag_tree_parallelize_loops \
|| flag_offload_abi != OFFLOAD_ABI_UNSET))
...

I verified this by adding -ftree-parallelize-loops=0, and found that indeed
support for omp builtins was dropped in lto1:
...
(gdb) p builtin_info.decl[BUILT_IN_OMP_GET_THREAD_NUM]
$3 = (tree_node *) 0x0
...

Perhaps for consistency, we should mark both fopenmp and fopenacc as LTO
options?


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-20 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #8 from Dominique d'Humieres  ---
> I wonder if https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00085.html
> helps here.

AFAICT it does:

=== libgomp Summary ===

# of expected passes12418
# of unsupported tests588

Thanks for the pointer.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #7 from Jakub Jelinek  ---
Well, -fopenmp isn't marked LTO, so if not anything else, for consistency
-fopenacc should be handled similarly as -fopenmp.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-20 Thread vries at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

vries at gcc dot gnu.org changed:

   What|Removed |Added

 CC||vries at gcc dot gnu.org

--- Comment #6 from vries at gcc dot gnu.org ---
(In reply to Richard Biener from comment #5)
> OpenACC bug - the LTO frontend doesn't seem to know about the OpenACC builtin
> function codes.

I wonder if https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00085.html helps
here.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #5 from Richard Biener  ---
OpenACC bug - the LTO frontend doesn't seem to know about the OpenACC builtin
function codes.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-19 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

Dominique d'Humieres  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #4 from Dominique d'Humieres  ---
The '-fopenacc -flto' options are enough to trigger the ICE.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-19 Thread howarth at bromo dot med.uc.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #3 from howarth at bromo dot med.uc.edu ---
The attached reduced test case reproduces the ICE with...

$ ~/dist/bin/gfortran -fopenacc -DACC_DEVICE_TYPE_host_nonshm=1
-DACC_MEM_SHARED=0 -g -flto asyncwait-1.f90
lto1: internal compiler error: in streamer_get_builtin_tree, at
tree-streamer-in.c:1151
0xc266af streamer_get_builtin_tree(lto_input_block*, data_in*)
../../gcc-trunk/gcc/tree-streamer-in.c:1151
0x90aeb4 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
../../gcc-trunk/gcc/lto-streamer-in.c:1320
0x90b099 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned
int*)
../../gcc-trunk/gcc/lto-streamer-in.c:1248
0x5f88be lto_read_decls
../../gcc-trunk/gcc/lto/lto.c:1900
0x5fa930 lto_file_finalize
../../gcc-trunk/gcc/lto/lto.c:2229
0x5fa930 lto_create_files_from_ids
../../gcc-trunk/gcc/lto/lto.c:2239
0x5fa930 lto_file_read
../../gcc-trunk/gcc/lto/lto.c:2280
0x5fa930 read_cgraph_and_symbols
../../gcc-trunk/gcc/lto/lto.c:2981
0x5fa930 lto_main()
../../gcc-trunk/gcc/lto/lto.c:3436
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
lto-wrapper: fatal error: /home/howarth/dist/bin/gfortran returned 1 exit
status
compilation terminated.
/home/howarth/dist_binutils/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status

on x86_64 linux and...

% gfortran-fsf-5.0  -fopenacc -DACC_DEVICE_TYPE_host_nonshm=1
-DACC_MEM_SHARED=0 -g -flto asyncwait-1.f90
gfortran-fsf-5.0: error: asyncwait-1.f90: No such file or directory
[Jack-Howarths-Computer:~/testcase] howarth% gfortran-fsf-5.0 -fopenacc
-DACC_DEVICE_TYPE_host_nonshm=1 -DACC_MEM_SHARED=0 -g -flto PR64672.f90
lto1: internal compiler error: in streamer_get_builtin_tree, at
tree-streamer-in.c:1151

lto1: internal compiler error: Abort trap: 6
gfortran-fsf-5.0: internal compiler error: Abort trap: 6 (program lto1)
lto-wrapper: fatal error: gfortran-fsf-5.0 terminated with signal 6 [Abort
trap: 6]
compilation terminated.
collect2: fatal error: lto-wrapper returned 1 exit status
compilation terminated.

on x86_64-apple-darwin14.


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-19 Thread howarth at bromo dot med.uc.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

--- Comment #2 from howarth at bromo dot med.uc.edu ---
Created attachment 34489
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34489&action=edit
minimal testcase to produce ICE on linux and darwin


[Bug libgomp/64672] ICEs in libgomp.oacc-fortran when using the '-g -flto' options in the test suite.

2015-01-19 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64672

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-01-19
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
Confirmed on linux (see pr64635 comment 15).