public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] correct the reported line number in fortran combined OpenACC directives
@ 2017-02-23  1:49 Cesar Philippidis
  0 siblings, 0 replies; only message in thread
From: Cesar Philippidis @ 2017-02-23  1:49 UTC (permalink / raw)
  To: gcc-patches, Fortran List

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

Like its c++ counterpart, the fortran FE incorrectly records the line
locations of combined acc loop directives when it lowers the construct
to gimple. Usually this isn't a problem because the fortran FE is able
to report problems with acc loops itself. However, there will be
inaccuracies if the ME tries to use those locations. I had originally
posted the patch here
<https://gcc.gnu.org/ml/gcc-patches/2017-02/msg01256.html>, but Thomas
asked me to put it in a separate patch.

This patch has been applied to gomp-4_0-branch.

Cesar

[-- Attachment #2: gomp4-gfc-combined-directives-location.diff --]
[-- Type: text/x-patch, Size: 1292 bytes --]

2017-02-22  Cesar Philippidis  <cesar@codesourcery.com>

	gcc/fortran/
	* trans-openmp.c (gfc_trans_oacc_combined_directive): Set the
	location of combined acc loops.


diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 0b16af6..8688425 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -3818,6 +3818,7 @@ gfc_trans_oacc_combined_directive (gfc_code *code)
   enum tree_code construct_code;
   bool scan_nodesc_arrays = false;
   hash_set<gfc_symbol *> *array_set = NULL;
+  location_t loc = input_location;
 
   switch (code->op)
     {
@@ -3849,6 +3850,9 @@ gfc_trans_oacc_combined_directive (gfc_code *code)
     pushlevel ();
   stmt = gfc_trans_omp_do (code, EXEC_OACC_LOOP, pblock, loop_clauses, NULL);
 
+  if (CAN_HAVE_LOCATION_P (stmt))
+    SET_EXPR_LOCATION (stmt, loc);
+
   if (array_set && array_set->elements ())
     gfc_add_expr_to_block (&inner, stmt);
 
@@ -3864,8 +3868,7 @@ gfc_trans_oacc_combined_directive (gfc_code *code)
       delete array_set;
     }
 
-  stmt = build2_loc (input_location, construct_code, void_type_node, stmt,
-		     oacc_clauses);
+  stmt = build2_loc (loc, construct_code, void_type_node, stmt, oacc_clauses);
   gfc_add_expr_to_block (&block, stmt);
 
   gfc_free_omp_clauses (loop_clauses);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-23  1:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23  1:49 [gomp4] correct the reported line number in fortran combined OpenACC directives Cesar Philippidis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).