works only with WRITE(*,*)

works only with WRITE(*,*)

dear all,I wrote e fortran code that use listes and pointers.It is:

DO

jp =   LISTPART(ii,jj)%current%value

   IF(.NOT. dlist_move_next(LISTPART(ii,jj))) EXIT
   CALL KERNEL(rp(:,ip),rp(:,jp),lij,W,dW,xij,tk)

   r = SQRT( (rp(1,ip)-rp(1,jp))**2.d0 + (rp(2,ip)-rp(2,jp))**2.d0)
ENDDO
it does not work, I get asegmentation fault.The strange things is that if I use a WRITE in the do cycle like
WRITE(*,*) R
it workscould someone explam me why?is it a unix problem?thanks a lot to everyone

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

When you insert a WRITE statement into the middle of a block of code, and the program behavior changes, it is most often because the code is buggy. A WRITE statement may inhibit certain optimizations, and/or change the way in which the bug manifests itself.

A worse situation is one in which the program seems to work correctly for a long time, and insertion of a WRITE statement breaks the program.

You have to locate the segmentation fault and trace back to the causes of the segmentation fault. Such a task can be sometimes very difficult and time-consuming, especially if the size of the code is appreciable and someone else wrote the code.

I have no idea as to what you mean by "Unix problem". A standard-conforming Fortran program should work on any supported/supporting platform.

Are/is dlist_move_next and/or KERNEL recursive?

Does the error occur in debug build?

Have you tried adding the diagnostics? (gen-interfaces, uninitialized variables, and subscript error checking)

Jim Dempsey

www.quickthreadprogramming.com

dear you,thank you, I found the error. It was a wrong allocation in Kernel subroutine.a question, what do you mean for diagnostics?is it a way to compile in order to understand if there are some error?thanks a lot

I am not in my Linux environment now, the Windows options of interest are:
(Linux options may have different spelling but same functionality present)

-check:bounds (array subscripts out of bounds testing)
-check:uninit(uninitialized (scalar) variables, arrays are not tested)
-gen-interfaces (generates .MOD files with sub/fun interfaces)
-warn:interfaces (uses .MOD files with sub/fun interfaces and verifies callers)

if compiling fixe format also consider

-warn:truncated_source (fixed souce defaults to 72 columns w/ no warning on truncation)

The correct compiler options should be listed in the documentation.

On Windows

ifort -?

displays the command line options. It may do the same thing on Linux.

Jim Dempsey

www.quickthreadprogramming.com

Leave a Comment

Please sign in to add a comment. Not a member? Join today