This is a regression present on the mainline and 6 branch: the compiler stops
on the renaming of the 'Pred or 'Succ attribute of a fixed-point type.
Tested on x86_64-suse-linux, applied on the mainline and 6 branch.
2016-06-13 Eric Botcazou <ebotca...@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Deal with
PLUS_EXPR in the expression of a renaming.
2016-06-13 Eric Botcazou <ebotca...@adacore.com>
* gnat.dg/renaming10.ad[sb]: New test.
--
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 237324)
+++ gcc-interface/decl.c (working copy)
@@ -1003,6 +1003,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
&& !call_is_atomic_load (inner))
|| TREE_CODE (inner) == ADDR_EXPR
|| TREE_CODE (inner) == NULL_EXPR
+ || TREE_CODE (inner) == PLUS_EXPR
|| TREE_CODE (inner) == CONSTRUCTOR
|| CONSTANT_CLASS_P (inner)
/* We need to detect the case where a temporary is created to
package Renaming10 is
type Rec is record
Position : Natural;
end record;
function F (Input : Rec) return Natural;
end Renaming10;
-- { dg-do compile }
package body Renaming10 is
function F (Input : Rec) return Natural is
Position : Natural renames Input.Position;
Index : Natural renames Natural'Succ(Position);
begin
return Index;
end;
end Renaming10;