Bug 14514 - [g77] -ffortran-bounds-check generate wrong-code with Windows and works correctly with Linux
Summary: [g77] -ffortran-bounds-check generate wrong-code with Windows and works corre...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2004-03-10 16:31 UTC by cgerdy
Modified: 2005-07-23 22:49 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 cgerdy 2004-03-10 16:31:01 UTC
g77 -v = Thread model : win32 gcc version 3.3.1 (mingw special 20030804-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.
Comment 1 Andrew Pinski 2004-03-10 16:53:10 UTC
Can you try a later version of gcc, say like 3.3.3 as the one you are using is one not from the FSF and 
two looks to be a based on a prerelease.
Comment 2 Andrew Pinski 2004-06-09 01:02:56 UTC
no feedback in 3 months (T-2 days).