* [committed] Avoid -Wsurprising warning on OpenMP min/max array reductions (PR fortran/81304)
@ 2017-11-24 22:00 Jakub Jelinek
2017-12-02 14:14 ` Janus Weil
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2017-11-24 22:00 UTC (permalink / raw)
To: gcc-patches; +Cc: fortran
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [committed] Avoid -Wsurprising warning on OpenMP min/max array reductions (PR fortran/81304)
2017-11-24 22:00 [committed] Avoid -Wsurprising warning on OpenMP min/max array reductions (PR fortran/81304) Jakub Jelinek
@ 2017-12-02 14:14 ` Janus Weil
2017-12-03 10:40 ` Jakub Jelinek
0 siblings, 1 reply; 3+ messages in thread
From: Janus Weil @ 2017-12-02 14:14 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches, gfortran
Hi Jakub,
thanks a lot for fixing this. Since it's a regression and the fix is
so trivial, I hope you're willing to backport it to the 6 and 7
branches as well? (If not, I can also take care of that.)
Cheers,
Janus
2017-11-24 22:42 GMT+01:00 Jakub Jelinek <jakub@redhat.com>:
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [committed] Avoid -Wsurprising warning on OpenMP min/max array reductions (PR fortran/81304)
2017-12-02 14:14 ` Janus Weil
@ 2017-12-03 10:40 ` Jakub Jelinek
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2017-12-03 10:40 UTC (permalink / raw)
To: Janus Weil; +Cc: gcc-patches, gfortran
On Sat, Dec 02, 2017 at 03:14:31PM +0100, Janus Weil wrote:
> thanks a lot for fixing this. Since it's a regression and the fix is
> so trivial, I hope you're willing to backport it to the 6 and 7
> branches as well? (If not, I can also take care of that.)
Yes, I'll be backporting lots of fixes of mine before 7.3 beta
and afterwards will also do backports to 6.
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-03 10:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-24 22:00 [committed] Avoid -Wsurprising warning on OpenMP min/max array reductions (PR fortran/81304) Jakub Jelinek
2017-12-02 14:14 ` Janus Weil
2017-12-03 10:40 ` Jakub Jelinek
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).