* [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass
2011-04-02 7:13 [Bug fortran/48412] New: [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass Joost.VandeVondele at pci dot uzh.ch
@ 2011-04-02 10:25 ` steven at gcc dot gnu.org
2011-04-03 11:11 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu.org @ 2011-04-02 10:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412
Steven Bosscher <steven at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu.org
--- Comment #1 from Steven Bosscher <steven at gcc dot gnu.org> 2011-04-02 10:25:12 UTC ---
Joost, perhaps you can narrow it down further by using a debug counter.
You'd have to add a debug counter to dbgcnt.def, say "frontend1"
Instead of "if (0 ...)", you would add'd do "if (dbg_cnt (frontend1) ...)".
Then compile with -fdbg-cnt=frontend1:N where N is a number, run, and see if
the bug occurs. The trick is to find the greatest value for N where the bug
occurs. This can be done with a binary search, as explained in dbgcnt.def.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass
2011-04-02 7:13 [Bug fortran/48412] New: [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass Joost.VandeVondele at pci dot uzh.ch
2011-04-02 10:25 ` [Bug fortran/48412] " steven at gcc dot gnu.org
@ 2011-04-03 11:11 ` rguenth at gcc dot gnu.org
2011-04-03 17:28 ` tkoenig at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-03 11:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.7.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass
2011-04-02 7:13 [Bug fortran/48412] New: [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass Joost.VandeVondele at pci dot uzh.ch
2011-04-02 10:25 ` [Bug fortran/48412] " steven at gcc dot gnu.org
2011-04-03 11:11 ` rguenth at gcc dot gnu.org
@ 2011-04-03 17:28 ` tkoenig at gcc dot gnu.org
2011-04-04 9:07 ` Joost.VandeVondele at pci dot uzh.ch
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-04-03 17:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass
2011-04-02 7:13 [Bug fortran/48412] New: [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass Joost.VandeVondele at pci dot uzh.ch
` (2 preceding siblings ...)
2011-04-03 17:28 ` tkoenig at gcc dot gnu.org
@ 2011-04-04 9:07 ` Joost.VandeVondele at pci dot uzh.ch
2011-04-04 10:52 ` Joost.VandeVondele at pci dot uzh.ch
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-04-04 9:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412
--- Comment #3 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 2011-04-04 09:06:32 UTC ---
(In reply to comment #2)
> Hi Joost,
>
> the following patch
>
hmm triggers 276 times on CP2K, quite a few seems things that also the ME would
capture. At least one is a bug in our code :-)
I'll see if can figure out the affected file.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass
2011-04-02 7:13 [Bug fortran/48412] New: [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass Joost.VandeVondele at pci dot uzh.ch
` (3 preceding siblings ...)
2011-04-04 9:07 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-04-04 10:52 ` Joost.VandeVondele at pci dot uzh.ch
2011-04-04 11:53 ` Joost.VandeVondele at pci dot uzh.ch
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-04-04 10:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412
--- Comment #4 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 2011-04-04 10:50:57 UTC ---
reduced testcase .... aborts at -O1, goes fine at -O0. Thanks for implementing
the warning, without this, it would have been very difficult to find.
INTEGER FUNCTION S1(m,ma,lx)
INTEGER :: m,ma,lx
IF (((m < 0).AND.(MODULO(ABS(ma-lx),2) == 1)).OR.&
((m > 0).AND.(MODULO(ABS(ma-lx),2) == 0))) THEN
S1=1
ELSE
S1=0
ENDIF
END FUNCTION
INTEGER :: s1
IF (S1(1,2,1).NE.0) CALL ABORT()
END
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass
2011-04-02 7:13 [Bug fortran/48412] New: [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass Joost.VandeVondele at pci dot uzh.ch
` (4 preceding siblings ...)
2011-04-04 10:52 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-04-04 11:53 ` Joost.VandeVondele at pci dot uzh.ch
2011-04-04 20:22 ` tkoenig at gcc dot gnu.org
2011-04-04 20:27 ` tkoenig at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-04-04 11:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412
--- Comment #5 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 2011-04-04 11:49:15 UTC ---
the dumped code:
__var_2 = __var_1 %[fl] 2;
__var_1 = ABS_EXPR <*ma - *lx>;
if (*m < 0 && __var_2 == 1 || *m > 0 && __var_2 == 0)
shows clearly what is wrong, var_2 is using var_1 before it is used.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass
2011-04-02 7:13 [Bug fortran/48412] New: [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass Joost.VandeVondele at pci dot uzh.ch
` (5 preceding siblings ...)
2011-04-04 11:53 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-04-04 20:22 ` tkoenig at gcc dot gnu.org
2011-04-04 20:27 ` tkoenig at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-04-04 20:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412
--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-04-04 20:22:27 UTC ---
Author: tkoenig
Date: Mon Apr 4 20:22:21 2011
New Revision: 171952
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171952
Log:
2011-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48412
* frontend-passes (cfe_expr_0): Reverse the order of going
through the loops.
2011-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/48412
* function_optimize_4.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/function_optimize_4.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/frontend-passes.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/48412] [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass
2011-04-02 7:13 [Bug fortran/48412] New: [4.7 Regression] CP2K miscompiled due to some Fortran frontend pass Joost.VandeVondele at pci dot uzh.ch
` (6 preceding siblings ...)
2011-04-04 20:22 ` tkoenig at gcc dot gnu.org
@ 2011-04-04 20:27 ` tkoenig at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2011-04-04 20:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48412
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-04-04 20:27:32 UTC ---
Fixed on trunk, closing.
Thanks for the bug report and the analysis!
^ permalink raw reply [flat|nested] 9+ messages in thread