This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Possible error in unused parameters diagnosis warnings
- From: Benjamin Réveillé <benjamin dot reveille at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Tue, 6 Dec 2005 15:19:11 +0100
- Subject: Possible error in unused parameters diagnosis warnings
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=d6n07wZjNUAuU4vXyHkA86YoJ+EkSNKTSvZQMoS/cH2MErvqFWAiJmVZnwoFPjPWepuYuTxhlb3gfSIypl9SVnyipJ2njJSHn8pTCXyipvqz4b7Tqi4sDh4CgjKEs+tVvGcjTGfK9RIMnDd27WE+5ISN2VCvLYirdyEL89jTd5U=
Hello again
This is to submit an error in the unused parameters diagnosis warnings
(code compiles fine... so it is not a compalier usability problem)
I kept getting alot of ": warning: unused parameter 'param'" when
compiling with gfortran that don't seem correct. so I wrote a sample
program to illustrate...
example:
program unusederror
implicit none
call test1(1)
call test2((/1,0/))
call test3((/' toto','tutu '/))
call test4('tutu','toto')
call test5('tutu ')
!
contains
subroutine test1(in1)
implicit none
integer, intent(in) :: in1
if (in1==1) then
write(*,*) 'hello world test1'
end if
end subroutine test1
!
subroutine test2(in2)
implicit none
integer, dimension(:), intent(in) :: in2
if (any(in2==1).or.in2(2)==0) then
write(*,*) 'hello world test2'
end if
end subroutine test2
!
subroutine test3(string3)
implicit none
character(len=*), dimension(:), intent(in) :: string3
if (any(string3=='tutu').or.string3(2)=='tutu') then
write(*,*) 'hello world test3'
end if
end subroutine test3
!
subroutine test4(string41,string42)
implicit none
character(len=*), intent(in) :: string41,string42
if (any((/string41,string42/)=='tutu')) then
write(*,*) 'hello world test4'
end if
end subroutine test4
!
subroutine test5(string5)
implicit none
character(len=*), intent(in) :: string5
if (trim(string5)=='tutu') then
write(*,*) 'hello world test5'
end if
end subroutine test5
end program unusederror
>> gfortran -W -Wall unusederror.f90
unused.f90:5: warning: unused parameter 'string3'
unused.f90:4: warning: unused parameter 'in2'
##########################################
Lahey Fortran 90 Source Check Output
Checking file SOURCE.F90.
Checking program unit UNUSEDERROR at line 1.
Encountered 0 errors, 0 warnings in file SOURCE.F90.
###############################################
1) Warnings are false to me and Lahey(see above) because these
variables are used...
2) I don't understand the line references they seem to refer to the
function call instead of its declaration...
It seems that whenever dealing with an array that is when we get this
error... because only test3 and test2 issue the bogus warning...
Arrays can also be real or other types...
I would be curious to get your opinions on this matter... (This is low
priority but might be good to keep in mind for the final touches of
gfortran)
Benjamin