]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/81304 (Bogus warning with -Wsurprising and -fopenmp: Type...
authorJakub Jelinek <jakub@redhat.com>
Mon, 25 Jun 2018 16:55:44 +0000 (18:55 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 25 Jun 2018 16:55:44 +0000 (18:55 +0200)
Backported from mainline
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.

From-SVN: r262039

gcc/fortran/ChangeLog
gcc/fortran/trans-openmp.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.fortran/pr81304.f90 [new file with mode: 0644]

index de557c79a13ec0893e894dc5129db010f72d9e09..3fff776fd9662d272af601b887ce4f0ec810d873 100644 (file)
@@ -1,6 +1,12 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       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.
+
        2017-11-23  Dirk Broemmel  <d.broemmel@fz-juelich.de>
                    Jakub Jelinek  <jakub@redhat.com>
 
index d68f99b7d706fd1a63674fb1233cae2c56492590..cc9afaacb2c1f8ec9d9558f2afff569db24690de 100644 (file)
@@ -1584,6 +1584,7 @@ gfc_trans_omp_array_reduction_or_udr (tree c, gfc_omp_namelist *n, locus where)
       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;
 
index 4b777e831a8bc05f61a6124d5e5a98f2da9ce4a2..9671eacd91014dd0b118f4388ae14183b7f37f19 100644 (file)
@@ -1,6 +1,11 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2017-11-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/81304
+       * testsuite/libgomp.fortran/pr81304.f90: New test.
+
        2017-11-23  Dirk Broemmel  <d.broemmel@fz-juelich.de>
                    Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/libgomp/testsuite/libgomp.fortran/pr81304.f90 b/libgomp/testsuite/libgomp.fortran/pr81304.f90
new file mode 100644 (file)
index 0000000..460a2a0
--- /dev/null
@@ -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