public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-6467] analyzer: start adding test coverage for OpenMP [PR109016]
Date: Fri,  3 Mar 2023 23:19:34 +0000 (GMT)	[thread overview]
Message-ID: <20230303231934.2A6983858D28@sourceware.org> (raw)

https://gcc.gnu.org/g:df0184906a7b86a497c038766366904a20b5601e

commit r13-6467-gdf0184906a7b86a497c038766366904a20b5601e
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Fri Mar 3 18:18:51 2023 -0500

    analyzer: start adding test coverage for OpenMP [PR109016]
    
    gcc/testsuite/ChangeLog:
            PR analyzer/109016
            * gcc.dg/analyzer/omp-parallel-for-1.c: New test.
            * gcc.dg/analyzer/omp-parallel-for-get-min.c: New test.
    
    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

Diff:
---
 gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-1.c | 21 +++++++++++++++++++
 .../gcc.dg/analyzer/omp-parallel-for-get-min.c     | 24 ++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-1.c b/gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-1.c
new file mode 100644
index 00000000000..dae940dac20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-1.c
@@ -0,0 +1,21 @@
+/* { dg-additional-options "-fopenmp -Wall" } */
+
+typedef struct _Image
+{
+  int columns, rows;
+} Image;
+
+extern int get_num_threads(void);
+
+void
+test (Image* image)
+{
+  int y;
+
+#pragma omp parallel for schedule(static) \
+  num_threads(get_num_threads ())
+
+  for (y = 0; y < image->rows; y++) {
+    /* [...snip...] */
+  }
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-get-min.c b/gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-get-min.c
new file mode 100644
index 00000000000..a7e64e1a3a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-get-min.c
@@ -0,0 +1,24 @@
+/* Reduced from ImageMagick-7.1.0-57's MagickCore/attribute.c: GetEdgeBackgroundColor */
+
+/* { dg-additional-options "-fopenmp -Wall" } */
+
+extern double get_census (void);
+
+double
+test()
+{
+  double census[4], edge_census;
+  int i;
+
+#pragma omp parallel for schedule(static)
+
+  for (i = 0; i < 4; i++) {
+    census[i] = get_census ();
+  }
+  edge_census = (-1.0);
+  for (i = 0; i < 4; i++)
+    if (census[i] > edge_census) { /* { dg-bogus "use of uninitialized value" } */
+      edge_census = census[i];
+    }
+  return edge_census;
+}

                 reply	other threads:[~2023-03-03 23:19 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=20230303231934.2A6983858D28@sourceware.org \
    --to=dmalcolm@gcc.gnu.org \
    --cc=gcc-cvs@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).