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] Fix spurious error on component of overloaded function result


This fixes a weird error given by the compiler on an access attribute applied
to the component of the result of a function call, if the called function
returns an access type designating a record containing the component declared
as aliased, and is overloaded with another function returning another access
type designating also a record containing a second component of the same name
but not declared as aliased.

The compiler wrongly complains that the prefix of the attribute is not declared
as aliased because the check is applied to a random interpretation (depending
on the declaration order among other things) of the overloaded component.  The
fix simply defers the check until after the right interpretation is chosen.

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

gcc/ada/

2017-09-18  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_attr.adb (Analyze_Access_Attribute): Move check for the presence
	of the "aliased" keyword on the prefix from here to...
	(Resolve_Attribute) <Attribute_Access>: ...here.  Remove useless call
	to Check_No_Implicit_Aliasing.
	* sinfo.ads (Non_Aliased_Prefix): Delete.
	(Set_Non_Aliased_Prefix): Likewise.
	* sinfo.adb (Non_Aliased_Prefix): Delete.
	(Set_Non_Aliased_Prefix): Likewise.

gcc/testsuite/

2017-09-18  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/overload.ads, gnat.dg/overload.adb: New testcase.

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]