From: Paul Thomas Date: Wed, 28 Feb 2018 17:36:20 +0000 (+0000) Subject: re PR fortran/83901 (ICE in fold_convert_loc, at fold-const.c:2402) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b14a13facf3903b7f7d67b2501dd1a3c2f200823;p=gcc.git re PR fortran/83901 (ICE in fold_convert_loc, at fold-const.c:2402) 2018-02-28 Paul Thomas 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 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 76ac274674a..ebddc041759 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-02-28 Paul Thomas + + 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 PR fortran/83633 diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index cf76fd0162b..25d5d3cc8cb 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 090d55bf9cf..33387b022a2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2018-02-28 Paul Thomas + + 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 PR target/52991 diff --git a/gcc/testsuite/gfortran.dg/associate_36.f90 b/gcc/testsuite/gfortran.dg/associate_36.f90 index ba236b431aa..1506dc917ba 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 +! Contributed by Janne Blomqvist +! and Steve Kargl ! 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 00000000000..bcabe277be1 --- /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 +! +program p + character(8), allocatable :: x[:] + allocate (x[*]) + x = 'abc' + associate (y => x) + if (y .ne. 'abc') stop 1 + end associate +end