public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/57884] New: False positive in libgfortran finalization
@ 2013-07-11 22:29 eugene.zelenko at gmail dot com
  2013-07-11 22:30 ` [Bug sanitizer/57884] " eugene.zelenko at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: eugene.zelenko at gmail dot com @ 2013-07-11 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57884
           Summary: False positive in libgfortran finalization
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eugene.zelenko at gmail dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

Created attachment 30497
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30497&action=edit
Main file which calls FORTRAN procedure

Hi!

My application contains some part of FORTRAN code.

When I tried to compile it with address sanitizer and then run executable, I
got error at the end:

==14628== ERROR: AddressSanitizer: attempting free on address which was not
malloc()-ed: 0x56732c8c
    #0 0x5556c854 (/gcc481/lib/libasan.so.0.0.0+0x16854)
    #1 0x56bf7a20 (/gcc481/lib/libgfortran.so.3.0.0+0xc2a20)
==14628== ABORTING

Problematic code is freeing of FORTRAN wrapper for stdin in raw_close().
Strangely, but same operations for stdout and stderr wrappers were performed
without problem. All three wrappers are created with same fd_to_stream()
function.

This problem is observed with GCC 4.8.0 and 4.8.1 built on Red Hat Enterprise
Linux 5.5 with 32 and 64 bit executables. But same versions of GCC build on Red
Hat Enterprise Linux 6.0 are fine.

Example build script:

!/bin/csh

set echo on

set Mode = "-m32"

set GCCHome = "/gcc481"

$GCCHome/bin/gfortran -std=legacy -g $Mode -fsanitize=address -c zcopy.f -o
zcopy.o
$GCCHome/bin/gcc -g $Mode -fsanitize=address -c main.c -o main.o
$GCCHome/bin/gcc $Mode main.o zcopy.o -lasan -lgfortran -o main.exe

GDB backtrace for:

#7  0x56bf7a21 in raw_close (s=0x56732c8c
<__interceptor_calloc::calloc_memory_for_dlsym+428>) at
/gcc481_src/gcc-4.8.1/libgfortran/io/unix.c:416
#8  0x56bf7462 in sclose (s=<optimized out>) at
/gcc481_src/gcc-4.8.1/libgfortran/io/unix.h:94
#9  close_unit_1 (u=0x56732ae0 <__interceptor_calloc::calloc_memory_for_dlsym>,
locked=locked@entry=1) at /gcc481_src/gcc-4.8.1/libgfortran/io/unit.c:653
#10 0x56bf75da in _gfortrani_close_units () at
/gcc481_src/gcc-4.8.1/libgfortran/io/unit.c:716
#11 0x56b48514 in cleanup () at
/gcc481_src/gcc-4.8.1/libgfortran/runtime/main.c:250
#12 0x56b45808 in __do_global_dtors_aux () from
/home/tammy/gcc481/lib/libgfortran.so.3
#13 0x56c10830 in _fini () from /home/tammy/gcc481/lib/libgfortran.so.3
#14 0x0082580e in _dl_fini () from /lib/ld-linux.so.2
#15 0x00865da9 in exit () from /lib/libc.so.6
#16 0x0084fea4 in __libc_start_main () from /lib/libc.so.6
#17 0x08048561 in _start ()

Eugene.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug sanitizer/57884] False positive in libgfortran finalization
  2013-07-11 22:29 [Bug sanitizer/57884] New: False positive in libgfortran finalization eugene.zelenko at gmail dot com
@ 2013-07-11 22:30 ` eugene.zelenko at gmail dot com
  2013-07-11 22:35 ` eugene.zelenko at gmail dot com
  2014-01-24  8:53 ` y.gribov at samsung dot com
  2 siblings, 0 replies; 4+ messages in thread
From: eugene.zelenko at gmail dot com @ 2013-07-11 22:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Eugene Zelenko <eugene.zelenko at gmail dot com> ---
Created attachment 30498
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30498&action=edit
zcopy FORTRAN procedure from BLAS


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug sanitizer/57884] False positive in libgfortran finalization
  2013-07-11 22:29 [Bug sanitizer/57884] New: False positive in libgfortran finalization eugene.zelenko at gmail dot com
  2013-07-11 22:30 ` [Bug sanitizer/57884] " eugene.zelenko at gmail dot com
@ 2013-07-11 22:35 ` eugene.zelenko at gmail dot com
  2014-01-24  8:53 ` y.gribov at samsung dot com
  2 siblings, 0 replies; 4+ messages in thread
From: eugene.zelenko at gmail dot com @ 2013-07-11 22:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Eugene Zelenko <eugene.zelenko at gmail dot com> ---
Sorry, forgot to add GCC configuration information in original report:

Using built-in specs.
COLLECT_GCC=/gcc481/bin/gcc
COLLECT_LTO_WRAPPER=/gcc481/libexec/gcc/x86_64-redhat-linux/4.8.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: /gcc481_src/gcc-4.8.1/configure --prefix=/gcc481
--enable-shared --enable-threads=posix --enable-checking=release
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--with-linker-hash-style=gnu --enable-languages=c,c++,fortran
--with-tune=generic --build=x86_64-redhat-linux --disable-nls
--with-ld=/binutils/v2.20/bin/ld --with-as=/binutils/v2.20/bin/as
Thread model: posix
gcc version 4.8.1 (GCC)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug sanitizer/57884] False positive in libgfortran finalization
  2013-07-11 22:29 [Bug sanitizer/57884] New: False positive in libgfortran finalization eugene.zelenko at gmail dot com
  2013-07-11 22:30 ` [Bug sanitizer/57884] " eugene.zelenko at gmail dot com
  2013-07-11 22:35 ` eugene.zelenko at gmail dot com
@ 2014-01-24  8:53 ` y.gribov at samsung dot com
  2 siblings, 0 replies; 4+ messages in thread
From: y.gribov at samsung dot com @ 2014-01-24  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

Yury Gribov <y.gribov at samsung dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |y.gribov at samsung dot com

--- Comment #3 from Yury Gribov <y.gribov at samsung dot com> ---
Can't repro with 4.9.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-24  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-11 22:29 [Bug sanitizer/57884] New: False positive in libgfortran finalization eugene.zelenko at gmail dot com
2013-07-11 22:30 ` [Bug sanitizer/57884] " eugene.zelenko at gmail dot com
2013-07-11 22:35 ` eugene.zelenko at gmail dot com
2014-01-24  8:53 ` y.gribov at samsung dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).