- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am rather new to using Fortran, and have been rather stumped with a segfault. Compiles with gfortran, even with optimisations. Also compiles with ifort without optimisations, or without openmp. However multithreaded ifort with optimisations fail.
I have already tried increasing OMP_STACKSIZE, compiled with -warn all and -check all flags, payed special attention to interfaces and check arg_temp_created, and fiddled around with the heap-arrays flag, to no avail.
Finally, i have shred down many modules and submodules into few lines in a single source file which serves as a minimum working example (MWE) . I have attached the file. I am losing my mind over this, would really appreciate any help.
compiler version
*************************
ifort --version returns: ifort (IFORT) 2021.10.0 20230609
mwe description (main.f90)
********************
Basically, the mwe has an array from the main program passed to an intermediate subroutine subrt_interm, which passes the array along to another function which returns a complex number.
Fiddling around with some harmless loops and the solitary write(*,*) statement makes the segfault disappear sometimes, even though the valgrind warnings of 'invalid read' and 'invalid access' remain. It seems that changing assumed shape arrays to ones with explicit dimensions solves the problem.
compile flags
*******************************
ifort -o ALF.out -std08 -cpp -O3 -fp-model fast=2 -xHost -unroll -finline-functions -ipo -ip -heap-arrays 1024 -no-wrap-margin -g -parallel -qopenmp main.F90
output
*********************
on running the code, this is what I get
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
libc.so.6 00007FF32561A520 Unknown Unknown Unknown
ALF.out 0000000000404CF7 Unknown Unknown Unknown
ALF.out 00000000004046BD Unknown Unknown Unknown
ALF.out 000000000040428D Unknown Unknown Unknown
libc.so.6 00007FF325601D90 Unknown Unknown Unknown
libc.so.6 00007FF325601E40 __libc_start_main Unknown Unknown
ALF.out 00000000004041A5 Unknown Unknown Unknown
valgrind output
**********************
on running through valgrind I get this:
==527527== Use of uninitialised value of size 8
==527527== at 0x404CB9: main_IP_subrt_interm_ (main.F90:76)
==527527== by 0x4046BC: MAIN__ (main.F90:27)
==527527== by 0x40428C: main (in /home/sounak/mwe/Kondo_Impurities/Prog/ALF.out)
==527527==
==527527== Use of uninitialised value of size 8
==527527== at 0x404CF7: main_IP_subrt_interm_ (main.F90:76)
==527527== by 0x4046BC: MAIN__ (main.F90:27)
==527527== by 0x40428C: main (in /home/sounak/mwe/Kondo_Impurities/Prog/ALF.out)
==527527==
==527527== Invalid read of size 16
==527527== at 0x404CF7: main_IP_subrt_interm_ (main.F90:76)
==527527== by 0x4046BC: MAIN__ (main.F90:27)
==527527== by 0x40428C: main (in /home/sounak/mwe/Kondo_Impurities/Prog/ALF.out)
==527527== Address 0x800f44b360 is not stack'd, malloc'd or (recently) free'd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The bug you reported is fixed in latest Intel compiler (ifort) version 2021.11 available as part of the Intel HPC Toolkit 2024.0 or as a stand-alone download here: Intel® Fortran Compiler
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I reproduced this problem with latest nightly ifort compiler build. It looks like a "Hoist Dope Vector fields" optimization (enabled with O2 and higher; no problem with O1) causing this. Note that there is no issue with ifx compiler and I recommend to evaluate ifx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for looking into this,
I will use icx everywhere now, but let me know if there is a planned fix.
thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The bug you reported is fixed in latest Intel compiler (ifort) version 2021.11 available as part of the Intel HPC Toolkit 2024.0 or as a stand-alone download here: Intel® Fortran Compiler

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page