diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2018-02-28 17:36:20 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2018-02-28 17:36:20 +0000 |
commit | b14a13facf3903b7f7d67b2501dd1a3c2f200823 (patch) | |
tree | dcd09ad336ba1d82feadc364daa2642e3d5bf37c | |
parent | ba64c7b8934fbd59a1d5bd370a4aaab4bf2d0ed2 (diff) | |
download | gcc-b14a13facf3903b7f7d67b2501dd1a3c2f200823.zip gcc-b14a13facf3903b7f7d67b2501dd1a3c2f200823.tar.gz gcc-b14a13facf3903b7f7d67b2501dd1a3c2f200823.tar.bz2 |
re PR fortran/83901 (ICE in fold_convert_loc, at fold-const.c:2402)
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
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/trans-stmt.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/associate_36.f90 | 3 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/associate_37.f90 | 15 |
5 files changed, 34 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 76ac274..ebddc04 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index cf76fd0..25d5d3c 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 090d55b..33387b0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/gfortran.dg/associate_36.f90 b/gcc/testsuite/gfortran.dg/associate_36.f90 index ba236b4..1506dc9 100644 --- a/gcc/testsuite/gfortran.dg/associate_36.f90 +++ b/gcc/testsuite/gfortran.dg/associate_36.f90 @@ -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 index 0000000..bcabe27 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/associate_37.f90 @@ -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 |