Bug 24957 - scan() fails sometimesk
Summary: scan() fails sometimesk
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 24787
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-20 13:16 UTC by Klaus Ramstöck
Modified: 2006-01-01 21:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Ramstöck 2005-11-20 13:16:43 UTC
gfortran scan() intrinsic yields incorrect results, see code snippet below

klaus@platon:~/src/F90/bugs> cat scanbug.f90
program scanbug
  character(len=10) :: numset='0123456789'

  print *, scan('0123456789', '9')
  print *, scan(numset, '9')
end program scanbug
klaus@platon:~/src/F90/bugs> gfortran scanbug.f90 -o scanbug
klaus@platon:~/src/F90/bugs> ./scanbug
          10
           0
klaus@platon:~/src/F90/bugs> gcc --version
gcc (GCC) 4.1.0 20050930 (experimental)
Copyright (C) 2005 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es
gibt KEINE Garantie; auch nicht für VERKAUFBARKEIT oder FÜR SPEZIELLE ZWECKE.
Comment 1 Andrew Pinski 2005-11-20 15:51:44 UTC
I think this is a dup of bug 24787 but I don't know for sure as I don't have a build of gfortran after the patch was applied.
Comment 2 kargls 2005-11-20 16:25:26 UTC
kargl[203] cat > a.f90
program scanbug
  character(len=10) :: numset='0123456789'

  print *, scan('0123456789', '9')
  print *, scan(numset, '9')
end program scanbug
kargl[204] gfc41 -o z a.f90
kargl[205] ./z
          10
          10

The bug as fixed on 2005-11-12.  Please update to newer gfortran