From: Sandra Loosemore Date: Mon, 25 Oct 2021 18:08:28 +0000 (-0700) Subject: Fix broken use of alloca in C interoperability testcase X-Git-Tag: basepoints/gcc-13~3599 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9190a1c6d001099d1409298ae3b684499bd1fdd;p=thirdparty%2Fgcc.git Fix broken use of alloca in C interoperability testcase 2021-10-25 Sandra Loosemore gcc/testsuite/ PR testsuite/102910 * gfortran.dg/c-interop/cf-descriptor-5-c.c: Use a static buffer instead of alloca. --- diff --git a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5-c.c b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5-c.c index 12464b555124..320a354730ba 100644 --- a/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5-c.c +++ b/gcc/testsuite/gfortran.dg/c-interop/cf-descriptor-5-c.c @@ -1,6 +1,5 @@ #include #include -#include #include #include "dump-descriptors.h" @@ -8,12 +7,18 @@ extern void ctest (int n); extern void ftest (CFI_cdesc_t *a, int n); +#define BUFSIZE 512 +static char adata[BUFSIZE]; + void ctest (int n) { CFI_CDESC_T(0) adesc; CFI_cdesc_t *a = (CFI_cdesc_t *) &adesc; - char *adata = (char *) alloca (n); + + /* Use a fixed-size static buffer instead of allocating one dynamically. */ + if (n > BUFSIZE) + abort (); /* Fill in adesc. */ check_CFI_status ("CFI_establish",