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

IFX did not pass "man or boy" test

rudi-gaelzer
Neuer Beitragender I
1.637Aufrufe

Version: Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.2.1 Build 20240711

I have just verified this: ifx did not pass the "man or boy" test:

https://rosettacode.org/wiki/Man_or_boy_test#Fortran

 

Compiling and running  the Fortran code contained in the URL above with ifx gives the error: 

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source              
libc.so.6          00007FD6A076BD00  Unknown               Unknown  Unknown
Unknown            00007FFDC2BD2480  Unknown               Unknown  Unknown

 

Compiling with ifort or gfortran runs successfully and gives the correct answer (-67).

 

0 Kudos
11 Antworten
jimdempseyatthecove
Geehrter Beitragender III
1.596Aufrufe

This may be a stack size issue. 

Can you investigate this (e.g k=8)

 

Jim Dempsey

rudi-gaelzer
Neuer Beitragender I
1.592Aufrufe

Changing the value of k in the main program, I verified that ifx runs and generates the same answer as with ifort and gfortran up to k = 3.  For k >= 4 I get the error message.

If it is a stack size problem, is there a compilation option to change?  I have the latest OneAPI installed in linux.

 

jimdempseyatthecove
Geehrter Beitragender III
1.559Aufrufe

My Linux system is not up so I cannot test.

There is a compiler option Wl,option1[,option2,...] (lower case L)

That passes options onto the linker.

Try adding: , -Wl, --stack,<sizeYouWantHere>

 

Check the linker documentation for proper syntax and for how you represent the size argument.

 

Jim Dempsey

 

S-Poulsen
Anfänger
1.531Aufrufe

The man or boy test program runs fine when compiled with ifx 2024.2.1 on Linux. The program prints the answer -67.

rudi-gaelzer
Neuer Beitragender I
1.451Aufrufe

Then this is strange.  Did you use the standard options for compilation?

My system is:

Fedora Linux 40

~>ifx -V
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.2.1 Build 20240711
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.

 

The OneAPI suite was installed via yum/rpm using Intel repo.

 

Compiling and running:

>ifx test_man_or_boy.f90

>./a.out  
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source              
libc.so.6          00007FF26F64FD00  Unknown               Unknown  Unknown
Unknown            00007FFDAF38E300  Unknown               Unknown  Unknown

 

I get the same error in two different boxes with identical configurations.

 

S-Poulsen
Anfänger
1.413Aufrufe

Ok, I am on Ubuntu 22.04, but compiled without any optional compiler options, exactly as you did above. My stack size is 8192 kbytes, according to the ulimit -s command (referred to by TobiasK below).

rudi-gaelzer
Neuer Beitragender I
1.359Aufrufe

The stack size on my systems is the same (8192 k) and it's the same for gfortran and ifort.  Compounding that with the meaning of the error message (see below), I don't think this is the issue.

Anyway, the nesting depth of the program does not seem to me large enough to provoke a stack overflow.

 

rudi-gaelzer
Neuer Beitragender I
1.443Aufrufe

Looking at the "List of Runtime Error Messages" in Intel's documentation, I've found:

 

  • severe (174): SIGSEGV, segmentation fault occurred

    This message indicates that the program attempted an invalid memory reference. Check the program for possible errors.

 

So it seems that this is not related to stack size overflow, because in this case the error message would be: 

  • severe (174): SIGSEGV, possible program stack overflow occurred

    The following explanatory text also appears:

     

    Program requirements exceed current stacksize resource limit.
TobiasK
Moderator
1.432Aufrufe

Please check your stack size limit:
ulimit -s 
and probably increase it.

Ron_Green
Moderator
1.333Aufrufe

Intel Fortran uses stack for temporaries.  Other compilers use heap.  We have the option

-heap-arrays

to allocated temporaries in heap instead of stack.  Try that.  that ulimit -s is another good option, but maybe hard to remember.  Perhaps put that in your .bashrc

Steve_Lionel
Geehrter Beitragender III
1.294Aufrufe

Also keep in mind that ulimit -s does not set the stack size to "unlimited" - rather it uses a maximum value established when the kernel was built.

Antworten