From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2425 invoked by alias); 12 May 2010 20:16:21 -0000 Received: (qmail 2357 invoked by uid 48); 12 May 2010 20:16:04 -0000 Date: Wed, 12 May 2010 20:16:00 -0000 Message-ID: <20100512201604.2356.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/44069] [4.5 Regression] optimization bug initializing from cast array In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth 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: 2010-05/txt/msg01311.txt.bz2 ------- Comment #5 from rguenth at gcc dot gnu dot org 2010-05-12 20:16 ------- So, the issue is that the loop copying vals to m looks like : D.21310_23 = r_22 * 4; D.21309_25 = D.21310_23 + c_24; D.21308_26 = (long unsigned int) D.21309_25; D.21305_29 = vals[0][D.21308_26]; m.m[D.21309_25] = D.21305_29; c_30 = c_24 + 1; : # c_24 = PHI if (c_24 <= 3) goto ; else goto ; : r_31 = r_22 + 1; : # r_22 = PHI <0(2), r_31(5)> if (r_22 <= 3) goto ; else goto ; : # c_32 = PHI <0(6)> goto ; where vals[0][D.21308_26] does not represent a use of vals[i][j] with i > 0. This is because get_ref_base_and_extent restricts the valid extent of D.21308_26 to 3. Note that the issue is exposed by re-constructing an array-reference from the pointer access in the inlined constructor. After inlining into main() we have : D.21310_23 = r_22 * 4; D.21309_25 = D.21310_23 + c_24; D.21308_26 = (long unsigned int) D.21309_25; D.21307_27 = D.21308_26 * 8; D.21306_28 = &vals[0][D.21308_26]; D.21305_29 = *D.21306_28; m.m[D.21309_25] = D.21305_29; c_30 = c_24 + 1; from the non-inlined variant : D.21286_7 = r_1 * 4; D.21287_8 = D.21286_7 + c_2; D.21286_9 = r_1 * 4; D.21287_10 = D.21286_9 + c_2; D.21288_11 = (long unsigned int) D.21287_10; D.21289_12 = D.21288_11 * 8; D.21290_14 = arr_13(D) + D.21289_12; D.21291_15 = *D.21290_14; this_16(D)->m[D.21287_10] = D.21291_15; c_17 = c_2 + 1; -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c++ |middle-end Keywords| |wrong-code Summary|optimization bug |[4.5 Regression] |initializing from cast array|optimization bug | |initializing from cast array Target Milestone|--- |4.5.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44069