From: Jakub Jelinek <jakub@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: fortran@gcc.gnu.org
Subject: [committed] Avoid -Wsurprising warning on OpenMP min/max array reductions (PR fortran/81304)
Date: Fri, 24 Nov 2017 22:00:00 -0000 [thread overview]
Message-ID: <20171124214228.GC14653@tucnak> (raw)
Hi!
gfc_trans_omp_array_reduction_or_udr creates artificial intrinsics symbol
just for the purpose of expansion of array min/max reductions.
That is something we certainly don't want a -Wsurprising warning on.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk.
2017-11-24 Jakub Jelinek <jakub@redhat.com>
PR fortran/81304
* trans-openmp.c (gfc_trans_omp_array_reduction_or_udr): Set
attr.implicit_type in intrinsic_sym to avoid undesirable warning.
* testsuite/libgomp.fortran/pr81304.f90: New test.
--- gcc/fortran/trans-openmp.c.jj 2017-11-08 16:19:36.000000000 +0100
+++ gcc/fortran/trans-openmp.c 2017-11-24 13:41:41.995610897 +0100
@@ -1623,6 +1623,7 @@ gfc_trans_omp_array_reduction_or_udr (tr
intrinsic_sym.attr.referenced = 1;
intrinsic_sym.attr.intrinsic = 1;
intrinsic_sym.attr.function = 1;
+ intrinsic_sym.attr.implicit_type = 1;
intrinsic_sym.result = &intrinsic_sym;
intrinsic_sym.declared_at = where;
--- libgomp/testsuite/libgomp.fortran/pr81304.f90.jj 2017-11-24 13:50:39.668043753 +0100
+++ libgomp/testsuite/libgomp.fortran/pr81304.f90 2017-11-24 13:50:11.000000000 +0100
@@ -0,0 +1,17 @@
+! PR fortran/81304
+! { dg-do run }
+! { dg-options "-Wsurprising" }
+
+program pr81304
+ integer :: i
+ real, dimension(1:3) :: a, b, c
+ a = 128
+ b = 0
+!$omp parallel do reduction(min: a) reduction(max: b) private (c) ! { dg-bogus "Type specified for intrinsic function" }
+ do i = 1, 16
+ c = (/ i, i - 5, i + 5 /)
+ a = min (a, c)
+ b = max (b, c)
+ end do
+ if (any (a /= (/ 1, -4, 6 /)) .or. any (b /= (/ 16, 11, 21 /))) call abort
+end
Jakub
next reply other threads:[~2017-11-24 21:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-24 22:00 Jakub Jelinek [this message]
2017-12-02 14:14 ` Janus Weil
2017-12-03 10:40 ` Jakub Jelinek
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=20171124214228.GC14653@tucnak \
--to=jakub@redhat.com \
--cc=fortran@gcc.gnu.org \
--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).