aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-11-22 11:37:16 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-11-22 11:37:16 +0000
commita7d3cd407ccea644f1405cf331edf3bb30e57e65 (patch)
tree6399e69314ca4091b958337d37928c2ec2e6def7 /gcc
parente350134d727b80b261d410b62f791fe96a3b3e89 (diff)
downloadgcc-a7d3cd407ccea644f1405cf331edf3bb30e57e65.zip
gcc-a7d3cd407ccea644f1405cf331edf3bb30e57e65.tar.gz
gcc-a7d3cd407ccea644f1405cf331edf3bb30e57e65.tar.bz2
re PR fortran/79072 (ICE with class(*) pointer function result and character value)
2017-11-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/79072 * trans-stmt.c (trans_associate_var): Weaken the over strong condition for using the fake result decl. 2017-11-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/79072 * gfortran.dg/class_result_6.f90: New test for comment 10 of the PR. From-SVN: r255053
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-stmt.c3
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/class_result_6.f9024
4 files changed, 37 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4ba7327..7fc965b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-22 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/79072
+ * trans-stmt.c (trans_associate_var): Weaken the over strong
+ condition for using the fake result decl.
+
2017-11-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/79072
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 6cf7981..db913bf 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1828,8 +1828,7 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block)
tmp = e->symtree->n.sym->ts.u.cl->backend_decl;
}
else if (e->symtree->n.sym->attr.function
- && e->symtree->n.sym == e->symtree->n.sym->result
- && e->symtree->n.sym == e->symtree->n.sym->ns->proc_name)
+ && e->symtree->n.sym == e->symtree->n.sym->result)
{
tmp = gfc_get_fake_result_decl (e->symtree->n.sym, 0);
tmp = gfc_class_len_get (tmp);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7bfd96b8..39dd144 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-22 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/79072
+ * gfortran.dg/class_result_6.f90: New test for comment 10 of
+ the PR.
+
2017-11-22 Jakub Jelinek <jakub@redhat.com>
PR debug/83084
diff --git a/gcc/testsuite/gfortran.dg/class_result_6.f90 b/gcc/testsuite/gfortran.dg/class_result_6.f90
new file mode 100644
index 0000000..44e17a2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_result_6.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+!
+! Test the fix for PR79072 comment #12. A description of the problem
+! is to be found in class_result_5.f90.
+!
+! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
+!
+ character(3), target :: a = 'foo'
+ class(*), pointer :: b
+ b => ptr()
+ select type (b)
+ type is (character(*))
+ if (a .ne. "bar") call abort
+ end select
+contains
+ function ptr()
+ class(*), pointer :: ptr
+ ptr => a
+ select type (ptr)
+ type is (character(*))
+ ptr = "bar"
+ end select
+ end function
+end