This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH] New option to support asymmetric integer ranges in gfortran
- From: Paul Brook <paul at codesourcery dot com>
- To: Scott Robert Ladd <coyote at coyotegulch dot com>, fortran at gcc dot gnu dot org,gcc-patches at gcc dot gnu dot org
- Date: Sat, 27 Dec 2003 21:59:24 +0000
- Subject: Re: [PATCH] New option to support asymmetric integer ranges in gfortran
- Organization: CodeSourcery
- References: <3FEC80D9.4010203@coyotegulch.com>
On Friday 26 December 2003 6:41 pm, Scott Robert Ladd wrote:
> 2003-12-25 Scott Robert Ladd <coyote@coyotegulch.com>
>
> PR c++/13070
> * gcc/fortran/gfortran.h: Added flag_asymmetric_integers
> to gfc_option_t
>
> * gcc/fortran/options.c (gfc_init_options): Initialized
> flag_asymmetric_integers to 0 (false)
>
> * gcc/fortran/options.c (gfc_handle_option): Added section
> for setting flag_asymmetric_integers
>
> * gcc/fortran/arith.c (gfc_arith_init_1): When
> -fasymmetric_integers is set, subtract 1 from minimum
> limit to reflect realities of two's complement signed
> integers.
>
> * gcc/fortran/lang.opt: Added entry for -fasymmetric_integers
<pedant>No blank lines between changeLog entries</pedant>
Either your mailer or mine seems to have mangled the whitespace in the patch
sufficiently that it won't apply. Other than that the contents of the patch
look ok.
However it does raise a couple of related latent bugs, which I think should be
fixed while we're working in this area.
* The code for MIN and MAX (& poss. others) intrinsics in trans-intrinsics.c
assumes that largest representable values are +-huge(). They should use
min_int and max_int. I think the library functions in libgfortran are ok.
* gfc_simplify_not is borken, and only works by chance most of the time.
Consider (not(huge(i) - 1) > 0)
* max_int is set to the largest unsigned integer, not the largest
representable value. Fixing this also requires fixing gfc_simplift_not, as
mentioned above.
Paul
P.S. In case you hadn't found them, -fdump-parse-tree and -fdump-tree-original
are usedful when debugging this stuff.