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 wrong warning with -gnatc


Tested on x86-linux, committed on mainline.

A read reference on the prefix of an implicit dereference is normally
generated during expansion, when the implicit dereference is rewritten
to an explicit one by Sem_Util.Insert_Explicit_Dereference. When operating
under -gnatc, this expansion never occurs, and so the reference must be
generated earlier in the semantic analysis phase in that case.

Test case must be accepted with no errors and no warnings
when compiled under -gnatwa, with and without -gnatc.
--
procedure P is
   type R is record I : Integer; end record;
   type AR is access all R;
   type A is array (Integer range 0 .. 0) of Integer;
   type AA is access all A;

   ARX : AR; AAX : AA;
   BRX : AR; BAX : AA;

begin
   ARX := new R; ARX.I := 0;
   AAX := new A; AAX (0) := 0;
   BRX := new R; BRX.all.I := 0;
   BAX := new A; BAX.all (0) := 0;
end P;

2004-12-07  Thomas Quinot  <quinot@adacore.com>

	* sem_ch4.adb (Process_Implicit_Dereference_Prefix): New subprogram
	used to record an implicit dereference as a read operation on its
	prefix when operating under -gnatc. Necessary to avoid spurious
	'variable assigned but never read' warnings in that mode.
	(Process_Indexed_Component, Analyze_Selected_Component): When the prefix
	is a non-overloaded implicit dereference, call the above subprogram to
	ensure proper recording of references.

Attachment: difs.20
Description: Text document


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