]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: Use __builtin_alloca in gcc.dg/analyzer/call-summaries-2.c
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 23 Nov 2022 20:54:26 +0000 (21:54 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 23 Nov 2022 20:54:26 +0000 (21:54 +0100)
gcc.dg/analyzer/call-summaries-2.c currently FAILs on Solaris:

FAIL: gcc.dg/analyzer/call-summaries-2.c (test for excess errors)

Excess errors:
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c:468:12:
warning: implicit declaration of function 'alloca' [-Wimplicit-function-declaration]
/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c:468:12:
warning: incompatible implicit declaration of built-in function 'alloca' [-Wbuiltin-declaration-mismatch]

alloca is only declared in <alloca.h>, which isn't included indirectly
anywhere.  To avoid this, I switched the test to use __builtin_alloca
instead, following the vast majority of analyzer tests that use alloca.

Tested no i386-pc-solaris2.11, sparc-sun-solaris2.11, and
x86_64-pc-linux-gnu.

2022-11-23  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc/testsuite:
* gcc.dg/analyzer/call-summaries-2.c (uses_alloca): Use
__builtin_alloca instead of alloca.

gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c

index 85cece72b3440c30db0ad952fce401ce4ca53e04..953cbd32f5a37131285b5be024ad79f611fac2f3 100644 (file)
@@ -465,7 +465,7 @@ int test_returns_external_result (void)
 
 int uses_alloca (int i)
 {
-  int *p = alloca (sizeof (int));
+  int *p = __builtin_alloca (sizeof (int));
   *p = i;
   return *p;
 }