From 5e67a36916b402a029a7b1a5a86355ddbc75ef75 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Sun, 28 Apr 2013 21:54:44 +0200 Subject: [PATCH] re PR fortran/57093 (Seg fault on internal output to a character scalar coarray) 2013-04-28 Tobias Burnus PR fortran/57093 * trans-types.c (gfc_get_element_type): Fix handling of scalar coarrays of type character. * intrinsic.texi (PACK): Add missing ")". 2013-04-28 Tobias Burnus PR fortran/57093 * gfortran.dg/coarray_30.f90: New. From-SVN: r198379 --- gcc/fortran/ChangeLog | 13 ++++++++++--- gcc/fortran/intrinsic.texi | 2 +- gcc/fortran/trans-types.c | 2 +- gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/gfortran.dg/coarray_30.f90 | 15 +++++++++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/coarray_30.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9debee4adc5..5536f5d5eca 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2013-04-28 Tobias Burnus + + PR fortran/57093 + * trans-types.c (gfc_get_element_type): Fix handling + of scalar coarrays of type character. + * intrinsic.texi (PACK): Add missing ")". + 2013-04-28 Thomas Koenig PR fortran/57071 @@ -6,9 +13,9 @@ 2013-04-25 Janne Blomqvist - PR bootstrap/57028 - * Make-lang.in (f951): Link in ZLIB. - (CFLAGS-fortran/module.o): Add zlib include directory. + PR bootstrap/57028 + * Make-lang.in (f951): Link in ZLIB. + (CFLAGS-fortran/module.o): Add zlib include directory. 2013-04-22 Janus Weil diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index ed464a6ee72..63c352c1dd4 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -9619,7 +9619,7 @@ Fortran 95 and later Transformational function @item @emph{Syntax}: -@code{RESULT = PACK(ARRAY, MASK[,VECTOR]} +@code{RESULT = PACK(ARRAY, MASK[,VECTOR])} @item @emph{Arguments}: @multitable @columnfractions .15 .70 diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 379fe9463f0..806accc7015 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1179,7 +1179,7 @@ gfc_get_element_type (tree type) element = TREE_TYPE (element); /* For arrays, which are not scalar coarrays. */ - if (TREE_CODE (element) == ARRAY_TYPE) + if (TREE_CODE (element) == ARRAY_TYPE && !TYPE_STRING_FLAG (element)) element = TREE_TYPE (element); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 41b155c8ce1..36ce9f0f06b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-28 Tobias Burnus + + PR fortran/57093 + * gfortran.dg/coarray_30.f90: New. + 2013-04-28 Thomas Koenig PR fortran/57071 @@ -43,7 +48,7 @@ 2013-04-25 Marek Polacek PR tree-optimization/57066 - * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. + * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. 2013-04-25 James Greenhalgh Tejas Belagod diff --git a/gcc/testsuite/gfortran.dg/coarray_30.f90 b/gcc/testsuite/gfortran.dg/coarray_30.f90 new file mode 100644 index 00000000000..2cfb50abfb9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_30.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single -fdump-tree-original" } +! +! PR fortran/57093 +! +! Contributed by Damian Rouson +! +program main + character(len=25), allocatable :: greeting[:] + allocate(greeting[*]) + write(greeting,"(a)") "z" +end + +! { dg-final { scan-tree-dump-times "greeting.data = \\(void . restrict\\) __builtin_malloc \\(25\\);" 1 "original" } } +! { dg-final { cleanup-tree-dump "original" } }