This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32140] [4.3 Regression] Miscompilation with -O1
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jun 2007 22:08:17 -0000
- Subject: [Bug fortran/32140] [4.3 Regression] Miscompilation with -O1
- References: <bug-32140-6642@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #17 from pinskia at gcc dot gnu dot org 2007-06-17 22:08 -------
Here is the fix which I am testing, basically instead of creating
(typeof(array[0] "*")&array we create &array[lb]:
Index: trans.c
===================================================================
--- trans.c (revision 125777)
+++ trans.c (working copy)
@@ -266,7 +266,14 @@ 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);
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32140