Operating System - Linux
1752732 Members
6338 Online
108789 Solutions
New Discussion

f90 compilation core dumps on an array constructor statement

 
phillip stout
New Member

f90 compilation core dumps on an array constructor statement

-- f90 core dumps on the following code:
program test
! character(len=5) :: a_list(2) = (/ '12345','1234' /)
character(len=5) :: a_list(2) = (/ '1234','12345' /)
end do

] f90 +source=free 03.f
03.f
program TEST

** Floating Point Exception **
( 0) 0x002481a0 coredump + 0x10 [/opt/fortran90/lbin/f90com32]
( 1) 0x001f809c cry_and_die + 0x3c [/opt/fortran90/lbin/f90com32]
( 2) 0x001f8738 f_onsignal + 0x30 [/opt/fortran90/lbin/f90com32]
( 3) 0x002d95ac compsignal + 0x1c [/opt/fortran90/lbin/f90com32]
( 4) 0x009d4d98 _sigreturn [/opt/fortran90/lbin/f90com32]
( 5) 0x00246840 blockcopy + 0x28 [/opt/fortran90/lbin/f90com32]
( 6) 0x0028305c arrayconaction1 + 0xfcc [/opt/fortran90/lbin/f90com32]
( 7) 0x00287b04 evalinitexpr + 0x290 [/opt/fortran90/lbin/f90com32]
( 8) 0x001c9764 generatetriads + 0xfc64 [/opt/fortran90/lbin/f90com32]
( 9) 0x001a8e2c processprogramblock + 0x64 [/opt/fortran90/lbin/f90com32]
(10) 0x001b6dd4 visitpreorder + 0x58 [/opt/fortran90/lbin/f90com32]
(11) 0x001b6e80 visitprogramblocklist + 0x20 [/opt/fortran90/lbin/f90com32]
(12) 0x001cf528 seman2 + 0x144 [/opt/fortran90/lbin/f90com32]
(13) 0x0021f17c fort90 + 0x1bd14 [/opt/fortran90/lbin/f90com32]
(14) 0x001ae378 main + 0x18 [/opt/fortran90/lbin/f90com32]
(15) 0x009864d8 _start + 0x80 [/opt/fortran90/lbin/f90com32]
(16) 0x001a82a0 $START$ + 0x1a0 [/opt/fortran90/lbin/f90com32]
f90: error 71: Signal 6 (abort) while compiling 03.f

-- The fix appears to be having the first string element in the array constructor match the "len" of the declaration. For instance:
character(len=5) :: a_list(2) = (/ '12345','1234' /)

Question1: When using an array constructor on an array of strings should each elements character length match exactly the declared length?

Question2: Is the workaround (of having the first alement in the array constructor exactly match the declaration length, but elements that follow can have any length not to exceed the delclared max character length) going to cause some memory nastiness in the executable?

--some system information
hpux pa-risc
] what /opt/fortran90/bin/f90
/opt/fortran90/bin/f90:
HP-UX f90 B3907DB/B3909DB B.11.11.99.02 PHSS_34398 / B.11.23.33 PHSS_34399 (PA RISC) Tue Oct 31 09:12:32 CST 2006
HP F90 v3.1.2
$ PATCH/11.00:PHCO_95167 Oct 1 1998 13:46:32 $