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 bound computation in packed arrays


Tested on i686-linux, committed on trunk

If the two operands are arrays with different bounds, the result has the
bounds of the left operand. The code incorrectly performed a conversion
of the result to the subtype of the right operand instead.
The output of the following program must be:
--
 1TRUE 2TRUE 3TRUE 4TRUE 5TRUE
--
with ada.Text_IO;
procedure proc is
   type T is array (Positive range <>) of Boolean;
   pragma Pack (T);
   A :          T := (1 .. 5 => True);
   B :          T := (6 .. 10 => False);
   C : constant T := A xor B;
begin
   for I in C'range loop
      ada.Text_IO.put(integer'image(i) & boolean'image(c(i)));
   end loop;
end proc;

2007-04-06  Ed Schonberg  <schonberg@adacore.com>

	* exp_pakd.adb (Expand_Packed_Boolean_Operator): The bounds of the
	result are the bounds of the left operand, not the right.

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]