This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Wrong RTL instruction deleted
* Robert Dewar:
> Florian Weimer wrote:
>> * Robert Dewar:
>
>> Using -fno-strict-aliasing throws away a lot of the additional
>> information the Ada front end can provide, compared to equivalent C
>> code. 8-(,
>
> I know this is true theoretically, but I am dubious as to whether this
> is true in practice. The only datapoint we have from a large customer
> (whose code does not work in the absence of -fno-strict-aliasing, a
> common state of affairs unfortunately), was that -O2 indeed had a
> very significant gain over -01, but the loss in using -O2 with
> -fno-strict-aliasing was negligible in comparison.
You are cheating in the -fno-strict-aliasing case. 8-)
If I compile the following code with "-O2 -fno-strict-aliasing" and
GCC 3.4.3, the array bounds are not reloaded from the stack, i.e. the
case where the array aliases its dope isn't handled correctly (as it
would have to be if this where C in non-strict aliasing mode).
procedure Clear (S : out String) is
begin
for J in S'Range loop
S (J) := ' ';
end loop;
end Clear;
This also happens in more elaborate examples with multiple
unconstraint array arguments.