From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17086 invoked by alias); 3 Apr 2011 17:28:30 -0000 Received: (qmail 17078 invoked by uid 22791); 3 Apr 2011 17:28:30 -0000 X-SWARE-Spam-Status: No, hits=-2.8 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; Sun, 03 Apr 2011 17:28:26 +0000 From: "tkoenig at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: tkoenig at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: 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 Date: Sun, 03 Apr 2011 17:28:00 -0000 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-04/txt/msg00211.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412 --- Comment #2 from Thomas Koenig 2011-04-03 17:28:14 UTC --- Hi Joost, the following patch Index: frontend-passes.c =================================================================== --- frontend-passes.c (Revision 171913) +++ frontend-passes.c (Arbeitskopie) @@ -279,6 +279,20 @@ return result; } +/* Warn about function removal, uncontitionally for now. */ + +static void +warn_function_removal(gfc_expr *e) +{ + if (e->expr_type != EXPR_FUNCTION) + return; + if (e->value.function.esym) + gfc_warning ("Removing call to function %s at %L", + e->value.function.esym->name, &(e->where)); + else if (e->value.function.isym) + gfc_warning ("Removing call to function %s at %L", + e->value.function.isym->name, &(e->where)); +} /* Callback function for the code walker for doing common function elimination. This builds up the list of functions in the expression and goes through them to detect duplicates, which it then replaces @@ -311,6 +325,8 @@ { if (newvar == NULL) newvar = create_var (*(expr_array[i])); + + warn_function_removal (*(expr_array[j])); gfc_free (*(expr_array[j])); *(expr_array[j]) = gfc_copy_expr (newvar); } could maybe help you debug this by showing which functions get removed.