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


> 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.
>
> 	* gfortran.dg/logint-1.f: New test case.
> 	* gfortran.dg/logint-2.f: Likewise.
> 	* gfortran.dg/logint-3.f: Likewise.

Ok.

I agree with concerns raised about enabling this extension by default.
However we don't currently have a consistent mechanism to handle this. the 
GFC_STD_* mechanism gets us most of the way there, but not quite.
I don't think it's reasonable to expect you to fix that before applying this 
patch.

If you do apply the patch please add a comment in gfc_convert_type_warn saying 
this is an arcane extension that probably shouldn't be accepted without 
warning by default.

I think the way forward is to split GFC_STD_GNU into two sub-categories. The 
first for extensions that are "nice" and enabled by default. The second for 
really crufty extensions (like -fugly-logint and real loop variables) that 
want to issue a diagnostic about by default.

Paul


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