This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/65696] New: ASAN reports global-buffer-overrun for local tagged types
- From: "demoonlit at panathenaia dot halfmoon.jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 Apr 2015 11:16:11 +0000
- Subject: [Bug ada/65696] New: ASAN reports global-buffer-overrun for local tagged types
- Auto-submitted: auto-generated
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.