public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations
@ 2013-10-16 12:45 Joost.VandeVondele at mat dot ethz.ch
2013-11-27 8:56 ` [Bug middle-end/58746] [4.9 Regression] " Joost.VandeVondele at mat dot ethz.ch
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2013-10-16 12:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58746
Bug ID: 58746
Summary: Incorrect warning with -Waggressive-loop-optimizations
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: Joost.VandeVondele at mat dot ethz.ch
Only when compiled with LTO, the following testcase yields:
gfortran -flto=jobserver -use-linker-plugin -O2 -g -ffree-form test.f90
test.f90: In function ‘expint.constprop’:
test.f90:43:0: warning: iteration 2147483646 invokes undefined behavior
[-Waggressive-loop-optimizations]
DO ii=1,nm1
^
test.f90:43:0: note: containing loop
However, nm1 is clearly 0, by inspection of the code and as the write statement
at runtime illustrates:
nm1= 0
> cat test.f90
MODULE mathlib
IMPLICIT NONE
INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND ( 14, 200 )
INTEGER, PARAMETER :: maxfac = 30
REAL(KIND=dp), PARAMETER, DIMENSION (0:maxfac) :: fac = 1
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mathlib'
CONTAINS
FUNCTION expint(n,x)
INTEGER :: n
REAL(dp) :: x, expint
CHARACTER(len=*), PARAMETER :: routineN = 'expint', &
routineP = moduleN//':'//routineN
INTEGER, PARAMETER :: maxit = 100
REAL(dp), PARAMETER :: eps = 6.e-14_dp, &
euler = 0.5772156649015328606065120_dp, fpmin = TINY(0.0_dp)
INTEGER :: i, ii, nm1
REAL(dp) :: del, fact, h, psi
nm1=n-1
write(6,*) "nm1=",nm1
expint=-LOG(x)-euler
fact=1.0_dp
DO i=1,MAXIT
fact=-fact*x/i
IF(i.NE.nm1) THEN
del=-fact/(i-nm1)
ELSE
psi=-euler
DO ii=1,nm1
psi=psi+1.0_dp/ii
END DO
del=fact*(-LOG(x)+psi)
END IF
expint=expint+del
IF(ABS(del).LT.ABS(expint)*EPS) RETURN
END DO
END FUNCTION expint
END MODULE
USE mathlib
REAL(KIND=dp), VOLATILE :: r=0.1_dp
r = expint(1,r)
END
>From gcc-bugs-return-431932-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Oct 16 12:48:54 2013
Return-Path: <gcc-bugs-return-431932-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1671 invoked by alias); 16 Oct 2013 12:48:54 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 1287 invoked by uid 48); 16 Oct 2013 12:48:50 -0000
From: "rian.gabriel at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58747] New: new_for
Date: Wed, 16 Oct 2013 12:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: critical
X-Bugzilla-Who: rian.gabriel at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-58747-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01076.txt.bz2
Content-length: 488
http://gcc.gnu.org/bugzilla/show_bug.cgi?idX747
Bug ID: 58747
Summary: new_for
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rian.gabriel at gmail dot com
Sorry if it has already been reported.
The code compiles and runs without warning.
int i = 0;
for(int i : v)
{
...
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/58746] [4.9 Regression] Incorrect warning with -Waggressive-loop-optimizations
2013-10-16 12:45 [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations Joost.VandeVondele at mat dot ethz.ch
@ 2013-11-27 8:56 ` Joost.VandeVondele at mat dot ethz.ch
2013-11-27 9:07 ` Joost.VandeVondele at mat dot ethz.ch
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2013-11-27 8:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58746
--- Comment #1 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
Reduced :
MODULE mathlib
INTEGER, PARAMETER :: dp = 8
CONTAINS
FUNCTION expint(n,x)
REAL(dp) :: x, expint
nm1=n-1
DO i=1,MAXIT
IF(i.NE.nm1) THEN
DO ii=1,nm1
psi=psi+1.0_dp/ii
END DO
del=fact*(-LOG(x)+psi)
END IF
expint=expint+del
END DO
END FUNCTION expint
END MODULE
USE mathlib
REAL(KIND=dp), VOLATILE :: r=0.1_dp
r = expint(1,r)
END
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/58746] [4.9 Regression] Incorrect warning with -Waggressive-loop-optimizations
2013-10-16 12:45 [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations Joost.VandeVondele at mat dot ethz.ch
2013-11-27 8:56 ` [Bug middle-end/58746] [4.9 Regression] " Joost.VandeVondele at mat dot ethz.ch
@ 2013-11-27 9:07 ` Joost.VandeVondele at mat dot ethz.ch
2013-12-19 15:20 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2013-11-27 9:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58746
--- Comment #2 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
this testcase gives the same error without LTO. Just -O2 is sufficient:
INTEGER, PARAMETER :: dp = 8
REAL(KIND=dp), VOLATILE :: r=0.1_dp
r = expint(1,r)
CONTAINS
FUNCTION expint(n,x)
REAL(dp) :: x, expint
INTEGER :: maxit=100
nm1=n-1
DO i=1,MAXIT
IF(i.NE.nm1) THEN
DO ii=1,nm1
psi=psi+1.0_dp/ii
END DO
del=fact*(-LOG(x)+psi)
END IF
expint=expint+del
END DO
END FUNCTION expint
END
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/58746] [4.9 Regression] Incorrect warning with -Waggressive-loop-optimizations
2013-10-16 12:45 [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations Joost.VandeVondele at mat dot ethz.ch
2013-11-27 8:56 ` [Bug middle-end/58746] [4.9 Regression] " Joost.VandeVondele at mat dot ethz.ch
2013-11-27 9:07 ` Joost.VandeVondele at mat dot ethz.ch
@ 2013-12-19 15:20 ` rguenth at gcc dot gnu.org
2013-12-19 15:32 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-12-19 15:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58746
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.9.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/58746] [4.9 Regression] Incorrect warning with -Waggressive-loop-optimizations
2013-10-16 12:45 [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations Joost.VandeVondele at mat dot ethz.ch
` (2 preceding siblings ...)
2013-12-19 15:20 ` rguenth at gcc dot gnu.org
@ 2013-12-19 15:32 ` rguenth at gcc dot gnu.org
2013-12-20 6:49 ` dominiq at lps dot ens.fr
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-12-19 15:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58746
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/58746] [4.9 Regression] Incorrect warning with -Waggressive-loop-optimizations
2013-10-16 12:45 [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations Joost.VandeVondele at mat dot ethz.ch
` (3 preceding siblings ...)
2013-12-19 15:32 ` rguenth at gcc dot gnu.org
@ 2013-12-20 6:49 ` dominiq at lps dot ens.fr
2013-12-20 21:56 ` dominiq at lps dot ens.fr
2014-01-17 17:51 ` law at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-12-20 6:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58746
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed|2013-11-27 00:00:00 |2013-12-20
Ever confirmed|0 |1
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I can confirm the warning for comment 2 only. The other two tests compile
without warning on x86_64-apple-darwin13 (-fuse-linker-plugin is not
supported).
Likely a duplicate of pr57904.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/58746] [4.9 Regression] Incorrect warning with -Waggressive-loop-optimizations
2013-10-16 12:45 [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations Joost.VandeVondele at mat dot ethz.ch
` (4 preceding siblings ...)
2013-12-20 6:49 ` dominiq at lps dot ens.fr
@ 2013-12-20 21:56 ` dominiq at lps dot ens.fr
2014-01-17 17:51 ` law at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-12-20 21:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58746
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Fixed by the patch in pr57904 comment 9. Marked as duplicate.
*** This bug has been marked as a duplicate of bug 57904 ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/58746] [4.9 Regression] Incorrect warning with -Waggressive-loop-optimizations
2013-10-16 12:45 [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations Joost.VandeVondele at mat dot ethz.ch
` (5 preceding siblings ...)
2013-12-20 21:56 ` dominiq at lps dot ens.fr
@ 2014-01-17 17:51 ` law at redhat dot com
6 siblings, 0 replies; 8+ messages in thread
From: law at redhat dot com @ 2014-01-17 17:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58746
Bug 58746 depends on bug 57904, which changed state.
Bug 57904 Summary: [4.9 Regression] Bogus(?) "invokes undefined behavior" warning with Fortran's finalization wrapper (gfortran.dg/class_48.f90)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57904
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-01-17 17:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-16 12:45 [Bug middle-end/58746] New: Incorrect warning with -Waggressive-loop-optimizations Joost.VandeVondele at mat dot ethz.ch
2013-11-27 8:56 ` [Bug middle-end/58746] [4.9 Regression] " Joost.VandeVondele at mat dot ethz.ch
2013-11-27 9:07 ` Joost.VandeVondele at mat dot ethz.ch
2013-12-19 15:20 ` rguenth at gcc dot gnu.org
2013-12-19 15:32 ` rguenth at gcc dot gnu.org
2013-12-20 6:49 ` dominiq at lps dot ens.fr
2013-12-20 21:56 ` dominiq at lps dot ens.fr
2014-01-17 17:51 ` law at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).