From: H.J. Lu Date: Wed, 11 Nov 2020 23:54:00 +0000 (-0800) Subject: pointer-compare-1.c: Add __attribute__((used)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9dbf8dc7a96a8020e0ee05926ef7a3f976e9c318;p=gcc.git pointer-compare-1.c: Add __attribute__((used)) c-c++-common/asan/pointer-compare-1.c assumes the certain order for variable placement. Add __attribute__((used)) to avoid variable placement changes due to SHF_GNU_RETAIN. PR testsuite/97803 * c-c++-common/asan/pointer-compare-1.c (global1): Add __attribute__((used)) (global2): Likewise. (small_global): Likewise. (large_global): Likewise. --- diff --git a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c index 1ce349e4917..4b558bf8179 100644 --- a/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c +++ b/gcc/testsuite/c-c++-common/asan/pointer-compare-1.c @@ -14,12 +14,13 @@ foo (char *p, char *q) v = p > q; } -char global1[100] = {}, global2[100] = {}; +char __attribute__((used)) global1[100] = {}; +char __attribute__((used)) global2[100] = {}; char __attribute__((used)) smallest_global[5] = {}; -char small_global[7] = {}; +char __attribute__((used)) small_global[7] = {}; char __attribute__((used)) little_global[10] = {}; char __attribute__((used)) medium_global[4000] = {}; -char large_global[5000] = {}; +char __attribute__((used)) large_global[5000] = {}; char __attribute__((used)) largest_global[6000] = {}; int