aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2021-11-15 18:23:08 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2021-11-16 20:59:49 -0500
commita80d4e098b10d5cd161f55e4fce64a6be9683ed3 (patch)
tree01a82bf9dbed7a7d48fd0ea58be752d33c45ee4e
parent8c693978dd64b16637577ebf50c760053d7d2165 (diff)
downloadgcc-a80d4e098b10d5cd161f55e4fce64a6be9683ed3.zip
gcc-a80d4e098b10d5cd161f55e4fce64a6be9683ed3.tar.gz
gcc-a80d4e098b10d5cd161f55e4fce64a6be9683ed3.tar.bz2
analyzer: don't assume target has alloca [PR102779]
gcc/testsuite/ChangeLog: PR analyzer/102779 * gcc.dg/analyzer/capacity-1.c: Add dg-require-effective-target alloca. Use __builtin_alloca rather than alloca. * gcc.dg/analyzer/capacity-3.c: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/capacity-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/capacity-3.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/analyzer/capacity-1.c b/gcc/testsuite/gcc.dg/analyzer/capacity-1.c
index 9ea41f7..2d12483 100644
--- a/gcc/testsuite/gcc.dg/analyzer/capacity-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/capacity-1.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target alloca } */
+
#include <stdlib.h>
#include "analyzer-decls.h"
@@ -53,7 +55,7 @@ test_malloc (void)
void
test_alloca (size_t sz)
{
- void *p = alloca (sz);
+ void *p = __builtin_alloca (sz);
__analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(sz_\[^\n\r\]*\\)'" } */
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/capacity-3.c b/gcc/testsuite/gcc.dg/analyzer/capacity-3.c
index 41e282c..c099ff5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/capacity-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/capacity-3.c
@@ -1,10 +1,12 @@
+/* { dg-require-effective-target alloca } */
+
#include <stdlib.h>
#include "analyzer-decls.h"
static void __attribute__((noinline))
__analyzer_callee_1 (size_t inner_sz)
{
- void *p = alloca (inner_sz);
+ void *p = __builtin_alloca (inner_sz);
__analyzer_dump_capacity (p); /* { dg-warning "capacity: 'INIT_VAL\\(outer_sz_\[^\n\r\]*\\)'" } */
}