[Bug target/94103] Wrong optimization: reading value of a variable changes its representation for optimizer

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Fri Mar 20 17:53:10 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94103

--- Comment #16 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 20 Mar 2020, ch3root at openwall dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94103
> 
> --- Comment #15 from Alexander Cherepanov <ch3root at openwall dot com> ---
> (In reply to rguenther@suse.de from comment #14)
> > From a language Pov that's the same.
> > But memcpy and friends work on any dynamic type so have to copy all bytes.
> Sorry, I don't understand. Bug 61872, comment 1, and bug 92486, comment 9, look
> the same -- a memset followed by an assignment.  But the former is with long
> double while the latter is with a struct.
> 
> You mean that assignments of structs are equivalent to memcpy while assignments
> of long doubles aren't? Why the difference?

No, assignment of structs from a language POV are not equivalent to 
memcpy.  For those the issue is that GCC thinks they are (and forever
did that).  Which means for the GCC middle-end (GIMPLE) assignment
of structs are equivalent to memcpy.  So are long double assigns
btw - but the bugs that I think are important to fix are those
where even the source language semantics dictate they are well-defined.

I do think the long double issue eventually needs to be sorted out
in the middle-end.  So do I think SRA needs to be fixed to preserve
memcpy behavior of aggregate copies.


More information about the Gcc-bugs mailing list