On Thu, 20 Jan 2022, Jakub Jelinek wrote:

> On Thu, Jan 20, 2022 at 02:58:21PM +0100, Richard Biener via Gcc-patches 
> wrote:
> > The following avoids us ICEing doing constant folding from variables
> > with aliases of different types.  The formerly used fold_convert
> > wasn't entirely correct even for the cases it handled and using
> > a VIEW_CONVERT_EXPR avoids the ICE.  Reading from a larger alias
> > will cause unfolded constants to appear but appearantly we handle
> > that just "fine".
> > 
> >   b.0_1 = VIEW_CONVERT_EXPR<double>(1);
> 
> If they have the same sizes, why not, but doesn't int have
> different size from double and isn't VCE defined only for same sizes?

Well yes, it's undefined.  IL wise we only constrain us for SSA
operands, not constants.  But the whole testcase is undefined,
and previously we'd happily accept a int -1 as a -1 long by
sign-extending it.

I'm going to test an alternative patch tackling get_symbol_constant_value
which is only used from CCP (which looks suffering from the same issue)
and folding.

Richard.

Reply via email to