public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH] analyzer: Use __builtin_alloca in gcc.dg/analyzer/call-summaries-2.c
Date: Wed, 23 Nov 2022 14:27:07 +0100	[thread overview]
Message-ID: <yddmt8hpzro.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

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 decl

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.

Ok for trunk?

There are a handful of tests that explicitly include <alloca.h> instead,
which is of course an alternative if preferred.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cs2.patch --]
[-- Type: text/x-patch, Size: 421 bytes --]

diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c b/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c
--- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c
@@ -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;
 }

             reply	other threads:[~2022-11-23 13:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 13:27 Rainer Orth [this message]
2022-11-23 14:58 ` David Malcolm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yddmt8hpzro.fsf@CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).