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

seg fault with simple openmp example

donour
Beginner
1,216 Views
The following example segfaults ifort (version Version 8.0 Build 20031016Z Package ID: l_fc_p_8.0.034).

compile command: ifort -openmp crash.f90

--
program main
implicit none

integer :: i
real(8) :: a,b

!$OMP PARALLEL DO
do i = 1, 100000
if (a == b) then
exit
else
a = b
end if
end do
!$OMP END PARALLEL DO
end program main

--

--donour
0 Kudos
9 Replies
Steven_L_Intel1
Employee
1,216 Views
With a current version I get:
fortcom: Error: t.f90, line 10: An EXIT statement is not legal in a DO loop associated with a an OpenMP DO directive.
exit
^
0 Kudos
hayafirst1
Beginner
1,216 Views
Yes, "exit" may be one of the problem in this piece of code. But from Intel's release note, OpenMP does not work with new NPTL. Is there any solution? Thanks.
0 Kudos
Steven_L_Intel1
Employee
1,216 Views
I am not sure what NPTL means, but the release notes give explicit instructions for how to work around the bugs in linuxthreads.
0 Kudos
hayafirst1
Beginner
1,216 Views
Well, NPTL stands for "Native POSIX Thread Library" written by Ulrich Drepper. It's supposed to replace old Linuxthreads. icc 7.1 works for both OpenMP and pthread programs. ifc 8.0 compiles an OpenMP program, but get a segmentation fault when executing, ifc 7.0 cannot compile them with some errors such as "segmentation fault"...
0 Kudos
Steven_L_Intel1
Employee
1,216 Views
I would suggest that you stick to the supported threads libraries as documented in the release notes.
0 Kudos
hayafirst1
Beginner
1,216 Views
Thanks for the advice.
0 Kudos
donour
Beginner
1,216 Views


sblionel wrote:
With a current version I get:
fortcom: Error: t.f90, line 10: An EXIT statement is not legal in a DO loop associated with a an OpenMP DO directive.
exit
^





Really? I don't see anything about it in the OpenMP 2.0 spec.
0 Kudos
donour
Beginner
1,216 Views


sblionel wrote:
With a current version I get:


Current version? I see nothing more recent on the ftp server. Even if the code ISN'T legal, it shouldn't segfault the compiler. right? :)
0 Kudos
Steven_L_Intel1
Employee
1,216 Views
Updated versions aren't on the FTP server. You log into your Premier Support account and they are there. Yes, obviously, an illegal construct should not segfault the compiler.
Although it doesn't mention EXIT by name, I think the following text from the OpenMP standard addresses the issue:

The following restrictions apply to the

DO directives:

It is noncompliant to branch out of a

DO loop associated with a DO directive.

Message Edited by sblionel on 05-04-2004 03:55 PM

0 Kudos
Reply