On November 23, 2016 8:36:11 PM GMT+01:00, Jakub Jelinek <ja...@redhat.com> wrote: >Hi! > >The testcase uses char and can't work properly with unsigned char >(otherwise >c >= 0 is always true). > >In addition to that I've noticed that the testcase as is actually >doesn't >fail with the unfixed gcc, it will just print 2 on stdout. > >The following has been tested on x86_64-linux and i686-linux with both >the broken compiler (FAILs) and fixed one (PASSes). > >Ok for trunk?
OK. Sorry for the breakage. I thought we'd get excess errors from the printf. Richard. >2016-11-23 Jakub Jelinek <ja...@redhat.com> > > PR tree-optimization/78482 > * gcc.dg/torture/pr78482.c (c, d): Use signed char instead of char. > (bar): New function. > (main): Call bar instead of printf. > >--- gcc/testsuite/gcc.dg/torture/pr78482.c.jj 2016-11-23 >16:47:32.000000000 +0100 >+++ gcc/testsuite/gcc.dg/torture/pr78482.c 2016-11-23 >19:59:31.000000000 +0100 >@@ -1,9 +1,9 @@ >+/* PR tree-optimization/78482 */ > /* { dg-do run } */ > >-int printf(const char*, ...); > short a = 65531; > int b = 3, f; >-char c, d; >+signed char c, d; > static void fn1(int p1) > { > short e; >@@ -22,13 +22,22 @@ static void fn1(int p1) > } > } > >+__attribute__((noinline, noclone)) >+int bar (const char *x, int y) >+{ >+ asm volatile ("" : "+g" (x), "+g" (y) : : "memory"); >+ if (y == 2) >+ __builtin_abort (); >+ return 0; >+} >+ > int main() > { > for (; c >= 0; c--) > { > if (!b) > { >- printf("%d\n", 2); >+ bar("%d\n", 2); > continue; > } > fn1(a); > > Jakub