This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][PR ada/65696] ASAN reports global-buffer-overrun for local tagged types


Hello.

This PR is fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65696 .
The cause is that the implicit generated code for making non-static DT is
copying the number Max_Predef_Prims of the predefined primitives from the
parent type, but the real number is smaller than.
AddressSanitizer can find it as an error. That hasn’t changed since gcc 4.8.

I have tried this patch for a long while with from gcc 4.8 to 7, and
succeeded to compile the trunk.

This attached patch is same as “Comment 2” except adjusting the indent.

Is it OK?
Thank you.

gcc/ada/Changelog:

	PR ada/65696
	* exp_atag.ads, exp_atag.adb (Build_Inherit_Predefined_Prims):
	  Add new formal parameter Num_Predef_Prims for copying predefined primitives.
	* exp_disp.adb (Make_DT):
	  Use the counted number of predefined primitives as Cp_Predef_Prims
	  instead of Max_Predef_Prims for making non-static inherited DT.

Attachment: patch-asan-1.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]