public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* bug with -ffortran-bounds-check for windows
@ 2004-03-07 10:25 Claude Gerdy
  0 siblings, 0 replies; 3+ messages in thread
From: Claude Gerdy @ 2004-03-07 10:25 UTC (permalink / raw)
  To: gcc-bugs

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(mligne)
      save
      mumero = numero
      do 100 i = 2,nomlig
         do j = 1,m1
            buffer(j,i) = fichier(mumero)(j:j)    ! the bug is in this 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 and read the generated assembler lines in Windows and
in Linux
a big difference : approximately 20 lines of assembler code are suppressed
in Windows
The assembler lines of windows cannot work and automatically generate a
segmentation fault if you execute this code
There is only 3 call _s_rnge to test 2 arrays with 2 indice each.
I discovered the bug by testing my code which is distribured with the GNU
license on my site:
//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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug with -ffortran-bounds-check for windows
  2004-03-07  9:27 Claude Gerdy
@ 2004-03-10  5:32 ` Jim Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2004-03-10  5:32 UTC (permalink / raw)
  To: Claude Gerdy; +Cc: gcc-bugs

Claude Gerdy wrote:
> I discovered a curious bug with g77 with the option : -ffortran-bounds-check
> It works with Linux : I use Suse Linux 8.2

You didn't mention the gcc version here.  If this is a newer gcc 
version, then perhaps you need to update your mingw compiler version.

> 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 :

We do not track bugs reported via email.  You probably won't get an 
answer unless you file the bug into our bugzilla bug database.  Plesse see
	http://gcc.gnu.org/bugs.html
for more info on reporting bugs.

We are not maintaining gcc-3.2 anymore, but it would be useful to know 
if the bug is still present in current sources.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug with -ffortran-bounds-check for windows
@ 2004-03-07  9:27 Claude Gerdy
  2004-03-10  5:32 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Claude Gerdy @ 2004-03-07  9:27 UTC (permalink / raw)
  To: bug-gcc

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-03-10  5:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-07 10:25 bug with -ffortran-bounds-check for windows Claude Gerdy
  -- strict thread matches above, loose matches on Subject: below --
2004-03-07  9:27 Claude Gerdy
2004-03-10  5:32 ` Jim Wilson

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).