https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68887

            Bug ID: 68887
           Summary: [6 regression] gfortran.dg/coarray/event_[12].f90
                    -fcoarray=lib  -O2  -lcaf_single -latomic fails
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ebotcazou at gcc dot gnu.org
  Target Milestone: ---

The tests fail both on SPARC/Solaris and SPARC64/Solaris:

FAIL: gfortran.dg/coarray/event_1.f90 -fcoarray=lib  -O2  -lcaf_single -latomic
execution test
FAIL: gfortran.dg/coarray/event_2.f90 -fcoarray=lib  -O2  -lcaf_single -latomic
execution test

Reduced testcase:

use iso_fortran_env, only: event_type
implicit none

type(event_type), save :: var[*]
integer :: count, stat

count = -42
call event_query (var, count)
if (count /= 0) call abort()
end

The reduced testcase passes on x86-64/Linux but valgrind complains:

eric@polaris:~/build/gcc/native> valgrind ./event_1 ==30564== Memcheck, a
memory error detector
==30564== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==30564== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==30564== Command: ./event_1
==30564== 
==30564== Invalid read of size 4
==30564==    at 0x402E50: _gfortran_caf_event_query (single.c:1110)
==30564==    by 0x40156C: MAIN__ (in /home/eric/build/gcc/native/event_1)
==30564==    by 0x4015C7: main (in /home/eric/build/gcc/native/event_1)
==30564==  Address 0x6072340 is 0 bytes inside a block of size 1 alloc'd
==30564==    at 0x4C2B200: calloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==30564==    by 0x4016E1: _gfortran_caf_register (single.c:106)
==30564==    by 0x401526: _caf_init.1.3446 (in
/home/eric/build/gcc/native/event_1)
==30564==    by 0x40312C: __libc_csu_init (elf-init.c:88)
==30564==    by 0x5ACCA94: (below main) (in /lib64/libc-2.19.so)

Reply via email to