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: [FORTRAN] New -fboz-kind option to aid compilation of legacy code


On Mon, Nov 13, 2006 at 09:24:39PM -0800, Brooks Moses wrote:
> Steve Kargl wrote:
> >On Mon, Nov 13, 2006 at 06:36:13PM -0800, Brooks Moses wrote:
> >>Though I agree that the "largest decimal representation" wording should 
> >>be improved, I don't quite like the idea of an integer type with an 
> >>"exponent range".  Perhaps just "largest range"?
> >
> >Check the Standard.  That wording comes directly from F2003.
> 
> Fair point; it does say exactly that.  I still don't like the wording 
> despite the provenance, but I won't object if you want to leave it.

I went ahead and removed "exponent" in the description.

> >>Also, there isn't a check to confirm that a valid kind type is supplied, 
> >>and so I'll bet you ICE on an invalid kind.  Unfortunately, this can't 
> >>be checked in options.c (despite the fact that -qkind tried to do it 
> >>that way), since the kind types haven't been processed when that's run. 
> >
> >gfc_convert_integer issues an error of the form
> >
> >Error: Can't convert INTEGER(42) to INTEGER(4) at (1).
> >
> >If you prefer I can add a call to gfc_validate_kind right before
> >the BOZ conversion.
> 
> I think a slightly clearer error would be better, yeah.  I'm also still 
> in favor of having it be a fatal error that happens once at startup 
> before any code processing occurs, like the other errors that come from 
> invalid options, but I wouldn't object too strenuously to having it 
> happen at the point of conversion instead.

I've added the gfc_validate_kind into matcher of BOZ literal 
constants.  For invalid kinds, gfortran now gives

troutmask:sgk[206] gfc4x -o z -fboz-kind=42 po.f90
Fatal Error: Invalid kind given in -fboz-kind=42 option

I tried a warning and resetting kind to the max kind type parameter,
but the warning got overwhelmed by ensuing overflow error.
-- 
Steve

Attachment: boz_1.diff
Description: Text document


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