Kwok Cheung Yeung <k...@codesourcery.com> writes: > Hello > > On 06/08/2020 1:23 pm, Tom de Vries wrote: > > +static char AC[4]; > > +static char init_qi[4] = { -30,-30,-50,-50 }; > > +static char test_qi[4] = { -115,-115,25,25 }; > > + > > +static void > > +do_qi (void) > > +{ > > + if (__sync_val_compare_and_swap(AC+0, -30, -115) != -30) > > + abort (); > > If 'char' is unsigned by default, then init_qi will contain { 226, 226, 206, > 206} and test_qi { 141, 141, 25, 25 }, which will result in the comparison > against -30 failing when the previous value of AC[0] is implicitly promoted > to > signed int. This can be fixed by making the array element types explicitly > signed. > > This issue is tracked as issue 96519 on the tracker. I have checked that the > test now passes on PowerPC and Aarch64. Is the fix okay for trunk? > > Thanks > > Kwok > > commit fc6ac3af45a238da0bd65e020ae6f0f165b57b87 > Author: Kwok Cheung Yeung <k...@codesourcery.com> > Date: Tue Aug 11 09:41:10 2020 -0700 > > Fix gcc.dg/ia64-sync-5.c for architectures with unsigned char as default > (PR 96519) > > If char is unsigned, then comparisons of the char array elements against > negative integers in the test will fail as values in the array will always > be positive, and will remain so when promoted to signed int. > > 2020-08-11 Kwok Cheung Yeung <k...@codesourcery.com> > > PR testsuite/96519 > > gcc/testsuite/ > * gcc.dg/ia64-sync-5.c (AC, init_qi, test_qi): Change element type to > signed char.
OK, thanks. Richard