diff options
author | Andrew Pinski <andrew_pinski@playstation.sony.com> | 2007-06-20 14:57:10 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2007-06-20 14:57:10 +0000 |
commit | 543535a318a9219a6e5e1322ad42d56c8f77a331 (patch) | |
tree | 86489f33ca274a6acfa793a6e56fa8df7a6f6f96 /gcc/fortran/trans.c | |
parent | 8dba2dedd374f19d663a1d727bc4404b3665029f (diff) | |
download | gcc-543535a318a9219a6e5e1322ad42d56c8f77a331.zip gcc-543535a318a9219a6e5e1322ad42d56c8f77a331.tar.gz gcc-543535a318a9219a6e5e1322ad42d56c8f77a331.tar.bz2 |
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
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r-- | gcc/fortran/trans.c | 10 |
1 files changed, 9 insertions, 1 deletions
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); |