[Bug tree-optimization/43784] [4.6 Regression] -Os -fkeep-inline-functions causes FAIL: gcc.c-torture/execute/builtins/pr22237.c execution
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jul 23 11:20:00 GMT 2010
------- Comment #5 from rguenth at gcc dot gnu dot org 2010-07-23 11:20 -------
Confirmed. But I think this might trigger undefined behavior according to
the C standard as you are doing
v.e.b = v.d.b;
which has overlapping lhs/rhs. And we end up with
rp:
.LFB0:
.cfi_startproc
movq %rdi, %rax
movl $v, %esi
movl $64, %ecx
rep movsl
ret
.cfi_endproc
compared to 4.5 we end up with return slot optimization for the call to rp().
Testcase that also reproduces with -O[123]:
struct s {
unsigned char a[256];
};
union u {
struct { struct s b; int c; } d;
struct { int c; struct s b; } e;
};
static union u v;
static struct s *p = &v.d.b;
static struct s *q = &v.e.b;
static struct s __attribute__((noinline)) rp(void)
{
return *p;
}
static void qp(void)
{
*q = rp();
}
int main()
{
int i;
for (i = 0; i < 256; i++)
p->a[i] = i;
qp();
for (i = 0; i < 256; i++)
if (q->a[i] != i)
__builtin_abort();
return 0;
}
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Priority|P3 |P1
Last reconfirmed|0000-00-00 00:00:00 |2010-07-23 11:20:14
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43784
More information about the Gcc-bugs
mailing list