+2009-01-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Really strip
+ only useless conversions around renamed objects.
+
2009-01-11 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Put
== RECORD_TYPE
&& TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0))))
/* Strip useless conversions around the object. */
- || TREE_CODE (gnu_expr) == NOP_EXPR)
+ || (TREE_CODE (gnu_expr) == NOP_EXPR
+ && gnat_types_compatible_p
+ (TREE_TYPE (gnu_expr),
+ TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))))
{
gnu_expr = TREE_OPERAND (gnu_expr, 0);
gnu_type = TREE_TYPE (gnu_expr);
+2009-01-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/unchecked_convert3.adb: New test.
+
2009-01-12 Jakub Jelinek <jakub@redhat.com>
PR c++/38794
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-gnatVa" }
+
+with Unchecked_Conversion;
+
+procedure Unchecked_Convert3 is
+
+ type Word is range -(2**15) .. (2**15) - 1;
+ type UWord is mod (2**16);
+
+ function To_Word is new unchecked_conversion (UWord, Word);
+
+ function F return UWord is
+ begin
+ return 65036;
+ end;
+
+ W : Word := To_Word(F);
+
+begin
+ null;
+end;