This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/59990] [4.7/4.8/4.9 regression] incorrect memcpy optimization
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 30 Jan 2014 08:15:10 +0000
- Subject: [Bug middle-end/59990] [4.7/4.8/4.9 regression] incorrect memcpy optimization
- Auto-submitted: auto-generated
- References: <bug-59990-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59990
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I guess the important thing is if it is allowed to raise exceptions on a simple
load and store of a floating point value. So:
extern void abort (void);
union U
{
unsigned char value[4];
float f;
} u = { { 66, 9, 160, 255} };
int
main (void)
{
volatile union U v;
v.f = u.f;
if (v.value[2] != 160)
abort ();
return 0;
}
If it is ok that thiscase aborts and the #c0 should not, then the bug would be
in fold-const.c and we should use integral types instead of floating point
types to fold the copy. If this testcase shouldn't abort too, then it is a
target issue, where it should avoid the i387 loads if the result isn't used in
some arithmetic instruction.