[Patch, Fortran] Use -huge()-1 as most negative integer for maxval/maxloc (PR30512)

Tobias Burnus burnus@net-b.de
Sat Feb 3 09:46:00 GMT 2007


Brooks Moses wrote:
> I'll suggest (rewrap, indent as needed):
> /* We start with the most negative possible value for MAXLOC, and the
> most positive possible value for MINLOC.  The most negative possible
> value is -HUGE for BT_REAL and (-HUGE - 1) for BT_INTEGER; the most
> positive possible value is HUGE in both cases.  */
The patch now contains this comment.

> Also, I just noticed -- in your libgfortran patches, you end up using
> -HUGE-1 for both integers and reals.  I presume on reals that just
> ends up being the same as -HUGE?

While I still don't understand why
   m4/pow.m4:ifelse(rtype_letter,i,`dnl
works (unquoted "i"). I found out why

define(atype_min,ifelse(rtype_letter,`i',`(-'atype_max`-1)',`-'atype_max))dnl

only partially works. It works for   "function_r8.c" where rtype_letter
is "r", but
it fails for "function_16_r8.c" since rtype is integer(16) and while
atype is real(8).

The following fixes it:

define(atype_min,ifelse(regexp(file, `_\(.\)[0-9]*\.c$',
`\1'),`i',`(-'atype_max`-1)',`-'atype_max))dnl

Ok for the trunk and a week later for the 4.2 branch?


Bootstrapped & regression tested on x86_64-unknown-linux-gnu

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maxval2.diff
Type: text/x-patch
Size: 6749 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070203/f06bc1bd/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maxval-gen2.diff
Type: text/x-patch
Size: 12916 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070203/f06bc1bd/attachment-0001.bin>


More information about the Fortran mailing list