re PR fortran/83901 (ICE in fold_convert_loc, at fold-const.c:2402)
authorPaul Thomas <pault@gcc.gnu.org>
Wed, 28 Feb 2018 17:36:20 +0000 (17:36 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Wed, 28 Feb 2018 17:36:20 +0000 (17:36 +0000)
2018-02-28  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/83901
* trans-stmt.c (trans_associate_var): Make sure that the se
expression is a pointer type before converting it to the symbol
backend_decl type.

2018-02-28  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/83901
* gfortran.dg/associate_37.f90: New test.

PR fortran/83344
* gfortran.dg/associate_36.f90: Add Steve Kargl as contributer.

From-SVN: r258076

gcc/fortran/ChangeLog
gcc/fortran/trans-stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/associate_36.f90
gcc/testsuite/gfortran.dg/associate_37.f90 [new file with mode: 0644]

index 76ac274674ad5f7511177522923fcf4817cb074b..ebddc041759e6e5b2a95b8a29afa7046bfdbde7b 100644 (file)
@@ -1,3 +1,10 @@
+2018-02-28  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/83901
+       * trans-stmt.c (trans_associate_var): Make sure that the se
+       expression is a pointer type before converting it to the symbol
+       backend_decl type.
+
 2018-02-25  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/83633
index cf76fd0162bd06de4b03735f7d6d5af9e5862c43..25d5d3cc8cb5564b472d240c07f348c4aef045b3 100644 (file)
@@ -1907,7 +1907,8 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block)
 
       attr = gfc_expr_attr (e);
       if (sym->ts.type == BT_CHARACTER && e->ts.type == BT_CHARACTER
-         && (attr.allocatable || attr.pointer || attr.dummy))
+         && (attr.allocatable || attr.pointer || attr.dummy)
+         && POINTER_TYPE_P (TREE_TYPE (se.expr)))
        {
          /* These are pointer types already.  */
          tmp = fold_convert (TREE_TYPE (sym->backend_decl), se.expr);
index 090d55bf9cfb7df9eb5db032e9d0ec488ba37b08..33387b022a298eb8bdfd881f35a8fa47b5d8a113 100644 (file)
@@ -1,3 +1,11 @@
+2018-02-28  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/83901
+       * gfortran.dg/associate_37.f90: New test.
+
+       PR fortran/83344
+       * gfortran.dg/associate_36.f90: Add Steve Kargl as contributer.
+
 2018-02-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/52991
index ba236b431aabc368873e1dc23826860af5928964..1506dc917bad4e5ab27b18510bc042f7fce39120 100644 (file)
@@ -2,7 +2,8 @@
 !
 ! Test the fix for PR83344.
 !
-! Contributed by <Janne Blomqvist  <jb@gcc.gnu.org>
+! Contributed by Janne Blomqvist  <jb@gcc.gnu.org>
+! and Steve Kargl  <kargl@gcc.gnu.org>
 !
 program foo
    implicit none
diff --git a/gcc/testsuite/gfortran.dg/associate_37.f90 b/gcc/testsuite/gfortran.dg/associate_37.f90
new file mode 100644 (file)
index 0000000..bcabe27
--- /dev/null
@@ -0,0 +1,15 @@
+! { dg-do run }
+! { dg-options "-fcoarray=single" }
+!
+! Tests the fix for the regression PR83901.
+!
+! Contributed by G Steinmetz  <gscfq@t-online.de>
+!
+program p
+   character(8), allocatable :: x[:]
+   allocate (x[*])
+   x = 'abc'
+   associate (y => x)
+     if (y .ne. 'abc') stop 1
+   end associate
+end