This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fold VIEW_CONVERT_EXPR <type, STRING_CST> generated by Fortran FE a lot (PR target/35366)
- From: Feng Wang <wf_cs at yahoo dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Tobias Burnus <burnus at net-b dot de>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Thu, 13 Nov 2008 01:41:29 +0800 (CST)
- Subject: Re: [PATCH] Fold VIEW_CONVERT_EXPR <type, STRING_CST> generated by Fortran FE a lot (PR target/35366)
Hi Jakub, hi all,
--- Jakub Jelinek <jakub@redhat.com> 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
_______________________________________
»ΆΣΚΉΣΓ³¬΄σΘέΑΏΡΕ»’ΣΚΟδ
http://cn.mail.yahoo.com