When working on LLVM/CCG, we found that the generated tree had a wrong
reference before declaration usage. Fixed for LLVM/CCG. The issue might
still be latent with Modify_Tree_For_C, but this expansion will
disappear in the future, so not worth bothering.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* exp_ch6.adb (Expand_Call): Properly split
Transform_Function_Array and Modify_Tree_For_C.
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -3656,7 +3656,8 @@ package body Exp_Ch6 is
-- are passed by pointer in the generated C code, and we cannot
-- take a pointer from a subprogram call.
- elsif Nkind (Parent (Call_Node)) in N_Subprogram_Call
+ elsif Modify_Tree_For_C
+ and then Nkind (Parent (Call_Node)) in N_Subprogram_Call
and then Is_Record_Type (Etype (Func_Id))
then
declare