diff options
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.fortran-torture/execute/pr32140.f90 | 16 |
4 files changed, 37 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ceb9df5..fbda11c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2007-06-20 Andrew Pinski <andrew_pinski@playstation.sony.com> + Richard Guenther <rguenther@suse.de> + + PR fortran/32140 + * trans.c (gfc_build_addr_expr): Use the correct types. + 2007-06-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/20863 diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 97336b6..81cd12e 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -266,7 +266,15 @@ gfc_build_addr_expr (tree type, tree t) && TREE_CODE (base_type) == ARRAY_TYPE && TYPE_MAIN_VARIANT (TREE_TYPE (type)) == TYPE_MAIN_VARIANT (TREE_TYPE (base_type))) - natural_type = type; + { + tree min_val = size_zero_node; + tree type_domain = TYPE_DOMAIN (base_type); + if (type_domain && TYPE_MIN_VALUE (type_domain)) + min_val = TYPE_MIN_VALUE (type_domain); + t = build4 (ARRAY_REF, TREE_TYPE (type), t, min_val, + NULL_TREE, NULL_TREE); + natural_type = type; + } else natural_type = build_pointer_type (base_type); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ed7e9cc..716b764 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-06-20 Andrew Pinski <andrew_pinski@playstation.sony.com> + Richard Guenther <rguenther@suse.de> + + PR fortran/32140 + * gfortran.fortran-torture/execute/pr32140.f90: New testcase. + 2007-06-20 Jakub Jelinek <jakub@redhat.com> PR middle-end/31959 diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/pr32140.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/pr32140.f90 new file mode 100644 index 0000000..a756e27 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/pr32140.f90 @@ -0,0 +1,16 @@ +MODULE TEST +CONTAINS +PURE FUNCTION s2a_3(s1,s2,s3) RESULT(a) + CHARACTER(LEN=*), INTENT(IN) :: s1, s2, s3 + CHARACTER(LEN=4), DIMENSION(3) :: a + + a(1)=s1; a(2)=s2; a(3)=s3 +END FUNCTION +END MODULE + +USE TEST +character(len=12) :: line +write(line,'(3A4)') s2a_3("a","bb","ccc") +IF (line.NE."a bb ccc") CALL ABORT() +END + |