From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61699 invoked by alias); 8 Apr 2015 11:16:20 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 61663 invoked by uid 48); 8 Apr 2015 11:16:13 -0000 From: "demoonlit at panathenaia dot halfmoon.jp" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/65696] New: ASAN reports global-buffer-overrun for local tagged types Date: Wed, 08 Apr 2015 11:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: demoonlit at panathenaia dot halfmoon.jp X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg00549.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65696 Bug ID: 65696 Summary: ASAN reports global-buffer-overrun for local tagged types Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: demoonlit at panathenaia dot halfmoon.jp package pkg_a is type Root is tagged null record; end pkg_a; with pkg_a; procedure main is type Derived is new pkg_a.Root with null record; begin null; end main; % gnatmake main.adb -cargs -fsanitize=address -largs -lasan.1 gcc -c -fsanitize=address main.adb gcc -c -fsanitize=address pkg_a.ads gnatbind -x main.ali gnatlink main.ali -lasan.1 % ./main ================================================================= ==78928==ERROR: AddressSanitizer: unknown-crash on address 0x0001000174c8 at pc 0x10000303d bp 0x7fff5fbfed10 sp 0x7fff5fbfed08 READ of size 120 at 0x0001000174c8 thread T0 #0 0x10000303c (main+0x10000303c) #1 0x1000023d4 (main+0x1000023d4) #2 0x1000019d7 (main+0x1000019d7) #3 0x0 (main+0x0) 0x000100017510 is located 0 bytes to the right of global variable 'pkg_a__rootR38s___UNC' from 'pkg_a.ads' (0x1000174c0) of size 80 SUMMARY: AddressSanitizer: unknown-crash ??:0 ?? Shadow bytes around the buggy address: 0x100020002e40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020002e50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020002e60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020002e70: 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 f9 0x100020002e80: 00 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00 =>0x100020002e90: 00 00 f9 f9 f9 f9 f9 f9 00[00]00 00 00 00 00 00 0x100020002ea0: 00 00 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x100020002eb0: 00 00 00 00 00 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 0x100020002ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020002ed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100020002ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Contiguous container OOB:fc ASan internal: fe ==78928==ABORTING Perhaps, a cause is the implicit code for making a child type's dispatching table. The size of copying of a parent type's predefined primitives to a child's is Max_Predef_Prims (15), but the real number of a parent type's predefined primitives seems 9.