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 fortran/31716] New: segfault after mixing declarations and executable statements


$ cat exponent-3.f90
program main
  real, parameter :: n = 1024, iter=1000
  real, dimension(n) :: num1,num2
  call random_number(num1)
  real :: start
  do i=1,iter
    num2 = num1**2
  end do
end program main
$ gfortran exponent-3.f90
exponent-3.f90:5.15:

  real :: start
              1
Error: Unexpected data declaration statement at (1)
exponent-3.f90:3.18:

  real, dimension(n) :: num1,num2
                 1
Error: Expression at (1) must be of INTEGER type
exponent-3.f90:3.33:

  real, dimension(n) :: num1,num2
                                1
Error: The module or main program array 'num2' at (1) must have constant shape
exponent-3.f90:3.18:

  real, dimension(n) :: num1,num2
                 1
Error: Expression at (1) must be of INTEGER type
exponent-3.f90:3.28:

  real, dimension(n) :: num1,num2
                           1
Error: The module or main program array 'num1' at (1) must have constant shape
exponent-3.f90:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../../gcc/trunk/configure --prefix=/home/ig25
--enable-maintainer-mode --enable-languages=c,fortran
Thread model: posix
gcc version 4.3.0 20070419 (experimental)

The backtrace is confused, looks like a smashed stack:

Error: The module or main program array 'num1' at (1) must have constant shape

Program received signal SIGSEGV, Segmentation fault.
0xb7ef8103 in __gmpz_sub () from /usr/local/lib/libgmp.so.3
(gdb) bt
#0  0xb7ef8103 in __gmpz_sub () from /usr/local/lib/libgmp.so.3
#1  0xb7edf840 in ?? () from /usr/local/lib/libgmp.so.3
#2  0x0860eca0 in ?? ()
#3  0x0000000b in ?? ()
#4  0x0860f508 in ?? ()
#5  0x00000001 in ?? ()
#6  0x00000001 in ?? ()
#7  0x00000004 in ?? ()
#8  0x0860eca0 in ?? ()
#9  0x00000000 in ?? ()


-- 
           Summary: segfault after mixing declarations and executable
                    statements
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716


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