This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/51591] New: Strange output from STOP statement in OpenMP region


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51591

             Bug #: 51591
           Summary: Strange output from STOP statement in OpenMP region
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: longb@cray.com


> cat testc.c
#include <unistd.h>
/*  extern unsigned int sleep (unsigned int __seconds);  */
int sleepc_ (unsigned int *sec)
{
    sleep(*sec);
    return 0;
}

> cat test.f90
  use omp_lib
  implicit none
  integer i
  print *,"Hello World"
  call omp_set_num_threads(5)
!$omp parallel 
!$omp do schedule(static,1)
  do i=1,omp_get_num_threads()
!$omp critical
   print *, "I am",omp_get_thread_num()," of",omp_get_num_threads()
!$omp end critical
   select case (omp_get_thread_num())
    case (0)
      call sleep (1)
      stop 0
    case (1)
      stop 1
    case (2)
      stop 2
    case (3)
      stop 3
    case default
      stop
   end select
  enddo
!$omp end do
!$omp barrier
!$omp end parallel
  end
> cc -c testc.c
> ftn -fopenmp test.f90 testc.o



Sometimes output looks OK:

> aprun -n1 -d5 ./a.out
 Hello World
STOP 1
 I am           1  of           5
 I am           2  of           5
Application 5777837 exit codes: 1
Application 5777837 resources: utime ~0s, stime ~0s

But more often there is some garbled text output:

> aprun -n1 -d5 ./a.out
 Hello World
STOP 1
 I am           1  of           5
0im `m5                               <<<<-----  What's this?
Application 5777838 exit codes: 1
Application 5777838 resources: utime ~0s, stime ~0s

<Nice to see that the STOP 1 results in an exit code of 1, though - new F08
feature.>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]