This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/81601] [7/8 Regression] incorrect Warray-bounds warning with -fsanitize
- 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, 18 Jan 2018 09:03:55 +0000
- Subject: [Bug sanitizer/81601] [7/8 Regression] incorrect Warray-bounds warning with -fsanitize
- Auto-submitted: auto-generated
- References: <bug-81601-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81601
--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase where in f1/f3/f5 this optimization is done early (already in
*.original dump), but in f2/f4/f6 is not.
struct S { unsigned a:5; unsigned b:3; unsigned c:2; };
void bar (void);
void
f1 (struct S s)
{
if (s.a == 7 && s.b == 6 && s.c == 1)
bar ();
}
void
f2 (struct S s)
{
unsigned a = s.a;
unsigned b = s.b;
unsigned c = s.c;
if (a == 7 && b == 6 && c == 1)
bar ();
}
void
f3 (struct S s, struct S t)
{
if (s.a == t.a && s.b == t.b && s.c == t.c)
bar ();
}
void
f4 (struct S s, struct S t)
{
unsigned a = s.a;
unsigned b = s.b;
unsigned c = s.c;
unsigned d = t.a;
unsigned e = t.b;
unsigned f = t.c;
if (a == d && b == e && c == f)
bar ();
}