Message ID | c5f7bcbb-dcd5-6307-b182-4853f88b209d@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | testsuite: Fix fam-in-union-alone-in-struct-2.c with unsigned char [PR116148] | expand |
Hi, Kewen, Thanks for the patch, LGTM. Qing > On Aug 9, 2024, at 05:50, Kewen.Lin <linkw@linux.ibm.com> wrote: > > Hi, > > As PR116148#c7 shows, fam-in-union-alone-in-struct-2.c still > fails on hppa which is a BE environment, but by checking more > (also confirmed by John in PR116148#c12), it's due to that > signedness of plain char on hppa is signed therefore the value > of with_fam_3_v.a[7] "8f" get sign extended as "ffffff8f" then > the verification will fail. This patch is to change plain char > with unsigned char to avoid that. > > Tested well powerpc64-linux-gnu (BE) and powerpc64le-linux-gnu > (LE), also confirmed to work on hppa by John. > > Is it ok for trunk? > > BR, > Kewen > ----- > PR testsuite/116148 > > gcc/testsuite/ChangeLog: > > * c-c++-common/fam-in-union-alone-in-struct-2.c: Change the type of > member a[] of union with_fam_3 with unsigned char. > --- > gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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 3743f9e7dac..920b4c4b7a7 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 > @@ -14,7 +14,7 @@ union with_fam_2 { > } with_fam_2_v = {.a = 0x1f2f3f4f}; > > union with_fam_3 { > - char a[]; > + unsigned char a[]; > int b[]; > } with_fam_3_v = {.b = {0x1f2f3f4f, 0x5f6f7f7f}}; > > -- > 2.39.1
"Kewen.Lin" <linkw@linux.ibm.com> writes: > Hi, > > As PR116148#c7 shows, fam-in-union-alone-in-struct-2.c still > fails on hppa which is a BE environment, but by checking more > (also confirmed by John in PR116148#c12), it's due to that > signedness of plain char on hppa is signed therefore the value > of with_fam_3_v.a[7] "8f" get sign extended as "ffffff8f" then > the verification will fail. This patch is to change plain char > with unsigned char to avoid that. > > Tested well powerpc64-linux-gnu (BE) and powerpc64le-linux-gnu > (LE), also confirmed to work on hppa by John. > > Is it ok for trunk? > > BR, > Kewen > ----- > PR testsuite/116148 > > gcc/testsuite/ChangeLog: > > * c-c++-common/fam-in-union-alone-in-struct-2.c: Change the type of > member a[] of union with_fam_3 with unsigned char. > --- > gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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 3743f9e7dac..920b4c4b7a7 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 > @@ -14,7 +14,7 @@ union with_fam_2 { > } with_fam_2_v = {.a = 0x1f2f3f4f}; > > union with_fam_3 { > - char a[]; > + unsigned char a[]; > int b[]; > } with_fam_3_v = {.b = {0x1f2f3f4f, 0x5f6f7f7f}}; LGTM, thank you!
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 3743f9e7dac..920b4c4b7a7 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 @@ -14,7 +14,7 @@ union with_fam_2 { } with_fam_2_v = {.a = 0x1f2f3f4f}; union with_fam_3 { - char a[]; + unsigned char a[]; int b[]; } with_fam_3_v = {.b = {0x1f2f3f4f, 0x5f6f7f7f}};