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] Remove spurious error in -gnatc mode


Tested on i686-linux, committed on mainline.

In normal compilation mode, implicit dereferences are made explicit during
expansion, but when compiling in ASIS mode this replacement is not done.
The predicate Is_Object_Reference was ignoring implicit dereferences, and
rejecting a legal renaming of a selected component whose prefix is an
implicit dereference of a value conversion of a pointer.
The following must compile quietly:
--
gcc -c -gnatc p.adb

package P is
  type T is private;
  procedure Get (Obj : T);
private
  type Abstract_T is abstract tagged limited null record;
  type T is access all Abstract_T'Class;
end P;

package body P is
  type Val is (Yes, No);
  type Record_T is new Abstract_T with record Comp : Val; end record;
  type Ptr is access all Record_T;

  procedure Get (Obj : T) is
    Comp1 : Val renames Ptr (Obj).Comp;
  begin
    null;
  end;
end P;

2005-07-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (Is_Object_Reference): An indexed or selected component
	whose prefix is an implicit dereference is an object reference. Removes
	spurious errors when compiling with -gnatc.

Attachment: difs.22
Description: Text document


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