[PATCH,testsuite] fortify vect-105.c against compiler optimizations
Nathan Froyd
froydnj@codesourcery.com
Wed Jan 14 17:06:00 GMT 2009
This patch is intended to guard the testcase against compiler
optimizations for hoisting conditionals out of loops. The test
currently passes on mainline for arm-none-{eabi,linux-gnueabi}, but
we've seen it fail on our 4.3 builds; the patch clearly moves things
closer to the original intent of the testcase.
Tested on arm-none-{eabi,linux-gnueabi}. OK to commit?
-Nathan
2009-01-14 Mark Mitchell <mark@codesourcery.com>
* gcc.dg/vect/vect-105.c: Prevent compiler from hoisting abort
out of loop.
Index: gcc.dg/vect/vect-105.c
===================================================================
--- gcc.dg/vect/vect-105.c (revision 143372)
+++ gcc.dg/vect/vect-105.c (working copy)
@@ -16,6 +16,8 @@ static int a[N][N] = {{1,2,3,11},{4,5,6,
static int b[N][N] = {{17,28,15,23},{0,2,3,24},{4,31,82,25},{29,31,432,256}};
static int c[N][N] = {{1,2,3,11},{4,9,13,34},{45,67,83,13},{34,45,67,83}};
+volatile int y;
+
__attribute__ ((noinline))
int main1 (int x) {
int i,j;
@@ -28,7 +30,9 @@ int main1 (int x) {
{
p->a[i][j] = a[i][j];
p->b[i][j] = b[i][j];
- if (x == 135)
+ /* Because Y is volatile, the compiler cannot move this check out
+ of the loop. */
+ if (y)
abort (); /* to avoid vectorization */
}
}
More information about the Gcc-patches
mailing list