This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/37099] Wrong results when comparing a character array to a character expression
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Aug 2008 12:40:16 -0000
- Subject: [Bug fortran/37099] Wrong results when comparing a character array to a character expression
- References: <bug-37099-12313@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from dominiq at lps dot ens dot fr 2008-08-13 12:40 -------
The strings must have more than one character to reproduce the bug:
integer, parameter :: n = 10
integer, parameter :: ilst(n) = (/(i,i=1,n)/)
character(*), parameter :: c0lst(n) = (/(char(96+i),i=1,n)/)
character(*), parameter :: c1lst(n) = (/(char(96+i)//'b',i=1,n)/)
logical :: tmp(n)
i = 5
print *, ilst(:) == i
print *, c0lst(:)(1:1) == char(96+i)
tmp = c1lst(:)(1:1) == char(96+i)
print *, tmp
print *, c1lst(:)(1:1) == 'e'
if (any(tmp .neqv. (c0lst(:)(1:1) == char(96+i)))) call abort()
end
gives
F F F F T F F F F F
F F F F T F F F F F
F F F F F F F F F F <== wrong!
F F F F T F F F F F
Abort
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37099