r260663 - in /trunk/gcc/ada: ChangeLog sem_ch8.adb

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Thu May 24 13:06:00 GMT 2018


Author: pmderodat
Date: Thu May 24 13:06:21 2018
New Revision: 260663

URL: https://gcc.gnu.org/viewcvs?rev=260663&root=gcc&view=rev
Log:
[Ada] Infinite loop in the compiler when warning on redundant constructs

This patch fixes an infinite loop in the compiler when warnings on redundant
constructs are enabled (-gnatwr) and the constructs are use_type clauses
that appear (redundantly) in a parent unit and a child unit.

The following command:

   gcc -c -gnatwr root-child.ads

must yield:

   root-child.ads:2:01: warning: "Pack.Typ" is already use-visible through
   previous use_type_clause at root.ads:2

The following must compile quietly:

   gcc -c -gnatwr root-child-grand.ads

----
package Pack is
  type Typ is new Integer;
end Pack;
----
with Pack;
use type Pack.Typ;
package Root is
  Thing1 : Pack.Typ;
end Root;
----
with pack;
use type pack.typ;
package Root.Child is
  Thing2 : Pack.Typ := Root.Thing1 * 3;
end;
----
with Pack;
use type Pack.Typ;
package Root.Child.Grand is
  Thing3 : Pack.Typ := Thing1 + Thing2;
end;

2018-05-24  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch8.adb (Analyze_Use_Type): Do not assign the Prev_Use_Clause
	link to a use_type clause if this would cause an infinite loop in the
	machinery that detects redundant use clauses. This may happen when the
	redundant clauses appear in the context of a child unit and the context
	of its parent.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/sem_ch8.adb



More information about the Gcc-cvs mailing list