This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/52244] New: [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: "iains at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 14 Feb 2012 10:10:04 +0000
- Subject: [Bug target/52244] New: [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52244
Bug #: 52244
Summary: [4.5/4.6/4.7 Regression] wrong code for function
returning union between int and _Bool at O > 2, with
no-early-inlining
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: iains@gcc.gnu.org
CC: dominiq@lps.ens.fr
Target: powerpc-*-darwin9
This was revealed by the test-case attached to PR51528.
in the following:
extern void abort (void);
typedef union u_r
{
_Bool b;
int c;
} u_t;
u_t
bar (void)
{
u_t u;
u.c = 0x1234;
return u;
}
u_t __attribute__ ((noinline))
foo (void)
{
u_t u;
u.b = 1;
u = bar ();
return u;
}
int main (int argc, char **argv)
{
u_t u = foo ();
if (u.c != 0x1234)
abort ();
return 0;
}
====
for -O2 -fno-early-inlining (at m32)
foo is compiled as (wrong):
.globl _foo
_foo:
li r9,0
stw r9,0(r3)
blr
instead of (correct):
.globl _foo
_foo:
li r2,4660
stw r2,0(r3)
blr
======
It only appears to happen for the case where the union is with an item of the
same size as _Bool (which is 32 bits on powerpc-darwin). Replacing 'c' with a
short or a long long or even char[4] will cause the problem to vanish.
======
- Follow-Ups:
- [Bug target/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: iains at gcc dot gnu.org
- [Bug target/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: iains at gcc dot gnu.org
- [Bug middle-end/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: iains at gcc dot gnu.org
- [Bug middle-end/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: jakub at gcc dot gnu.org
- [Bug middle-end/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: jakub at gcc dot gnu.org
- [Bug middle-end/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: rguenth at gcc dot gnu.org
- [Bug middle-end/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: rguenth at gcc dot gnu.org
- [Bug middle-end/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: rguenth at gcc dot gnu.org
- [Bug middle-end/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: rguenth at gcc dot gnu.org
- [Bug middle-end/52244] [4.5/4.6/4.7 Regression] wrong code for function returning union between int and _Bool at O > 2, with no-early-inlining
- From: rguenth at gcc dot gnu.org