This is the mail archive of the 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: [PATCH] Fold VIEW_CONVERT_EXPR <type, STRING_CST> generated by Fortran FE a lot (PR target/35366)

Hi Jakub, hi all,

--- Jakub Jelinek <> wrote:

> Hi!
> On Tue, Nov 11, 2008 at 11:34:29PM +0100, Tobias Burnus wrote:
> > Brooks Moses wrote:
> > +		gfc_warning ("Assigning value other than 0 or 1 to LOGICAL"
> > +			     " at %L has undefined result", &expr->where);
> > > The warning could perhaps be edited a little, too, to reflect that the
> > > user isn't necessarily thinking of the input as an integer.  Maybe:
> > > "Cannot assign value with bitwise representation other than 0x0 or 0x1
> > > to LOGICAL at %L".
> > 
> > I find the original string clearer than especially the "0x0 or 0x1".
> So, here is an updated patch, which
> 1) handles transfer (transfer (x, .false.), something) the same way
>    as transfer (transfer (x, 0), something) (i.e. uses INTEGER_TYPE
>    of the same mode as the BOOLEAN_TYPE that was used previously)
> 2) testcases have been updated
> 3) no checking for INTEGER_CST result from fold_buil1 (V_C_E, ...),
>    it just uses integer_zerop and integer_onep.
> The middle-end side hasn't changed.

I agree with the use of INTEGER_TYPE, but I don't think it is necessary to give
a warning message. After using INTEGER_TYPE, will other parts still change the
value? What's more, if the warning is given to the transfer and Hollerith
constants, what about the assignment of integer constants? For example:

logical l
l = 45

I cannot access my machine now, so I am not sure that whether this has been
dealt with in some other place.

Best Regards,
Feng Wang


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