public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/55617] New: static constructors are not being instrumented correctly on darwin
@ 2012-12-07 14:47 howarth at nitro dot med.uc.edu
  2012-12-07 14:49 ` [Bug sanitizer/55617] " howarth at nitro dot med.uc.edu
                   ` (53 more replies)
  0 siblings, 54 replies; 55+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-12-07 14:47 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55617
           Summary: static constructors are not being instrumented
                    correctly on darwin
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: howarth@nitro.med.uc.edu
                CC: dodji@gcc.gnu.org, dvyukov@gcc.gnu.org,
                    jakub@gcc.gnu.org, kcc@gcc.gnu.org


A couple hundred failures in the g++ testsuite with -fsanitize=address on
darwin appear to be due to static constructors not being instrumented
correctly. For example...

% g++-fsf-4.8 covariant3.C -fmessage-length=0 -std=c++98 -pedantic-errors
-Wno-long-long -g -multiply_defined suppress -lm -fsanitize=address -o
./covariant3.exe

produces a executable that crashes due to the missing calls to __asan_init
before the  module's static constructors...

% gdb ./covariant3.exe
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug  5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared
libraries ...... done

(gdb) r
Starting program: /Users/howarth/asan_g++_failures/covariant3.exe 
Reading symbols for shared libraries +++++.................................
done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000010002000068a
0x0000000100001e60 in c1::c1 (this=0x100003d08, __vtt_parm=0x100003450) at
covariant3.C:10
10    struct c1 : virtual c0 {
(gdb) bt
#0  0x0000000100001e60 in c1::c1 (this=0x100003d08, __vtt_parm=0x100003450) at
covariant3.C:10
#1  0x0000000100001f1c in c18::c18 (this=0x100003d00) at covariant3.C:29
#2  0x0000000100001cdc in __static_initialization_and_destruction_0
(__initialize_p=1, __priority=65535) at covariant3.C:42
#3  0x0000000100001cf1 in _GLOBAL__sub_I_covariant3.C () at covariant3.C:85
#4  0x00007fff5fc13378 in
__dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE
()
#5  0x00007fff5fc13762 in
__dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE
()
#6  0x00007fff5fc1006e in
__dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE
()
#7  0x00007fff5fc0feba in
__dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE
()
#8  0x00007fff5fc01fc0 in __dyld__ZN4dyld24initializeMainExecutableEv ()
#9  0x00007fff5fc05b04 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_Pm
()
#10 0x00007fff5fc01397 in
__dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_Pm ()
#11 0x00007fff5fc0105e in __dyld__dyld_start ()
(gdb) 

The assembly file and a gdb log which stepi's from the 38th breakpoint of
__dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE
is attached.


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

end of thread, other threads:[~2013-02-11 22:36 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-07 14:47 [Bug sanitizer/55617] New: static constructors are not being instrumented correctly on darwin howarth at nitro dot med.uc.edu
2012-12-07 14:49 ` [Bug sanitizer/55617] " howarth at nitro dot med.uc.edu
2012-12-07 14:50 ` howarth at nitro dot med.uc.edu
2012-12-07 15:44 ` howarth at nitro dot med.uc.edu
2012-12-08  3:25 ` howarth at nitro dot med.uc.edu
2013-01-29  9:50 ` glider at google dot com
2013-01-29  9:59 ` glider at google dot com
2013-01-29 11:56 ` glider at google dot com
2013-01-29 22:05 ` howarth at nitro dot med.uc.edu
2013-01-29 22:15 ` howarth at nitro dot med.uc.edu
2013-01-30 12:29 ` glider at google dot com
2013-01-30 14:24 ` howarth at nitro dot med.uc.edu
2013-01-30 14:33 ` glider at google dot com
2013-01-30 14:42 ` jakub at gcc dot gnu.org
2013-01-30 15:57 ` howarth at nitro dot med.uc.edu
2013-01-30 16:29 ` howarth at nitro dot med.uc.edu
2013-01-30 16:31 ` howarth at nitro dot med.uc.edu
2013-01-30 16:32 ` jakub at gcc dot gnu.org
2013-01-30 16:36 ` kcc at gcc dot gnu.org
2013-01-30 16:43 ` jakub at gcc dot gnu.org
2013-01-30 17:08 ` glider at google dot com
2013-01-30 17:30 ` glider at google dot com
2013-01-30 23:41 ` howarth at nitro dot med.uc.edu
2013-01-31 22:02 ` howarth at nitro dot med.uc.edu
2013-01-31 22:23 ` howarth at nitro dot med.uc.edu
2013-01-31 22:26 ` howarth at nitro dot med.uc.edu
2013-02-01  2:30 ` howarth at nitro dot med.uc.edu
2013-02-01  2:34 ` howarth at nitro dot med.uc.edu
2013-02-01  3:00 ` howarth at nitro dot med.uc.edu
2013-02-01  5:52 ` howarth at nitro dot med.uc.edu
2013-02-01  7:31 ` jakub at gcc dot gnu.org
2013-02-01 16:47 ` howarth at nitro dot med.uc.edu
2013-02-01 21:23 ` howarth at nitro dot med.uc.edu
2013-02-01 21:45 ` howarth at nitro dot med.uc.edu
2013-02-01 22:20 ` jakub at gcc dot gnu.org
2013-02-02  5:51 ` howarth at nitro dot med.uc.edu
2013-02-02  8:47 ` jakub at gcc dot gnu.org
2013-02-02 15:32 ` howarth at nitro dot med.uc.edu
2013-02-02 15:39 ` jakub at gcc dot gnu.org
2013-02-02 18:17 ` howarth at nitro dot med.uc.edu
2013-02-02 19:20 ` mrs at gcc dot gnu.org
2013-02-02 20:11 ` howarth at nitro dot med.uc.edu
2013-02-02 20:12 ` howarth at nitro dot med.uc.edu
2013-02-02 20:20 ` howarth at nitro dot med.uc.edu
2013-02-02 20:41 ` howarth at nitro dot med.uc.edu
2013-02-02 22:54 ` howarth at nitro dot med.uc.edu
2013-02-03  0:10 ` howarth at nitro dot med.uc.edu
2013-02-03 15:17 ` howarth at nitro dot med.uc.edu
2013-02-04 10:11 ` glider at google dot com
2013-02-04 10:14 ` glider at google dot com
2013-02-04 17:25 ` howarth at nitro dot med.uc.edu
2013-02-04 20:08 ` mrs at gcc dot gnu.org
2013-02-04 21:08 ` mrs at gcc dot gnu.org
2013-02-04 21:11 ` mrs at gcc dot gnu.org
2013-02-11 22:36 ` mrs at gcc dot gnu.org

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).