This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/48973] [4.3/4.4/4.5/4.6/4.7 Regression] Inliner bug with one-bit (1-bit) bitfield
- 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, 12 May 2011 09:22:09 +0000
- Subject: [Bug tree-optimization/48973] [4.3/4.4/4.5/4.6/4.7 Regression] Inliner bug with one-bit (1-bit) bitfield
- Auto-submitted: auto-generated
- References: <bug-48973-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48973
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-12 08:29:09 UTC ---
Even smaller:
extern void abort (void);
struct S { int f : 1; } s;
int v = -1;
int
main ()
{
s.f = v < 0;
if ((unsigned int) s.f != -1U)
abort ();
return 0;
}
I'd say the bug is during expansion of a comparison with signed 1 bit type.
Then the comparison needs to result 0 / -1 instead of 0 / 1. I think it would
be difficult to adjust all the conditional expansion to handle this very rare
special case, so probably it will be better to expand such conditionals as
if it was unsigned:1 or unsigned char typed comparison, followed by cast from
that type to signed:1.