+2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (return_value_ok_for_nrv_p): Add sanity check.
+
2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c: Include demangle.h.
if (TREE_ADDRESSABLE (ret_val))
return false;
+ /* For the constrained case, test for overalignment. */
if (ret_obj && DECL_ALIGN (ret_val) > DECL_ALIGN (ret_obj))
return false;
+ /* For the unconstrained case, test for bogus initialization. */
+ if (!ret_obj
+ && DECL_INITIAL (ret_val)
+ && TREE_CODE (DECL_INITIAL (ret_val)) == NULL_EXPR)
+ return false;
+
return true;
}
+2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt63.adb: New test.
+
2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/discr47.adb: New test.
--- /dev/null
+-- { dg-do compile }
+-- { dg-options "-O -gnatws" }
+
+procedure Opt63 is
+
+ type T_MOD is mod 2**32;
+ subtype T_INDEX is T_MOD range 3_000_000_000 .. 4_000_000_000;
+ type T_ARRAY is array(T_INDEX range <>) of INTEGER;
+
+ function Build_Crash(First : T_INDEX; Length : NATURAL) return T_ARRAY is
+ R : T_ARRAY(First .. T_Index'Val (T_Index'Pos (First) + Length))
+ := (others => -1); -- Crash here
+ begin
+ return R;
+ end;
+
+begin
+ null;
+end;