From: Eric Botcazou Date: Thu, 10 Dec 2015 14:06:15 +0000 (+0000) Subject: trans.c (Call_to_gnu): Remove guard for NULL_EXPR. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d747d0057c694f600da48ff11a0cf6b10aea9dbf;p=gcc.git trans.c (Call_to_gnu): Remove guard for NULL_EXPR. * gcc-interface/trans.c (Call_to_gnu): Remove guard for NULL_EXPR. * gcc-interface/utils2.c (gnat_rewrite_reference) : Return the reference unmodified. : New case. Likewise. From-SVN: r231513 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 955f036ce0d..10758ff1cb5 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2015-12-10 Eric Botcazou + + * gcc-interface/trans.c (Call_to_gnu): Remove guard for NULL_EXPR. + * gcc-interface/utils2.c (gnat_rewrite_reference) : Return + the reference unmodified. + : New case. Likewise. + 2015-12-10 Eric Botcazou * gcc-interface/gigi.h (create_var_decl): Adjust comment. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index d565854a94d..d8d5ce20c96 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -4407,9 +4407,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, /* If it's possible we may need to use this expression twice, make sure that any side-effects are handled via SAVE_EXPRs; likewise if we need to force side-effects before the call. */ - if (Ekind (gnat_formal) != E_In_Parameter - && !is_by_ref_formal_parm - && TREE_CODE (gnu_name) != NULL_EXPR) + if (Ekind (gnat_formal) != E_In_Parameter && !is_by_ref_formal_parm) { tree init = NULL_TREE; gnu_name = gnat_stabilize_reference (gnu_name, true, &init); diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index ca307f36b4b..8af121e7397 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -2733,7 +2733,8 @@ gnat_rewrite_reference (tree ref, rewrite_fn func, void *data, tree *init) break; case ERROR_MARK: - return error_mark_node; + case NULL_EXPR: + return ref; default: gcc_unreachable (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb785c689cd..c4f66a85171 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-10 Eric Botcazou + + * gnat.dg/array25.adb: New test. + * gnat.dg/array25_pkg.ad[sb]: New helper. + 2015-12-10 Claudiu Zissulescu * lib/target-supports.exp (check_effective_target_arc_atomic): New diff --git a/gcc/testsuite/gnat.dg/array25.adb b/gcc/testsuite/gnat.dg/array25.adb new file mode 100644 index 00000000000..68dd3cbe19d --- /dev/null +++ b/gcc/testsuite/gnat.dg/array25.adb @@ -0,0 +1,11 @@ +-- { dg-do compile } + +with Array25_Pkg; + +procedure Array25 is + + package My_Pkg is new Array25_Pkg (0, 0); + +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/array25_pkg.adb b/gcc/testsuite/gnat.dg/array25_pkg.adb new file mode 100644 index 00000000000..9bb2fa5b545 --- /dev/null +++ b/gcc/testsuite/gnat.dg/array25_pkg.adb @@ -0,0 +1,15 @@ +package body Array25_Pkg is + + procedure Get_Inner (A : out Arr1) is + begin + null; + end; + + procedure Get (A : out Arr2) is + begin + for I in Arr2'Range loop + Get_Inner (A (I).Data); + end loop; + end; + +end Array25_Pkg; diff --git a/gcc/testsuite/gnat.dg/array25_pkg.ads b/gcc/testsuite/gnat.dg/array25_pkg.ads new file mode 100644 index 00000000000..1965bab249b --- /dev/null +++ b/gcc/testsuite/gnat.dg/array25_pkg.ads @@ -0,0 +1,19 @@ +generic + + UB1 : Natural; + + UB2 : Natural; + +package Array25_Pkg is + + type Arr1 is array (1 .. UB1) of Integer; + + type Rec is record + Data : Arr1; + end record; + + type Arr2 is array (1 .. UB2) of Rec; + + procedure Get (A : out Arr2); + +end Array25_Pkg;