Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28445 Discussions

SIGSEGV with allocatable arrays in NAMELIST reads

gregfi04
Beginner
460 Views
I'm getting SIGSEGV errors when trying to use allocatable arrays with NAMELIST read statements. Code and input that reproduces the error appears below. This is compiled with ifort 11.1.046 on Linux. Am I missing something? Can anyone else reproduce this? Thanks.

---
PROGRAM read_namelist
IMPLICIT NONE
INTEGER :: int1, int2
REAL, ALLOCATABLE, DIMENSION(:) :: response_function

NAMELIST /RESPONSE_DATA/ int1, int2, response_function
ALLOCATE(response_function(1))

read(unit=5,NML=RESPONSE_DATA)

write(*,*) "RESULTS:", response_function(1),int1, int2
END PROGRAM
---

---
&RESPONSE_DATA
int1=13 int2=52
response_function(1) = 1.0 /
---

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 0000000000402D46 MAIN__ 11 read_namelist.f90
a.out 0000000000402B4C Unknown Unknown Unknown
libc.so.6 00002AF148689184 Unknown Unknown Unknown
a.out 0000000000402A79 Unknown Unknown Unknown
0 Kudos
3 Replies
Kevin_D_Intel
Employee
460 Views

Definitely reproducible. I do not see that you're missing anything. The issue relates to the allocatable array; a static array works well, but allocatable I expect should work too.

Restrictions on NAMELIST groups were relaxed in 11.1. The sample code would flag an error with pre-11.1 compilers:

error #6578: A NAMELIST group object must not be an allocatable object, a pointer, or a variable of a type that has an ultimate component that is a pointer or an allocatable array.

I directed this to the development team and will update the thread as I learn more.

(Internal tracking id: DPD200138414)
0 Kudos
Steven_L_Intel1
Employee
460 Views
This doesn't surprise me as just yesterday I reported two other issues relating to allocatable arrays and NAMELIST. My advice is to assume that allocatable and pointer arrays are not yet supported for NAMELIST.
0 Kudos
Kevin_D_Intel
Employee
460 Views

This issue is resolved in the 11.1.056 update.

$ ifort -V -g -traceback u67321.f90
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20090827 Package ID: l_cprof_p_11.1.056
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

Intel Fortran 11.1-2582
GNU ld version 2.17.50.0.6-5.el5 20061020

$ ./a.out
RESULTS: 1.000000 13 52
0 Kudos
Reply