This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [gfortran] Support INTEGER<->LOGICAL conversion as GNU extension


Roger Sayle wrote:
> 2005-05-27  Roger Sayle  <roger@eyesopen.com>
> 
> 	* intrinsic.c (add_conv): No longer take a "simplify" argument as
> 	its always gfc_convert_constant, instead take a "standard" argument.
> 	(add_conversions): Change all existing calls of add_conv to pass
> 	GFC_STD_F77 as appropriate.  Additionally, if we're allowing GNU
> 	extensions support integer-logical and logical-integer conversions.
> 	(gfc_convert_type_warn): Warn about use the use of these conversions
> 	as a extension when appropriate, i.e. with -pedantic.
> 	* simplify.c (gfc_convert_constant): Add support for integer to
> 	logical and logical to integer conversions, using gfc_int2log and
> 	gfc_log2int.
> 	* arith.c (gfc_log2int, gfc_int2log): New functions.
> 	* arith.h (gfc_log2int, gfc_int2log): Prototype here.
> 	* gfortran.texi: Document this new GNU extension.

The patch is sound, but there's one special case where it might break stuff.
Can you try out if it interacts badly with arithmetic IFs (*) and commit a
suitable testcase for this along with it, if it doesn't?  I'm not sure how
well-tested arithmetic-if is.

Thanks,
- Tobi

(*) arithmetic if if a three-way GOTO which looks like
  IF (scalar-int-expr) 100, 200, 300
and this is equivalent to
  I = scalar-int-expr
  IF (I < 0) THEN
     GOTO 100
  ELSE IF (I == 0) THEN
     GOTO 200
  ELSE
     GOTO 300
  END IF
(in all generality, the expression may be any non-COMPLEX scalar-numeric-expr,
but the only case your patch possibly affects is the INTEGER case)


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