Hi, Kewen, Thanks a lot for fixing this testing case issue. Yes, the change LGTM though I can’t approve it.
Qing > On Jul 31, 2024, at 05:22, Kewen.Lin <li...@linux.ibm.com> wrote: > > Hi, > > As Andrew pointed out in PR116148, fam-in-union-alone-in-struct-2.c > was designed for little-endian, the recent commit r15-2403 made it > be tested with running on BE and PR116148 got exposed. > > This patch is to adjust the expected data for members in with_fam_2_v > and with_fam_3_v by considering endianness, also update with_fam_3_v.b[1] > from 0x5f6f7f7f to 0x5f6f7f8f to avoid two "7f"s. > > Tested on powerpc64-linux-gnu P8/P9 and powerpc64le-linux-gnu P9/P10. > > Is it ok for trunk? > > BR, > Kewen > ----- > PR testsuite/116148 > > gcc/testsuite/ChangeLog: > > * c-c++-common/fam-in-union-alone-in-struct-2.c: Define macros > WITH_FAM_2_V_B[03] and WITH_FAM_3_V_A[07] as endianness, update the > checking with these macros and initialize with_fam_3_v.b[1] with > 0x5f6f7f8f instead of 0x5f6f7f7f. > --- > .../fam-in-union-alone-in-struct-2.c | 22 ++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-2.c > b/gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-2.c > index 93f9d5128f6..7845a7fbab3 100644 > --- a/gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-2.c > +++ b/gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-2.c > @@ -16,7 +16,7 @@ union with_fam_2 { > union with_fam_3 { > char a[]; > int b[]; > -} with_fam_3_v = {.b = {0x1f2f3f4f, 0x5f6f7f7f}}; > +} with_fam_3_v = {.b = {0x1f2f3f4f, 0x5f6f7f8f}}; > > struct only_fam { > int b[]; > @@ -28,16 +28,28 @@ struct only_fam_2 { > int b[]; > } only_fam_2_v = {{7, 11}}; > > +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ > +#define WITH_FAM_2_V_B0 0x4f > +#define WITH_FAM_2_V_B3 0x1f > +#define WITH_FAM_3_V_A0 0x4f > +#define WITH_FAM_3_V_A7 0x5f > +#else > +#define WITH_FAM_2_V_B0 0x1f > +#define WITH_FAM_2_V_B3 0x4f > +#define WITH_FAM_3_V_A0 0x1f > +#define WITH_FAM_3_V_A7 0x8f > +#endif > + > int main () > { > if (with_fam_1_v.b[3] != 4 > || with_fam_1_v.b[0] != 1) > __builtin_abort (); > - if (with_fam_2_v.b[3] != 0x1f > - || with_fam_2_v.b[0] != 0x4f) > + if (with_fam_2_v.b[3] != WITH_FAM_2_V_B3 > + || with_fam_2_v.b[0] != WITH_FAM_2_V_B0) > __builtin_abort (); > - if (with_fam_3_v.a[0] != 0x4f > - || with_fam_3_v.a[7] != 0x5f) > + if (with_fam_3_v.a[0] != WITH_FAM_3_V_A0 > + || with_fam_3_v.a[7] != WITH_FAM_3_V_A7) > __builtin_abort (); > if (only_fam_v.b[0] != 7 > || only_fam_v.b[1] != 11) > -- > 2.45.2