r275956 - in /trunk/gcc/ada: ChangeLog exp_util...
pmderodat@gcc.gnu.org
pmderodat@gcc.gnu.org
Thu Sep 19 08:14:00 GMT 2019
Author: pmderodat
Date: Thu Sep 19 08:14:47 2019
New Revision: 275956
URL: https://gcc.gnu.org/viewcvs?rev=275956&root=gcc&view=rev
Log:
[Ada] Get rid of useless temporary for slice in overaligned record type
This fixes a recent code quality regression for targets that do not
require the strict alignment of memory accesses: the compiler would
generate a useless temporary for a slice of an array component in an
overaligned record type.
Running these commands:
gcc -c p.adb -gnatws -gnatD
grep loop p.adb.dg
On the following sources:
procedure P (N : Positive) is
type Rec1 is record
I : Integer;
end record;
type Arr is array (Positive range <>) of Rec1;
type Rec2 is record
A : Arr (1 .. 128);
end record;
for Rec2'Alignment use 8;
procedure Proc (A : Arr) is
begin
null;
end;
R : Rec2;
begin
Proc (R.A (1 .. N));
end;
Should execute silently.
2019-09-19 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_util.adb (Is_Possibly_Unaligned_Slice): Do not return true
on pure alignment considerations if the target does not require
the strict alignment of memory accesses.
Modified:
trunk/gcc/ada/ChangeLog
trunk/gcc/ada/exp_util.adb
More information about the Gcc-cvs
mailing list