https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109008
Bug ID: 109008
Summary: [13 Regression ]Maybe wrong code in scipy package
since r13-3926-gd4c2f1d376da6f
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: aldyh at gcc dot gnu.org, jakub at gcc dot gnu.org
Target Milestone: ---
Created attachment 54578
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54578&action=edit
test-case
Since the revision, the scipy package fails in tests due to:
https://github.com/scipy/scipy/blob/main/scipy/integrate/odepack/vode.f#L3500-L3515
$ cat /tmp/x.f
DOUBLE PRECISION FUNCTION D1MACH (IDUM)
INTEGER IDUM
C-----------------------------------------------------------------------
C This routine computes the unit roundoff of the machine.
C This is defined as the smallest positive machine number
C u such that 1.0 + u .ne. 1.0
C
C Subroutines/functions called by D1MACH.. None
C-----------------------------------------------------------------------
DOUBLE PRECISION U, COMP
U = 1.0D0
10 U = U*0.5D0
COMP = 1.0D0 + U
IF (COMP .NE. 1.0D0) GO TO 10
D1MACH = U*2.0D0
RETURN
END FUNCTION D1MACH
$ gcc /tmp/x.f -c -O2 -fdump-tree-optimized=/dev/stdout
;; Function d1mach (d1mach_, funcdef_no=0, decl_uid=4259, cgraph_uid=1,
symbol_order=0)
__attribute__((fn spec (". w ")))
real(kind=8) d1mach (integer(kind=4) & restrict idum)
{
<bb 2> [local count: 20293720]:
return 0.0;
}
Before the revision we did:
;; Function d1mach (d1mach_, funcdef_no=0, decl_uid=4259, cgraph_uid=1,
symbol_order=0)
Removing basic block 5
__attribute__((fn spec (". w ")))
real(kind=8) d1mach (integer(kind=4) & restrict idum)
{
real(kind=8) u;
real(kind=8) _1;
character(kind=4) ivtmp_7;
character(kind=4) ivtmp_8;
<bb 2> [local count: 20293720]:
<bb 3> [local count: 1073741824]:
# u_2 = PHI <1.0e+0(2), u_4(3)>
# ivtmp_7 = PHI <53(2), ivtmp_8(3)>
u_4 = u_2 * 5.0e-1;
ivtmp_8 = ivtmp_7 + 4294967295;
if (ivtmp_8 != 0)
goto <bb 3>; [98.11%]
else
goto <bb 4>; [1.89%]
<bb 4> [local count: 20293720]:
_1 = u_4 * 2.0e+0;
return _1;
}