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] Incomplete detection of external tag clash


This change fixes the circuitry responsible for enforcing the uniqueness
of 'External_Tag attribute values. Previously uniqueness was checked at
type elaboration time only for types that have an explicit External_Tag
attribute definition clause. However we must also account for the fact
that the default external tag for a type without any such clause may clash
with that of a type with an explicit clause that has been elaborated
previously.

The elaboration of the following unit must cause PROGRAM_ERROR to be raised:

$ gnatmake -z -gnatws default_explicit_ext_tag.ads
$ ./default_explicit_ext_tag

raised PROGRAM_ERROR : duplicated external tag "DEFAULT_EXPLICIT_EXT_TAG.T2"

package Default_Explicit_Ext_Tag is
   type T1 is tagged null record;
   for T1'External_Tag use "DEFAULT_EXPLICIT_EXT_TAG.T2";

   type T2 is tagged null record;
end Default_Explicit_Ext_Tag;

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

2014-07-17  Thomas Quinot  <quinot@adacore.com>

	* exp_disp.adb (Make_DT, Make_VM_TSD): Do not omit Check_TSD
	call for types that do not have an explicit attribute definition
	clause for External_Tag, as their default tag may clash with an
	explicit tag defined for some other type.

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]