[Patch,Fortran] PR43040 - Wrong code with LTO and GAMMA

Tobias Burnus burnus@net-b.de
Fri Feb 12 13:42:00 GMT 2010


Hi all,

when the Fortran GAMMA intrinsic was added, the tgamma built in was
supposed to be called. The way (t)gamma was added in mathbuiltins.def
was not fully correct, but it worked as the middle end had no closer
look. Well, with LTO the middle end now is stricter - and the result is
that GAMMA returns the wrong numbers.

The fix is easy: Consistently call it TGAMMA for the middle end and only
call it "gamma" for the compiler user. That's what this patch does.

Build on x86-64-linux. Regtesting is currently running, but I do not
expect any problem. I tested "gamma_5.f90" with -flto and it succeeds:
    gfortran -g -flto gfortran.dg/gamma_5.f90 && ./a.out
If it is deemed to be useful, I can also add a -flto test case.

OK for the trunk, when regtesting succeeds?

Tobias

PS: I have not looked at the (l)round(f,l) issue mentioned in the PR -
nor at other builtins.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tgamma.diff
Type: text/x-patch
Size: 2755 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100212/ff32ac78/attachment.bin>


More information about the Gcc-patches mailing list