From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24099 invoked by alias); 17 Jun 2007 22:08:28 -0000 Received: (qmail 24047 invoked by uid 48); 17 Jun 2007 22:08:17 -0000 Date: Sun, 17 Jun 2007 22:08:00 -0000 Message-ID: <20070617220817.24046.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/32140] [4.3 Regression] Miscompilation with -O1 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-06/txt/msg01380.txt.bz2 ------- 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