From: Richard Biener Date: Tue, 27 Sep 2016 11:27:54 +0000 (+0000) Subject: re PR target/77478 (Incorrect code generated with -O3, m32, -msse2 and -ffast-math) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f0d355dc5c46b1ae5b28fb8d05adec793c8c4891;p=gcc.git re PR target/77478 (Incorrect code generated with -O3, m32, -msse2 and -ffast-math) 2016-09-27 Richard Biener PR tree-optimization/77478 * gcc.dg/torture/pr77478.c: New testcase. From-SVN: r240530 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cefbca950f9..20680cbbaa7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-27 Richard Biener + + PR tree-optimization/77478 + * gcc.dg/torture/pr77478.c: New testcase. + 2016-09-27 Martin Liska PR gcov-profile/7970 diff --git a/gcc/testsuite/gcc.dg/torture/pr77478.c b/gcc/testsuite/gcc.dg/torture/pr77478.c new file mode 100644 index 00000000000..b5965bf574f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77478.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ffast-math" } */ + +static const float A[10] = {1}; + +float +foo(float *f, int n) +{ + int i, j; + float a = 0, b = 0; + for (i = n/2; i < n; i++) + a += f[i]*.1f; + for (i = n/2, j = 0; i < n; i++, j++) + b += f[i]*A[j]+a*A[j]; + return b; +} + +int main() +{ + float a[21] = {0}; + return foo(a+1, 20) + foo(a, 20); +}