[Bug debug/87039] [8/9 Regression] DW_OP_fbreg used without a frame base on a C++ code w/ -fopenmp

2018-11-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87039

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Mon Nov 19 13:44:13 2018
New Revision: 266272

URL: https://gcc.gnu.org/viewcvs?rev=266272=gcc=rev
Log:
PR debug/87039
* omp-expand.c: Don't include debug.h.
(adjust_context_and_scope): Add REGION argument.  Find DECL_CONTEXT
from innermost outer parallel, task, teams or target that has a
child_fn set, or, if there is no such outer region, use
current_function_decl.  Do the DECL_CONTEXT adjustment regardless of
whether a suitable BLOCK is found or not.
(expand_parallel_call, expand_teams_call): Don't call
adjust_context_and_scope here.
(grid_expand_target_grid_body): Revert 2017-01-25 changes.
(expand_omp_taskreg, expand_omp_target): Likewise.  Call
adjust_context_and_scope.
* dwarf2out.c (dwarf2out_early_global_decl): For
decl_function_context recurse instead of calling dwarf2out_decl.

* g++.dg/gomp/pr78363-4.C: New test.
* g++.dg/gomp/pr78363-5.C: New test.
* g++.dg/gomp/pr78363-6.C: New test.
* g++.dg/gomp/pr78363-7.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/gomp/pr78363-4.C
trunk/gcc/testsuite/g++.dg/gomp/pr78363-5.C
trunk/gcc/testsuite/g++.dg/gomp/pr78363-6.C
trunk/gcc/testsuite/g++.dg/gomp/pr78363-7.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/dwarf2out.c
trunk/gcc/omp-expand.c
trunk/gcc/testsuite/ChangeLog

[Bug debug/87039] [8/9 Regression] DW_OP_fbreg used without a frame base on a C++ code w/ -fopenmp

2018-11-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87039

Jakub Jelinek  changed:

   What|Removed |Added

  Attachment #45006|0   |1
is obsolete||

--- Comment #4 from Jakub Jelinek  ---
Created attachment 45020
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45020=edit
gcc9-pr87039.patch

Unfortunately the previous patch only fixed the pr78363-1.C testcase and not
-2.C or -3.C.  The problem is that r253335 only tweaked parallel regions (and
later I've copied that to host teams), not others (task, target).
There is another thing I've noticed.  Because OMP expansion works from leaf
regions to outer regions, for parallel/task/target nested in another
parallel/task/target/host teams DECL_CONTEXT would be set incorrectly, pointing
at the ultimate containing function (the user function), rather than the
immediate parent.  And, after fixing that I've noticed dwarf2out.c needs
tweaking too, because it handles just one decl_function_context, doesn't work
recursively.

[Bug debug/87039] [8/9 Regression] DW_OP_fbreg used without a frame base on a C++ code w/ -fopenmp

2018-11-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87039

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #3 from Jakub Jelinek  ---
Created attachment 45006
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45006=edit
gcc9-pr87039.patch

Untested fix.  As mentioned on IRC, starting with r253335 we set DECL_CONTEXT
that the r241023 code then uses to make sure we emit early debug info of main
before main.omp_fn.0.  But it is undesirable to emit early debug info before
actually outlining the regions.  So, by reverting the omp-expand.c part of
r244892 the pr78363-*.C testcases still work and:
$ ./cc1plus.vanilla -quiet -g -O2 -fopenmp pr87039.C ; g++ -c -fopenmp -o
pr87039{.o,.s}; readelf -wi pr87039.o | grep without; echo ==
<13a>   DW_AT_location: 2 byte block: 91 68 (DW_OP_fbreg: -24) [without
DW_AT_frame_base]
<157>   DW_AT_GNU_call_site_value: 2 byte block: 91 68 (DW_OP_fbreg: -24)
[without DW_AT_frame_base]
==
$ ./cc1plus -quiet -g -O2 -fopenmp pr87039.C ; g++ -c -fopenmp -o
pr87039{.o,.s}; readelf -wi pr87039.o | grep without; echo ==
==

No testcase in this patch, we don't have the guality infrastructure in libgomp
testing.

[Bug debug/87039] [8/9 Regression] DW_OP_fbreg used without a frame base on a C++ code w/ -fopenmp

2018-08-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87039

--- Comment #2 from Jakub Jelinek  ---
Actually, I think this got broken with PR78363 r244892.
Before that the early_global_decl hooks are only called on the functions when
all the functions are lowered and thus the BLOCKs moved.

[Bug debug/87039] [8/9 Regression] DW_OP_fbreg used without a frame base on a C++ code w/ -fopenmp

2018-08-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87039

--- Comment #1 from Jakub Jelinek  ---
I think this shows a pretty major bug caused by the early dwarf changes - it
happens too early.
When OpenMP/OpenACC etc. does move_sese_region_to_fn, it duplicates the BLOCK
which is on the boundary and should stay in both parent and child, but the
other BLOCKs are just moved.
With early dwarf, we've already created the DW_TAG_lexical_block for those
blocks and added them under their parent block.

So, either we shouldn't do that during parsing and only create the lexical
blocks with early dwarf at the end of the lowering passes, or
move_sese_region_to_fn needs to use some debug hook that would reparent the
lexical blocks being moved.

Also note that for the omp_fn outlined functions we don't really emit any DWARF
early at all, dwarf2out_function_decl is called only late from
rest_of_handle_final.

[Bug debug/87039] [8/9 Regression] DW_OP_fbreg used without a frame base on a C++ code w/ -fopenmp

2018-08-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87039

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |8.3

[Bug debug/87039] [8/9 Regression] DW_OP_fbreg used without a frame base on a C++ code w/ -fopenmp

2018-08-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87039

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-08-21
 CC||aoliva at gcc dot gnu.org,
   ||jakub at gcc dot gnu.org,
   ||mark at gcc dot gnu.org
 Ever confirmed|0   |1