public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [committed] libgomp.oacc-c-c++-common/loop-gwv-2.c: Use __builtin_alloca
Date: Mon, 25 Oct 2021 20:53:26 +0200	[thread overview]
Message-ID: <6a13dcc8-06c9-2d33-4ed0-4c25593aaa7e@codesourcery.com> (raw)

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

In PR testsuite/102910 there was some discussion about alloca.h and
whether that header exists or whether 'alloca' is provided by stdlib.h
or ...

Well, some grepping showed that libgomp.oacc-c-c++-common/loop-gwv-2.c
also used 'alloca'. Solution: Do it like other testcases and use
__builtin_alloca. (I think this will fail on nvptx, but otherwise
it should now pass on more systems.)

I have only tested it on x86-64, where it passed before and after,
but I do see in gcc-testresults@ fails (even though I don't know
whether those fails are for this issue or others).

Committed as Rev. r12-4691.

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Attachment #2: committed.diff --]
[-- Type: text/x-patch, Size: 1773 bytes --]

commit 72dc270be793f159a3a038bef41542d85550b331
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Oct 25 20:40:13 2021 +0200

    libgomp.oacc-c-c++-common/loop-gwv-2.c: Use __builtin_alloca
    
    Some systems do not have <alloca.h> but provide alloca differently, e.g.
    via stdlib.h. Do it like other testcases do and use __builtin_alloca.
    
    libgomp/ChangeLog:
    
            PR testsuite/102910
            * testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c: Use __builtin_alloca
            instead of #include <alloca.h> + alloca.
---
 libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c
index cb3878b8d4e..e73ed6064eb 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c
@@ -6,7 +6,6 @@
 
 #include <stdio.h>
 #include <openacc.h>
-#include <alloca.h>
 #include <string.h>
 #include <gomp-constants.h>
 #include <stdlib.h>
@@ -78,9 +77,9 @@ int main ()
     vectorsize = __builtin_goacc_parlevel_size (GOMP_DIM_VECTOR);
   }
 
-  gangdist = (int *) alloca (gangsize * sizeof (int));
-  workerdist = (int *) alloca (workersize * sizeof (int));
-  vectordist = (int *) alloca (vectorsize * sizeof (int));
+  gangdist = (int *) __builtin_alloca (gangsize * sizeof (int));
+  workerdist = (int *) __builtin_alloca (workersize * sizeof (int));
+  vectordist = (int *) __builtin_alloca (vectorsize * sizeof (int));
   memset (gangdist, 0, gangsize * sizeof (int));
   memset (workerdist, 0, workersize * sizeof (int));
   memset (vectordist, 0, vectorsize * sizeof (int));

                 reply	other threads:[~2021-10-25 18:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=6a13dcc8-06c9-2d33-4ed0-4c25593aaa7e@codesourcery.com \
    --to=tobias@codesourcery.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).