mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-05 07:40:28 +08:00
utils2.c (gnat_invariant_expr): Return null if the type of the expression ends up being composite.
* gcc-interface/utils2.c (gnat_invariant_expr): Return null if the type of the expression ends up being composite. From-SVN: r221449
This commit is contained in:
parent
261cb0d3eb
commit
61e0b23353
@ -1,3 +1,8 @@
|
||||
2015-03-16 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/utils2.c (gnat_invariant_expr): Return null if the type
|
||||
of the expression ends up being composite.
|
||||
|
||||
2015-03-16 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/decl.c (is_from_limited_with_of_main): New predicate.
|
||||
|
@ -2805,6 +2805,12 @@ gnat_invariant_expr (tree expr)
|
||||
expr = remove_conversions (expr, false);
|
||||
}
|
||||
|
||||
/* We are only interested in scalar types at the moment and, even if we may
|
||||
have gone through padding types in the above loop, we must be back to a
|
||||
scalar value at this point. */
|
||||
if (AGGREGATE_TYPE_P (TREE_TYPE (expr)))
|
||||
return NULL_TREE;
|
||||
|
||||
if (TREE_CONSTANT (expr))
|
||||
return fold_convert (type, expr);
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-03-16 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/loop_optimization18.ad[sb]: New test.
|
||||
* gnat.dg/loop_optimization18_pkg.ads: New helper.
|
||||
|
||||
2015-03-16 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* gcc.target/powerpc/pr53199.c: Add extra functions. Revert
|
||||
|
16
gcc/testsuite/gnat.dg/loop_optimization18.adb
Normal file
16
gcc/testsuite/gnat.dg/loop_optimization18.adb
Normal file
@ -0,0 +1,16 @@
|
||||
-- { dg-do compile }
|
||||
-- { dg-options "-O3" }
|
||||
|
||||
package body Loop_Optimization18 is
|
||||
|
||||
procedure Proc (Message : Byte_Array_Type) is
|
||||
|
||||
R : Rec (Conv (Message));
|
||||
|
||||
begin
|
||||
for Division in 1 .. R.UB loop
|
||||
R.L (Division) := 0;
|
||||
end loop;
|
||||
end;
|
||||
|
||||
end Loop_Optimization18;
|
7
gcc/testsuite/gnat.dg/loop_optimization18.ads
Normal file
7
gcc/testsuite/gnat.dg/loop_optimization18.ads
Normal file
@ -0,0 +1,7 @@
|
||||
with Loop_Optimization18_Pkg; use Loop_Optimization18_Pkg;
|
||||
|
||||
package Loop_Optimization18 is
|
||||
|
||||
procedure Proc (Message : Byte_Array_Type);
|
||||
|
||||
end Loop_Optimization18;
|
15
gcc/testsuite/gnat.dg/loop_optimization18_pkg.ads
Normal file
15
gcc/testsuite/gnat.dg/loop_optimization18_pkg.ads
Normal file
@ -0,0 +1,15 @@
|
||||
with Unchecked_Conversion;
|
||||
|
||||
package Loop_Optimization18_Pkg is
|
||||
|
||||
type Arr is array (Integer range <>) of Natural;
|
||||
|
||||
type Rec (UB : Integer) is record
|
||||
L : Arr (1 .. UB);
|
||||
end record;
|
||||
|
||||
type Byte_Array_Type is new String (1..4);
|
||||
|
||||
function Conv is new Unchecked_Conversion (Byte_Array_Type, Integer);
|
||||
|
||||
end Loop_Optimization18_Pkg;
|
Loading…
x
Reference in New Issue
Block a user