From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27563 invoked by alias); 23 Nov 2011 16:02:19 -0000 Received: (qmail 27550 invoked by uid 22791); 23 Nov 2011 16:02:17 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Nov 2011 16:02:04 +0000 From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/50628] [4.7 Regression] gfortran.fortran-torture/execute/entry_4.f90 fails Date: Wed, 23 Nov 2011 16:41:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: Status AssignedTo Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2011-11/txt/msg02330.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50628 Martin Jambor changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |jamborm at gcc dot gnu.org |gnu.org | --- Comment #11 from Martin Jambor 2011-11-23 16:01:37 UTC --- What happens in SRA is this. This a part of the dump before SRA (ealias): : D.2127_5 = *a_1(D); if (D.2127_5 > 0) goto ; else goto ; : D.2126_6 = D.2127_5 <= 45; /* In the following statement SRA notices a logical access to __result_master.1.f2. */ __result_master.1.f2.e2 = D.2126_6; goto ; : /* In the following statement SRA notices a complex access to __result_master.1.f2. If a scalar type access has a scalar type sub-access, they cannot be made into replacements. */ __result_master.1.f2.f2 = __complex__ (4.5e+1, 0.0); : /* However, before SRA figures that out, it propagates the logical sub-accesses across the following aggregate assignment in order to facilitate pseudo copy propagation of aggregates. Thus, D.2125 gets an artificial logical sub-access which is a child of an aggregate and qualifies for replacement creation. And that's why the weird logical variable gets there. */ D.2125 = __result_master.1.f2; __result_master.1.f2 ={v} {CLOBBER}; __result = D.2125; D.2056_2 = __result.f2; } We should not do propagation of sub-accesses of scalar accesses because that's never profitable and it would also fix this testcase. However, I'm afraid that if we encapsulated __result_master.1.f2.f2 = __complex__ (4.5e+1, 0.0); into the union type and moved the last two statements of the function into a different function, we would get the logical replacements of __result_master.1.f2 and D.2125 again and might incur the same problems (depending on whether FRE would be able to look through this). SRA on unions and type-conversions is tough.