gcc.dg/fstack-protector-strong.c used to expect one stack_chk_fail per
function. When vectorizer improvements caused foo2 to get vectorized
to the point of enabling the loop and the automatic array-containing
data structure to be optimized away entirely, it no longer required
stack protection, and the expected pattern count was decreased.
However, on platforms that don't or can't vectorize the loop, it isn't
optimized away, and then we find the wrong pattern count.
Reverse the decrease and disable optimizations of the loop that could
cause it to be optimized out, so that we get the originally-expected
stack protection everywhere.
for gcc/testsuite/ChangeLog
* gcc.dg/fstack-protector-strong.c (foo2): Prevent loop
optimizations. Expect stack protection again.
{
struct AA aa;
int i;
+#pragma GCC novector
+#pragma GCC unroll 0
for (i = 0; i < 10; ++i)
{
aa.as.array[i] = i * (i-1) + i / 2;
global3 ();
}
-/* { dg-final { scan-assembler-times "stack_chk_fail" 11 } } */
+/* { dg-final { scan-assembler-times "stack_chk_fail" 12 } } */