aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-11-10 12:24:24 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-11-10 12:24:24 +0000
commit8cd119d857b727ce0ee7b3c7aead38d8fdcc1a7e (patch)
tree14b398d7e1063d2eaaec7b3e0c7797797beeb428 /gcc/testsuite
parent9e875fd864e1ddf636c015a35985bccf732b645a (diff)
downloadgcc-8cd119d857b727ce0ee7b3c7aead38d8fdcc1a7e.zip
gcc-8cd119d857b727ce0ee7b3c7aead38d8fdcc1a7e.tar.gz
gcc-8cd119d857b727ce0ee7b3c7aead38d8fdcc1a7e.tar.bz2
re PR fortran/82934 (Segfault on assumed character length in allocate)
2017-11-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/82934 * trans-stmt.c (gfc_trans_allocate): Remove the gcc_assert on null string length for assumed length typespec and set expr3_esize to NULL_TREE; 2017-11-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/82934 * gfortran.dg/allocate_assumed_charlen_1.f90: New test. From-SVN: r254624
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_assumed_charlen_1.f9028
2 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a543e4f..620044a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-10 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82934
+ * gfortran.dg/allocate_assumed_charlen_1.f90: New test.
+
2017-11-10 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/82916
diff --git a/gcc/testsuite/gfortran.dg/allocate_assumed_charlen_1.f90 b/gcc/testsuite/gfortran.dg/allocate_assumed_charlen_1.f90
new file mode 100644
index 0000000..382df36
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_assumed_charlen_1.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+!
+! PR82934: Segfault on compilation in trans-stmt.c:5919(8.0.0).
+! The original report only had one item in the allocate list. This
+! has been doubled up to verify that the correct string length is
+! is used in the allocation.
+!
+! Contributed by FortranFan on clf.
+!
+ character(len=42), allocatable :: foo
+ character(len=22), allocatable :: foofoo
+
+ call alloc( foo , foofoo)
+
+ if (len(foo) .ne. 42) call abort
+ if (len(foofoo) .ne. 22) call abort
+
+contains
+
+ subroutine alloc( bar, barbar )
+
+ character(len=*), allocatable :: bar, barbar
+
+ allocate( character(len=*) :: bar , barbar) ! <= Here!
+
+ end subroutine
+
+end