This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] New option to support asymmetric integer ranges in gfortran


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]