* gcc-interface/utils2.c (gnat_invariant_expr): Add type conversions.
From-SVN: r231063
This commit is contained in:
parent
14ecca2eea
commit
f8125f0c9c
5 changed files with 34 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
2015-11-30 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/utils2.c (gnat_invariant_expr): Add type conversions.
|
||||
|
||||
2015-11-30 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/ada-tree.h (TYPE_MAX_ALIGN): New macro.
|
||||
|
|
|
@ -2860,7 +2860,9 @@ gnat_invariant_expr (tree expr)
|
|||
tree op0 = gnat_invariant_expr (TREE_OPERAND (expr, 0));
|
||||
tree op1 = TREE_OPERAND (expr, 1);
|
||||
if (op0 && TREE_CONSTANT (op1))
|
||||
return fold_build2 (TREE_CODE (expr), type, op0, op1);
|
||||
return
|
||||
fold_build2 (TREE_CODE (expr), type,
|
||||
fold_convert (type, op0), fold_convert (type, op1));
|
||||
else
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2015-11-30 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/loop_optimization22.ad[sb]: New test.
|
||||
|
||||
2015-11-30 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/specs/rep_clause5.ads: New test.
|
||||
|
|
16
gcc/testsuite/gnat.dg/loop_optimization22.adb
Normal file
16
gcc/testsuite/gnat.dg/loop_optimization22.adb
Normal file
|
@ -0,0 +1,16 @@
|
|||
-- { dg-do compile }
|
||||
-- { dg-options "-O" }
|
||||
|
||||
pragma Overflow_Mode (Minimized);
|
||||
|
||||
package body Loop_Optimization22 is
|
||||
|
||||
procedure Foo (X : Discrim_Type) is
|
||||
H : array (1 .. Integer (X.Count) + 1) of Float;
|
||||
begin
|
||||
for I in 1 .. X.Count loop
|
||||
H (Integer(I) + 1):= 0.0;
|
||||
end loop;
|
||||
end;
|
||||
|
||||
end Loop_Optimization22;
|
7
gcc/testsuite/gnat.dg/loop_optimization22.ads
Normal file
7
gcc/testsuite/gnat.dg/loop_optimization22.ads
Normal file
|
@ -0,0 +1,7 @@
|
|||
package Loop_Optimization22 is
|
||||
|
||||
type Discrim_Type (Count : Positive) is null record;
|
||||
|
||||
procedure Foo (X : Discrim_Type);
|
||||
|
||||
end Loop_Optimization22;
|
Loading…
Add table
Reference in a new issue