re PR fortran/32140 (Miscompilation with -O1)

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.

	* gfortran.fortran-torture/execute/pr32140.f90: New testcase.

Co-Authored-By: Richard Guenther <rguenther@suse.de>

From-SVN: r125886
This commit is contained in:
Andrew Pinski 2007-06-20 14:57:10 +00:00 committed by Richard Biener
parent 8dba2dedd3
commit 543535a318
4 changed files with 37 additions and 1 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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