[Patch, fortran] PR83901 - [8 Regression] ICE in fold_convert_loc, at fold-const.c:2402
Paul Richard Thomas
paul.richard.thomas@gmail.com
Tue Feb 27 19:36:00 GMT 2018
Hi All,
I will commit this patch as obvious tomorrow night unless there are
objections in the meantime.
Bootstraps and regtests on FC27/x86_64 - OK?
Paul
2018-02-27 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-27 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83901
* gfortran.dg/associate_37.f90: New test.
-------------- next part --------------
Index: gcc/fortran/trans-stmt.c
===================================================================
*** gcc/fortran/trans-stmt.c (revision 257969)
--- gcc/fortran/trans-stmt.c (working copy)
*************** trans_associate_var (gfc_symbol *sym, gf
*** 1907,1913 ****
attr = gfc_expr_attr (e);
if (sym->ts.type == BT_CHARACTER && e->ts.type == BT_CHARACTER
! && (attr.allocatable || attr.pointer || attr.dummy))
{
/* These are pointer types already. */
tmp = fold_convert (TREE_TYPE (sym->backend_decl), se.expr);
--- 1907,1914 ----
attr = gfc_expr_attr (e);
if (sym->ts.type == BT_CHARACTER && e->ts.type == BT_CHARACTER
! && (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: gcc/testsuite/gfortran.dg/associate_36.f90
===================================================================
*** gcc/testsuite/gfortran.dg/associate_36.f90 (revision 257969)
--- gcc/testsuite/gfortran.dg/associate_36.f90 (working copy)
***************
*** 2,8 ****
!
! Test the fix for PR83344.
!
! ! Contributed by <Janne Blomqvist <jb@gcc.gnu.org>
!
program foo
implicit none
--- 2,9 ----
!
! Test the fix for PR83344.
!
! ! Contributed by Janne Blomqvist <jb@gcc.gnu.org>
! ! and Steve Kargl <kargl@gcc.gnu.org>
!
program foo
implicit none
Index: gcc/testsuite/gfortran.dg/associate_37.f90
===================================================================
*** gcc/testsuite/gfortran.dg/associate_37.f90 (nonexistent)
--- gcc/testsuite/gfortran.dg/associate_37.f90 (working copy)
***************
*** 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
More information about the Fortran
mailing list