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]

[Ada] 'Type_Key on subtypes and derived types


This patch fixes a bug in which 'Type_Key on a subtype or derived type
could sometimes access the wrong source buffer. The following test
should compile and run silently.

package P is
   type My_Int is range 1 .. 10;
   for My_Int'Size use 10;
end P;
with P; use P;
package Q is
   type New_My_Int is new My_Int;
   for New_My_Int'Size use 20;
end Q;
with Q; use Q;
package R is
   subtype S is New_My_Int;
end R;
with R; use R;
procedure Main is
   Key : constant String := S'Type_Key;
begin
   null;
end Main;

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-04-27  Bob Duff  <duff@adacore.com>

	* sem_attr.adb (Compute_Type_Key): Don't walk
	representation items for irrelevant types, which could be in a
	different source file.

Attachment: difs
Description: Text document


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