From 871a2c6c8bb82158a9ab4a54a3e8114a098641ea Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 23 Nov 2016 20:50:23 +0100 Subject: [PATCH] re PR tree-optimization/78482 (wrong code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu) 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. From-SVN: r242794 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr78482.c | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6c959289cf4..317b4d101c9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2016-11-23 Jakub Jelinek + 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. + PR middle-end/69183 * gfortran.dg/gomp/pr69183.f90: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr78482.c b/gcc/testsuite/gcc.dg/torture/pr78482.c index ef68bdfbac2..cbf4d19d721 100644 --- a/gcc/testsuite/gcc.dg/torture/pr78482.c +++ b/gcc/testsuite/gcc.dg/torture/pr78482.c @@ -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); -- 2.30.2