From: Simon Wright <simon@pushface.org>
Subject: Change in GCC 5.1.0
Date: Sun, 26 Apr 2015 17:51:52 +0100
Date: 2015-04-26T17:51:52+01:00 [thread overview]
Message-ID: <lypp6q96jb.fsf@pushface.org> (raw)
GCC 4.9.1 (and presumably GNAT GPL 2014) allowed variable indexing on a
Set, even though there was no Variable_Indexing aspect in the spec.
GCC 5.1.0 doesn't.
So this code (from Gprbuild GPL 2014) compiled and, presumably, worked
when it shouldn't have:
with Ada.Containers.Ordered_Sets;
procedure Iteration is
type Slave is new Integer;
package Slave_S is new Ada.Containers.Ordered_Sets
(Element_Type => Slave);
Pool : Slave_S.Set;
procedure Iterate (Proc : access procedure (S : in out Slave)) is
begin
for C in Pool.Iterate loop
declare
S : Slave := Slave_S.Element (C);
begin
Proc (S);
Pool (C) := S; -- <<<<<<<<<<<<<<< wrong
end;
end loop;
end Iterate;
begin
null;
end Iteration;
The thing about an (ordered) set is that replacing an element must
involve re-ordering the set, in case the element's position has
changed. So the compilable code in this case is
Pool.Replace_Element (C, S);
That said, that looks awfully like tampering to me (if the order
changes, anyway). I await Gprbuild GPL 2015 with interest.
next reply other threads:[~2015-04-26 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-26 16:51 Simon Wright [this message]
2015-04-26 18:42 ` Change in GCC 5.1.0 jan.de.kruyf
2015-04-27 7:23 ` Dmitry A. Kazakov
2015-04-27 8:07 ` jan.de.kruyf
2015-05-06 21:29 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox