public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104164] New: Bogus warning issued by -Wsurprising
@ 2022-01-21 13:37 juergen.reuter at desy dot de
2022-07-29 6:39 ` [Bug fortran/104164] " burnus at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: juergen.reuter at desy dot de @ 2022-01-21 13:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104164
Bug ID: 104164
Summary: Bogus warning issued by -Wsurprising
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: juergen.reuter at desy dot de
Target Milestone: ---
The code below (using iso_varying_string and a child module in the same module
gives a bogus warning from -Wsurprsing
reproducendum.f90:110:6:
110 | use diagnostics
| 1
Warning: Type specified for intrinsic function ‘len’ at (1) is ignored
[-Wsurprising]
Depending on the order of the two use statements in the final module
(os_interface), this warning appears either once or twice!
Reproducer:
module iso_varying_string
implicit none
integer, parameter, private :: GET_BUFFER_LEN = 1
type, public :: varying_string
private
character(LEN=1), dimension(:), allocatable :: chars
end type varying_string
interface assignment(=)
module procedure op_assign_CH_VS
module procedure op_assign_VS_CH
end interface assignment(=)
interface char
module procedure char_auto
module procedure char_fixed
end interface char
interface len
module procedure len_
end interface len
interface trim
module procedure trim_
end interface trim
public :: assignment(=)
public :: char
public :: len
public :: trim
private :: op_assign_CH_VS
private :: op_assign_VS_CH
private :: char_auto
private :: char_fixed
private :: len_
private :: trim_
contains
elemental function len_ (string) result (length)
type(varying_string), intent(in) :: string
integer :: length
if(ALLOCATED(string%chars)) then
length = SIZE(string%chars)
else
length = 0
endif
end function len_
elemental subroutine op_assign_CH_VS (var, exp)
character(LEN=*), intent(out) :: var
type(varying_string), intent(in) :: exp
end subroutine op_assign_CH_VS
elemental subroutine op_assign_VS_CH (var, exp)
type(varying_string), intent(out) :: var
character(LEN=*), intent(in) :: exp
end subroutine op_assign_VS_CH
pure function char_auto (string) result (char_string)
type(varying_string), intent(in) :: string
character(LEN=len(string)) :: char_string
integer :: i_char
forall(i_char = 1:len(string))
char_string(i_char:i_char) = string%chars(i_char)
end forall
end function char_auto
pure function char_fixed (string, length) result (char_string)
type(varying_string), intent(in) :: string
integer, intent(in) :: length
character(LEN=length) :: char_string
char_string = char(string)
end function char_fixed
elemental function trim_ (string) result (trim_string)
type(varying_string), intent(in) :: string
type(varying_string) :: trim_string
trim_string = TRIM(char(string))
end function trim_
end module iso_varying_string
module diagnostics
use iso_varying_string, string_t => varying_string
implicit none
private
public :: int2char
public :: int2fixed
contains
pure function int2fixed (i) result (c)
integer, intent(in) :: i
character(200) :: c
end function int2fixed
pure function int2char (i) result (c)
integer, intent(in) :: i
character(len (trim (int2fixed (i)))) :: c
end function int2char
end module diagnostics
module os_interface
use iso_varying_string, string_t => varying_string
use diagnostics
end module os_interface
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/104164] Bogus warning issued by -Wsurprising
2022-01-21 13:37 [Bug fortran/104164] New: Bogus warning issued by -Wsurprising juergen.reuter at desy dot de
@ 2022-07-29 6:39 ` burnus at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-07-29 6:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104164
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Looking at related but fixed bugs, I did see:
PR fortran/81304
* trans-openmp.c (gfc_trans_omp_array_reduction_or_udr): Set
attr.implicit_type in intrinsic_sym to avoid undesirable warning.
Thus, I wonder whether doing something like that would solve the issue?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-29 6:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 13:37 [Bug fortran/104164] New: Bogus warning issued by -Wsurprising juergen.reuter at desy dot de
2022-07-29 6:39 ` [Bug fortran/104164] " burnus at gcc dot gnu.org
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).