[gfortran] Fix PR15175: Type mismatch with SCALE and SET_EXPONENT
Paul Brook
paul@codesourcery.com
Fri Dec 10 15:51:00 GMT 2004
On Friday 10 December 2004 15:27, Tobias Schlüter wrote:
> SCALE and SET_EXPONENT didn't work correctly if their second rgument of
> non-default integer kinds, since we would call the same function
> irregardless of the kind of the actual argument. The bug doesn't trigger
> on i686 due to the fact that this architecture is high endian, and the
> lower word of the argument would be read which contains the correct value.
> This patch fixes this by converting the second argument to default integer,
> which is harmless as the result is undefined if the result overflows, and
> because default integer is always wide enough to accomodate the whole
> exponent range.
>
> Built and tested, I also verified the generated assembly in several cases.
> The case of set_exponent is already tested in the testsuite, and I will add
> an appropriate test for SCALE to the testsuite.
>
> Ok?
No. You should be converting to whatever type is used by the library
implementation. This means "int" for SCALE and "GFC_INTEGER_4" for
SET_EXPONENT.
Paul
More information about the Fortran
mailing list