aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-05-26 11:25:36 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-05-26 11:25:36 +0000
commit0ee8e25059355c772a3e7c7eb88d502496bc7922 (patch)
tree6b71a217017b2b1fcc8dac597c2745ed8da1cbb6 /gcc/testsuite
parent150594ba69066ade4b78e51d0a20ef9a16029bc2 (diff)
downloadgcc-0ee8e25059355c772a3e7c7eb88d502496bc7922.zip
gcc-0ee8e25059355c772a3e7c7eb88d502496bc7922.tar.gz
gcc-0ee8e25059355c772a3e7c7eb88d502496bc7922.tar.bz2
re PR fortran/31219 (ICE on array of character function results)
2007-05-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/31219 * trans.h : Add no_function_call bitfield to gfc_se structure. Add stmtblock_t argument to prototype of get_array_ctor_strlen. * trans-array.c (get_array_ctor_all_strlen): New function. (get_array_ctor_strlen): Add new stmtblock_t argument and call new function for character elements that are not constants, arrays or variables. (gfc_conv_array_parameter): Call get_array_ctor_strlen to get good string length. * trans-intrinsic (gfc_conv_intrinsic_len): Add new argument to call of get_array_ctor_strlen. 2007-05-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/31219 * gfortran.dg/array_constructor_17.f90: New test. From-SVN: r125088
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/array_constructor_17.f9040
2 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 66ba361..0c99b3c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-26 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/31219
+ * gfortran.dg/array_constructor_17.f90: New test.
+
2007-05-25 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/32090
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_17.f90 b/gcc/testsuite/gfortran.dg/array_constructor_17.f90
new file mode 100644
index 0000000..3ce7a91
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_constructor_17.f90
@@ -0,0 +1,40 @@
+! { dg-do run }
+! Tests the fix for PR31219, in which the character length of
+! the functions in the array constructor was not being obtained
+! correctly and this caused an ICE.
+!
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+!
+ INTEGER :: J
+ CHARACTER(LEN = 8) :: str
+ J = 3
+ write (str,'(2A4)') (/( F(I, J), I = 1, 2)/)
+ IF (str .NE. " ODD EVE") call abort ()
+
+! Comment #1 from F-X Coudert (noted by T. Burnus) that
+! actually exercises a different part of the bug.
+ call gee( (/g (3)/) )
+
+CONTAINS
+ FUNCTION F (K,J) RESULT(I)
+ INTEGER :: K, J
+ CHARACTER(LEN = J) :: I
+ IF (MODULO (K, 2) .EQ. 0) THEN
+ I = "EVEN"
+ ELSE
+ I = "ODD"
+ ENDIF
+ END FUNCTION
+
+ function g(k) result(i)
+ integer :: k
+ character(len = k) :: i
+ i = '1234'
+ end function
+ subroutine gee(a)
+ character(*),dimension(1) :: a
+ if(len (a) /= 3) call abort ()
+ if(a(1) /= '123') call abort ()
+ end subroutine gee
+
+END