From 8e7803e8e11fecfae460e7076ac559f4ba35f2b5 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 23 Aug 2019 15:57:46 +0000 Subject: [PATCH] Warray-bounds-36.c: Make functions static to avoid failures with -fpic. gcc/testsuite/ChangeLog: * gcc.dg/Warray-bounds-36.c: Make functions static to avoid failures with -fpic. * gcc.dg/Warray-bounds-41.c: Same. From-SVN: r274859 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/Warray-bounds-36.c | 6 +++--- gcc/testsuite/gcc.dg/Warray-bounds-41.c | 3 +-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad5aa69ebda..2bd6d62eae4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-08-23 Martin Sebor + + * gcc.dg/Warray-bounds-36.c: Make functions static to avoid failures + with -fpic. + * gcc.dg/Warray-bounds-41.c: Same. + 2019-08-22 Marek Polacek PR c++/91304 - prefix attributes ignored in condition. diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-36.c b/gcc/testsuite/gcc.dg/Warray-bounds-36.c index 35b3c9299c7..c47d7815c33 100644 --- a/gcc/testsuite/gcc.dg/Warray-bounds-36.c +++ b/gcc/testsuite/gcc.dg/Warray-bounds-36.c @@ -3,15 +3,15 @@ { dg-do compile } { dg-options "-O2 -Wall" } */ -int deref (const int *p, int i) +static int deref (const int *p, int i) { - return p[i]; // { dg-warning "array subscript \\\[3, \[0-9\]+] is outside array bounds of .int\\\[2\\\]." "ilp33" { xfail ilp32 } } + return p[i]; // { dg-warning "array subscript \\\[3, \[0-9\]+] is outside array bounds of .int\\\[2\\\]." "ilp32" { xfail ilp32 } } // There should also be an inlining context here. PR 86650 tracks // its absence. } -int deref_3_plus (const int *p, int i) +static int deref_3_plus (const int *p, int i) { if (i < 3) i = 3; diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-41.c b/gcc/testsuite/gcc.dg/Warray-bounds-41.c index 2ff3692854c..3b3693f088a 100644 --- a/gcc/testsuite/gcc.dg/Warray-bounds-41.c +++ b/gcc/testsuite/gcc.dg/Warray-bounds-41.c @@ -3,7 +3,7 @@ { dg-require-effective-target alloca } { dg-options "-O2 -Wall" } */ -void* vptr (void *c) +static void* vptr (void *c) { return c; } @@ -31,4 +31,3 @@ void test_vptr_arith_vla_var (int n) char c[n]; sink (vptr (c) - 1); /* { dg-warning "\\\[-Warray-bounds" "pr82608" { xfail *-*-* } } */ } - -- 2.30.2