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 bug in handling of arrays of boolean


Test on i686-linux, committed on trunk.

Code has a fall-through rather than a return, and as a result type of
node was assigned an illegal value for the back-end.

Also: boolean operations apply to arrays of booleans. During the first pass of
type resolution, an aggregate must be considered legal in any context
where a composite type may appear; its expected type is only determined
during the second pass. If the immediate context is a boolean operation,
the aggregate may be legal if the other operand is also an aggregate, or
if it has one interpretation that is a boolean array. Previous code treated
an aggregate as always legal, leading to spurious ambiguities.
The following must compile quietly:
--
procedure P is
   type T1 is record
      A : Integer;
   end record;
   type T2 is array (Positive range <>) of T1;
   function "and" (L, R : T2) return T2 is
   begin
      return (1 => (A => 2));
   end "and";
   X : T2 (1 .. 2) := (others => (A => 0));
   Y : T2 := (1 => (A => 3)) and X;
begin
   null;
end;

2006-02-17  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch4.adb (Find_Boolean_Types): If one of the operands is an
	aggregate, check the interpretations of the other operand to find one
	that may be a boolean array.
	(Analyze_Selected_Component): Fix flow-of-control typo in case where
	the prefix is a private extension.

Attachment: difs.1
Description: Text document


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