Bug 177395

Summary: SEGV with fortran compiled code
Product: [Fedora] Fedora Reporter: Alexander Täschner <taschna>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4Keywords: Regression
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-01-17 14:32:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexander Täschner 2006-01-10 10:05:19 UTC
One of the math testcases of the CERNLIB crashes with a segmentation fault
when compiled using gfortran 4.1.0-0.14, but not with 4.0.2-8.
An minimal testcase is given below:

$ cat tsbvsl.f
      PROGRAM TSBVSL
        CALL NRANIN(54321.)
      END

      SUBROUTINE NRAN(VECTOR,N)
       DIMENSION VECTOR(N)
      DO I=1,N
      VECTOR(I) = RNDM(I)
      END DO
      RETURN
      ENTRY NRANIN (V)
      CALL RDMIN(V)
      RETURN
      END

      SUBROUTINE RDMIN(V)
      END

      REAL FUNCTION RNDM(I)
      RNDM=I
      END
$ gfortran -g -O tsbvsl.f -o tsbsvsl
$ ./tsbsvsl
Segmentation fault


The backtrace gives:


$ gdb ./tsbsvsl
GNU gdb Red Hat Linux (6.3.0.0-1.84rh)
[...]
(gdb) r
Starting program: /home/taschna/tests/tsbsvsl
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0x663000

Program received signal SIGSEGV, Segmentation fault.
master.0.nran (__entry=1, v=0x80485fc, n=0x0, vector=0x0) at tsbvsl.f:14
14            END
Current language:  auto; currently fortran
(gdb) bt
#0  master.0.nran (__entry=1, v=0x80485fc, n=0x0, vector=0x0) at tsbvsl.f:14
#1  0x080484e0 in nranin_ (v=0x80485fc) at tsbvsl.f:11
#2  0x08048515 in MAIN__ () at tsbvsl.f:2
#3  0x08048543 in main ()

Comment 1 Jakub Jelinek 2006-01-17 14:32:26 UTC
Even GCC 4.0.x is buggy, just the optimizations aren't aggressive enough
to exhibit it.  Tracking upstream.