This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug with -ffortran-bounds-check for windows


I discovered a curious bug with g77 with the option : -ffortran-bounds-check
It works with Linux : I use Suse Linux 8.2
And I have a bug when I execute the process with : Windows XP professional.
g77 -v = Thread model: win32 gcc version 3.2.3 (mingw special 20030504-1)
this short example has the bug :

subroutine fichbuf(fichier,fichhlp,buffer,numero,numerp,lligne,
     * nprio,nomlig,iundo,mligne,nomlih)
      parameter(nligne = 85)
      parameter(n2 = 72,m1 = n2 + 9)
      character buffer(0:m1,0:nligne)
      character*(m1) fichier(0:mligne)
      save
      mumero = numero
      do 100 i = 2,nomlig
         do j = 1,m1
            buffer(j,i) = fichier(mumero)(j:j) ! the bug is at that line
         end do
         mumero = mumero + 1
      100 continue
      return
      end

In your Makefile put the line

test.o: test.f
    g77 -ffortran-bounds-check -g -Wa,-alhs,-L, -c test.f

In a DOS window go to the correct directory and tape :

make test.o > test.asm

examine carefully the code line : buffer(j,i) = fichier(mumero)(j:j) in the
file test.asm
examine in Windows and in Linux : a big difference :
approximately 20 lines of code are suppressed in windows in the assembler
lines.
Those lines cannot work in Windows : for example there is only 3 call to
_s_rnge the function
who make the job, very curious for testing two arrays with two indices :

buffer indices i,j
fichier indices mumero,j
2X2 = 3 !!!!! very interesting

If you examine in detail the asm code you automaticaly go to a :
segmentation fault if you execute it.
I discovered the bug by testing my code which is distributed with the GNU
license on my site :

http://perso.wanadoo.fr/claude.gerdy

You can download on this site for Windows and for Linux an editor for
FORTRAN77 and Fortran95
Do you intend to correct this bug because the option -ffortran-bounds-check
is very practical for me.
Thank you for your answer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]