This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix source locations in Fortran FE
- From: Jakub Jelinek <jakub at redhat dot com>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 13 May 2010 14:54:47 +0200
- Subject: [PATCH] Fix source locations in Fortran FE
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
As I wrote yesterday, on pr44036-1.f90 the diagnostic location doesn't make
any sense at all. This worked in 4.4.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux.
Ok for trunk?
2010-05-13 Jakub Jelinek <jakub@redhat.com>
* trans.c (trans_code): Set backend locus early.
* trans-decl.c (gfc_get_fake_result_decl): Use source location
of the function instead of current input_location.
* gfortran.dg/gomp/pr44036-1.f90: Adjust.
--- gcc/fortran/trans.c.jj 2010-04-19 14:51:46.000000000 +0200
+++ gcc/fortran/trans.c 2010-05-12 09:32:14.000000000 +0200
@@ -1067,6 +1067,8 @@ trans_code (gfc_code * code, tree cond)
gfc_add_expr_to_block (&block, res);
}
+ gfc_set_backend_locus (&code->loc);
+
switch (code->op)
{
case EXEC_NOP:
--- gcc/fortran/trans-decl.c.jj 2010-04-30 11:14:54.000000000 +0200
+++ gcc/fortran/trans-decl.c 2010-05-12 14:38:11.000000000 +0200
@@ -2283,11 +2283,11 @@ gfc_get_fake_result_decl (gfc_symbol * s
IDENTIFIER_POINTER (DECL_NAME (this_function_decl)));
if (!sym->attr.mixed_entry_master && sym->attr.function)
- decl = build_decl (input_location,
+ decl = build_decl (DECL_SOURCE_LOCATION (this_function_decl),
VAR_DECL, get_identifier (name),
gfc_sym_type (sym));
else
- decl = build_decl (input_location,
+ decl = build_decl (DECL_SOURCE_LOCATION (this_function_decl),
VAR_DECL, get_identifier (name),
TREE_TYPE (TREE_TYPE (this_function_decl)));
DECL_ARTIFICIAL (decl) = 1;
--- gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90 2010-05-12 17:16:29.000000000 +0200
+++ gcc/testsuite/gfortran.dg/gomp/pr44036-1.f90 2010-05-12 17:11:07.000000000 +0200
@@ -12,7 +12,7 @@
x = a(4)
!$omp end parallel
!$omp parallel default(none) private (x) ! { dg-error "enclosing parallel" }
- x = b(5) ! { dg-error "not specified in" "" { target *-*-* } 11 }
+ x = b(5) ! { dg-error "not specified in" }
!$omp end parallel
!$omp parallel default(none) private (x)
x = c(6)
Jakub