This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] Fix PR15175: Type mismatch with SCALE and SET_EXPONENT
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>,patch <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 10 Dec 2004 15:50:49 +0000
- Subject: Re: [gfortran] Fix PR15175: Type mismatch with SCALE and SET_EXPONENT
- Organization: CodeSourcery
- References: <41B9C060.9040509@physik.uni-muenchen.de>
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