From: jan.de.kruyf@gmail.com
Subject: Re: Change in GCC 5.1.0
Date: Sun, 26 Apr 2015 11:42:02 -0700 (PDT)
Date: 2015-04-26T11:42:02-07:00 [thread overview]
Message-ID: <faf0480b-5dd9-4ae6-ab25-c818193d4191@googlegroups.com> (raw)
In-Reply-To: <lypp6q96jb.fsf@pushface.org>
On Sunday, April 26, 2015 at 6:51:54 PM UTC+2, Simon Wright wrote:
> 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.
Hi Simon,
Just to dampen your expectations a bit:
-------------------
$ gcc --version
gcc (GCC) 4.7.4 20140401 for GNAT GPL gpl-2014 (20140405)
Copyright (C) 2012 Free Software Foundation, Inc.
-------------------
And I had Ada code braking before, that should never have passed the compiler in the first place (shame on me).
On another note: I promised to do a write up on my embedded runtime development.. Well the runtime is going ok, but the laptop with my notes on it was nicked, so I went through the moves of rebuilding my development system etc, the last couple of weeks. The work itself was safe though.
And by the way there is still a fair bit of 32 bit stuff in the present Gnat release for Linux.
So as soon as I see that the board is running ok, i.e. the runtime is reasonably tested, I will try to do a summary.
Cheers,
j.
next prev parent reply other threads:[~2015-04-26 18:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-26 16:51 Change in GCC 5.1.0 Simon Wright
2015-04-26 18:42 ` jan.de.kruyf [this message]
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