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

Steve Kargl <kargl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Multiple testsuite failures |Sanitizer broken on
                   |with gfortran on FreeBSD    |FreeBSD: Was: Multiple
                   |                            |testsuite failures with
                   |                            |gfortran on FreeBSD

--- Comment #1 from Steve Kargl <kargl at gcc dot gnu.org> ---
The following code is simply a declaration statement.

% cat zse.f90
program grow_type_array

   implicit none

   type container
      integer, allocatable :: arr(:)
   end type container

end program grow_type_array

%  gfcx --version
GNU Fortran (GCC) 17.0.0 20261113 (experimental)
% gfcx -o z -O0 -fsanitize=address -g zse.f90 ./z
AddressSanitizer:DEADLYSIGNAL
=================================================================
==42357==ERROR: AddressSanitizer: BUS on unknown address (pc 0x0008010a4535 bp
0x20003ffffffffff0 sp 0x7fffffffadf8 T0)
==42357==The signal is caused by a READ memory access.
==42357==Hint: this fault was caused by a dereference of a high value address
(see register values below).  Disassemble the provided pc to learn which
register was used.
    #0 0x0008010a4535  (/lib/libc.so.7+0x16a535)

==42357==Register values:
rax = 0x20003ffffffffff0  rbx = 0x2000400000000000  rcx = 0x0000000000000010 
rdx = 0x0000000000000010  
rdi = 0x20003ffffffffff0  rsi = 0x0000000000000000  rbp = 0x20003ffffffffff0 
rsp = 0x00007fffffffadf8  
 r8 = 0x0000000000000000   r9 = 0x00004fffffffbe00  r10 = 0x0000000000000000 
r11 = 0x0000000000000202  
r12 = 0x0000000000000010  r13 = 0x00007fffffffb748  r14 = 0x0000000000000000 
r15 = 0x00007fffffffd1b0  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: BUS (/lib/libc.so.7+0x16a535) 
==42357==ABORTING

% gdb151 ./z
(gdb) run
...
Program received signal SIGBUS, Bus error.
Object-specific hardware error.
memset () at /usr/src/lib/libc/amd64/string/memset.S:142
142             MEMSET erms=0
(gdb) bt
#0  memset () at /usr/src/lib/libc/amd64/string/memset.S:142
#1  0x00000008004f9801 in __asan::FastPoisonShadow (aligned_beg=<optimized
out>, 
    aligned_size=<optimized out>, value=0 '\000')
    at ../../../../gcc/libsanitizer/asan/asan_poisoning.h:71
#2  __asan::AsanThread::ClearShadowForThreadStackAndTLS
(this=this@entry=0x8013bc000)
    at ../../../../gcc/libsanitizer/asan/asan_thread.cpp:327
...

% head -75 ~/gcc/gcc/libsanitizer/asan/asan_poisoning.h | tail -11
  // FIXME: Page states are different on Windows, so using the same interface
  // for mapping shadow and zeroing out pages doesn't "just work", so we should
  // probably provide higher-level interface for these operations.
  // For now, just memset on Windows.
  if (value || SANITIZER_WINDOWS == 1 ||
      shadow_end - shadow_beg < common_flags()->clear_shadow_mmap_threshold) {
    REAL(memset)((void*)shadow_beg, value, shadow_end - shadow_beg);
  } else {
    uptr page_size = GetPageSizeCached();
    uptr page_beg = RoundUpTo(shadow_beg, page_size);
    uptr page_end = RoundDownTo(shadow_end, page_size);

Apparently, FreeBSD is not linux.

Reply via email to