aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2018-03-03 13:34:10 +0000
committerPaul Thomas <pault@gcc.gnu.org>2018-03-03 13:34:10 +0000
commitc8bd326c4794fc26b4385a5736dd72a721fd5983 (patch)
tree162df838a7d1637e64157fbcc18a337e9fe5539a
parent129c8d7e332a4d051f0e9d6f936b131198a3f7a9 (diff)
downloadgcc-c8bd326c4794fc26b4385a5736dd72a721fd5983.zip
gcc-c8bd326c4794fc26b4385a5736dd72a721fd5983.tar.gz
gcc-c8bd326c4794fc26b4385a5736dd72a721fd5983.tar.bz2
re PR fortran/80965 (ICE with class argument and -O2 optimization)
2018-03-03 Paul Thomas <pault@gcc.gnu.org> PR fortran/80965 * resolve.c (build_loc_call): Change symtree name from 'loc' to '_loc'. 2018-03-03 Paul Thomas <pault@gcc.gnu.org> PR fortran/80965 * gfortran.dg/select_type_41.f90: New test. From-SVN: r258195
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/resolve.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/select_type_41.f9030
4 files changed, 42 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 742b83d..5c99760 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-03 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/80965
+ * resolve.c (build_loc_call): Change symtree name from 'loc' to
+ '_loc'.
+
2018-03-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/84219
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 6869bce..6e20184 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8712,7 +8712,7 @@ build_loc_call (gfc_expr *sym_expr)
gfc_expr *loc_call;
loc_call = gfc_get_expr ();
loc_call->expr_type = EXPR_FUNCTION;
- gfc_get_sym_tree ("loc", gfc_current_ns, &loc_call->symtree, false);
+ gfc_get_sym_tree ("_loc", gfc_current_ns, &loc_call->symtree, false);
loc_call->symtree->n.sym->attr.flavor = FL_PROCEDURE;
loc_call->symtree->n.sym->attr.intrinsic = 1;
loc_call->symtree->n.sym->result = loc_call->symtree->n.sym;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b249f61..a867711 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-03-03 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/80965
+ * gfortran.dg/select_type_41.f90: New test.
+
2018-03-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/61135
diff --git a/gcc/testsuite/gfortran.dg/select_type_41.f90 b/gcc/testsuite/gfortran.dg/select_type_41.f90
new file mode 100644
index 0000000..eebb879
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/select_type_41.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+! { dg-options "-O2" }
+!
+! Tests the fix for PR80965 in which the use of the name 'loc'
+! for the dummy argument of 'xyz' caused an ICE. If the module
+! was used, the error "DUMMY attribute conflicts with INTRINSIC
+! attribute in ‘loc’ at (1)" was emitted. Note that although 'loc'
+! is a GNU extension and so can be over-ridden, this is not very
+! good practice.
+!
+! Contributed by David Sagan <david.sagan@gmail.com>
+!
+module mode3_mod
+contains
+ subroutine xyz (loc)
+ implicit none
+ class(*) :: loc
+ real x(6)
+ integer ix_use
+ select type (loc)
+ type is (integer)
+ x = 0
+ print *, "integer"
+ type is (real)
+ ix_use = 0
+ print *, "real"
+ end select
+ end subroutine xyz
+end module mode3_mod
+