Bug 81304 - [6 Regression] Bogus warning with -Wsurprising and -fopenmp: Type specified for intrinsic function 'min' / 'max'
Summary: [6 Regression] Bogus warning with -Wsurprising and -fopenmp: Type specified f...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 7.1.0
: P4 normal
Target Milestone: 6.5
Assignee: Jakub Jelinek
URL:
Keywords: diagnostic, openmp
Depends on:
Blocks:
 
Reported: 2017-07-04 09:23 UTC by janus
Modified: 2018-06-25 18:10 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.4.7
Known to fail: 4.5.0, 4.6.4
Last reconfirmed: 2017-07-04 00:00:00


Attachments
gcc8-pr81304.patch (642 bytes, patch)
2017-11-24 13:28 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2017-07-04 09:23:31 UTC
Consider this minimal test case:


program bogus_warning
   integer :: i
   real, dimension(1:3) :: Dx_min, Dx_max
!$omp parallel do default(shared) private(i) reduction(min: Dx_min) reduction(max: Dx_max)
   do i = 1,16
   end do
!$omp end parallel do
end


When compiled with -Wsurprising -fopenmp, it yields two bogus warnings:


surprising.f90:4:90:

 !$omp parallel do default(shared) private(i) reduction(min: Dx_min) reduction(max: Dx_max)
                                                                                          1
Warning: Type specified for intrinsic function ‘min’ at (1) is ignored [-Wsurprising]
surprising.f90:4:90:

 !$omp parallel do default(shared) private(i) reduction(min: Dx_min) reduction(max: Dx_max)
                                                                                          1
Warning: Type specified for intrinsic function ‘max’ at (1) is ignored [-Wsurprising]


This happens with all versions I tried from 4.6 to 7, but not with 4.4.

(Loosely related to PR59107, but not a duplicate.)
Comment 1 Dominique d'Humieres 2017-07-04 10:07:23 UTC
Confirmed from 4.5 up to trunk (8.0). I don't get any warning with gcc 4.4.7: regression?
Comment 2 janus 2017-07-04 13:26:39 UTC
(In reply to Dominique d'Humieres from comment #1)
> Confirmed from 4.5 up to trunk (8.0). I don't get any warning with gcc
> 4.4.7: regression?

Yes, seems to be a regression (a pretty old one, though).
Comment 3 janus 2017-07-06 20:21:44 UTC
Note that the bogus warning goes away when using scalar reduction variables:


program bogus_warning
   integer :: i
   real :: Dx_min, Dx_max
!$omp parallel do default(shared) private(i) reduction(min: Dx_min) reduction(max: Dx_max)
   do i = 1,16
   end do
!$omp end parallel do
end
Comment 4 Jakub Jelinek 2017-11-24 13:28:43 UTC
Created attachment 42711 [details]
gcc8-pr81304.patch

Untested fix.
Comment 5 Jakub Jelinek 2017-11-24 21:40:52 UTC
Author: jakub
Date: Fri Nov 24 21:40:21 2017
New Revision: 255144

URL: https://gcc.gnu.org/viewcvs?rev=255144&root=gcc&view=rev
Log:
	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.

Added:
    trunk/libgomp/testsuite/libgomp.fortran/pr81304.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-openmp.c
    trunk/libgomp/ChangeLog
Comment 6 Jakub Jelinek 2017-11-24 23:31:37 UTC
Fixed on the trunk so far.
Comment 7 Jakub Jelinek 2017-12-15 22:01:19 UTC
Author: jakub
Date: Fri Dec 15 22:00:48 2017
New Revision: 255716

URL: https://gcc.gnu.org/viewcvs?rev=255716&root=gcc&view=rev
Log:
	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.

Added:
    branches/gcc-7-branch/libgomp/testsuite/libgomp.fortran/pr81304.f90
Modified:
    branches/gcc-7-branch/gcc/fortran/ChangeLog
    branches/gcc-7-branch/gcc/fortran/trans-openmp.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
    branches/gcc-7-branch/libgomp/ChangeLog
Comment 8 Jakub Jelinek 2017-12-16 08:59:02 UTC
Fixed for 7.3+ too.
Comment 9 janus 2018-03-15 10:34:01 UTC
Thanks for fixing, Jakub! Will you backport to gcc-6-branch as well?
Comment 10 Jakub Jelinek 2018-06-25 16:56:16 UTC
Author: jakub
Date: Mon Jun 25 16:55:44 2018
New Revision: 262039

URL: https://gcc.gnu.org/viewcvs?rev=262039&root=gcc&view=rev
Log:
	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.

Added:
    branches/gcc-6-branch/libgomp/testsuite/libgomp.fortran/pr81304.f90
Modified:
    branches/gcc-6-branch/gcc/fortran/ChangeLog
    branches/gcc-6-branch/gcc/fortran/trans-openmp.c
    branches/gcc-6-branch/libgomp/ChangeLog
Comment 11 Jakub Jelinek 2018-06-25 18:05:01 UTC
Fixed for 6.5 too.
Comment 12 janus 2018-06-25 18:10:17 UTC
(In reply to Jakub Jelinek from comment #11)
> Fixed for 6.5 too.

Thanks a bunch :)