[PATCH] Fold VIEW_CONVERT_EXPR <type, STRING_CST> generated by Fortran FE a lot (PR target/35366)

Jakub Jelinek jakub@redhat.com
Tue Nov 11 21:46:00 GMT 2008


On Tue, Nov 11, 2008 at 01:27:30PM -0800, Brooks Moses wrote:
> That sounds like a reasonable result.  Note, though, that the following
> should not give a warning:
> 
> l = transfer(transfer(.true., 3.1415), .true.)

Yes, this compiles without a warning.  I'll add a testcase.

> I think we should also add a testcase to confirm that this compiles
> without warning, if we don't have one already:
> 
> i = [something defined at runtime]
> l = transfer(i, .true.)

Ok.

> > +	  else
> > +	    gfc_warning ("Assigning value other than 0 or 1 to LOGICAL"
> > +			 " at %L might have undefined result", &expr->where);
> 
> This doesn't -- if I'm understanding it correctly, it warns on any cast
> of a non-integer value to a logical, regardless of whether the result
> might or might not in fact be undefined.

No, that's not what it does.  This warning is only in case it is constant,
and stored in memory.  So in theory tmp should always be INTEGER_CST.
I guess I could just assume it (or assert it).

> Here, we should just get rid of "l" entirely, rather than making it into
> a clone of "i".  There's no point in the redundant tests.

Ok.

	Jakub



More information about the Gcc-patches mailing list