------- Comment #10 from laurent at guerby dot net 2005-10-02 16:20 -------
It looks like it is indeed a codegen bug in s-arit64.adb, in Scaled_Divide the
following line is miscompiled at -O1 and above (works at -O0):
T2 := Lo (T1 rem Zlo) & D (4);
In my p.adb testcase, the compiler with Jan patch calls Lo with argument = 0
whereas (T1 rem Zlo) returned (1073741824 rem 3221225472) = 1073741824 so
stack/argument handling must be confused at some point.
The bug is volatile, ie replacing the line above by:
S3 := Lo (T1 rem Zlo);
if S3 = 0 then
T2 := Uns64 (D (4));
else
T2 := S3 & D (4);
end if;
Makes it go away.
Laurent
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24003