* [committed] Unbreak big-endian bootstrap (PR middle-end/22141)
@ 2017-10-30 17:04 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2017-10-30 17:04 UTC (permalink / raw)
To: gcc-patches
Hi!
Apparently I broke bootstrap or testing on big-endian targets,
I'm sorry for screwing up testing and not testing on any big-endian.
I've committed the following patch which fixes miscompilation on the
following short testcase:
struct S { char a, b, c, d; } s;
struct T { int a : 2, b : 5, c : 17, d : 8; } t, t2;
__attribute__((noipa)) void
foo (void)
{
s.a = 1;
s.b = 2;
s.c = 3;
s.d = 4;
}
__attribute__((noipa)) void
bar (void)
{
t.a = 1;
t.b = 2;
t.c = 3;
t.d = 4;
}
__attribute__((noipa)) void
baz (void)
{
t.a = -2;
t.c = 7;
t.d = 8;
}
int
main ()
{
foo ();
if (s.a != 1 || s.b != 2 || s.c != 3 || s.d != 4)
__builtin_abort ();
bar ();
if (t.a != 1 || t.b != 2 || t.c != 3 || t.d != 4)
__builtin_abort ();
baz ();
if (t.a != -2 || t.b != 2 || t.c != 7 || t.d != 8)
__builtin_abort ();
__builtin_memset (&t, 0, sizeof (t));
baz ();
if (t.a != -2 || t.b != 0 || t.c != 7 || t.d != 8)
__builtin_abort ();
__builtin_memset (&t, -1, sizeof (t));
baz ();
if (t.a != -2 || t.b != -1 || t.c != 7 || t.d != 8)
__builtin_abort ();
return 0;
}
as obvious to unbreak bootstrap. David said his AIX bootstrap is past
the bootstrap failure point now with this change.
2017-10-30 Jakub Jelinek <jakub@redhat.com>
PR middle-end/22141
* gimple-ssa-store-merging.c (merged_store_group::apply_stores): Fix
arguments to clear_bit_region_be.
--- gcc/gimple-ssa-store-merging.c.jj 2017-10-30 12:03:56.601219516 +0100
+++ gcc/gimple-ssa-store-merging.c 2017-10-30 17:03:55.713149323 +0100
@@ -701,7 +701,9 @@ merged_store_group::apply_stores ()
return false;
unsigned char *m = mask + (pos_in_buffer / BITS_PER_UNIT);
if (BYTES_BIG_ENDIAN)
- clear_bit_region_be (m, pos_in_buffer % BITS_PER_UNIT, info->bitsize);
+ clear_bit_region_be (m, (BITS_PER_UNIT - 1
+ - (pos_in_buffer % BITS_PER_UNIT)),
+ info->bitsize);
else
clear_bit_region (m, pos_in_buffer % BITS_PER_UNIT, info->bitsize);
}
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-10-30 17:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-30 17:04 [committed] Unbreak big-endian bootstrap (PR middle-end/22141) Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).