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
New Contributor I
1,414 Views

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 Replies
jimdempseyatthecove
Honored Contributor III
1,373 Views

This may be a stack size issue. 

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

 

Jim Dempsey

0 Kudos
rudi-gaelzer
New Contributor I
1,369 Views

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.

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,336 Views

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

 

0 Kudos
S-Poulsen
Novice
1,308 Views

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

0 Kudos
rudi-gaelzer
New Contributor I
1,228 Views

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.

 

0 Kudos
S-Poulsen
Novice
1,190 Views

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).

0 Kudos
rudi-gaelzer
New Contributor I
1,136 Views

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.

 

0 Kudos
rudi-gaelzer
New Contributor I
1,220 Views

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.
0 Kudos
TobiasK
Moderator
1,209 Views

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

0 Kudos
Ron_Green
Moderator
1,110 Views

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

0 Kudos
Steve_Lionel
Honored Contributor III
1,071 Views

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.

Reply