diff options
-rw-r--r-- | gcc/ada/debug.adb | 6 | ||||
-rw-r--r-- | gcc/ada/exp_ch6.adb | 23 |
2 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 0f73c2a..316a798 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -173,7 +173,7 @@ package body Debug is -- d_z Enable Put_Image on tagged types -- d_A Stop generation of ALI file - -- d_B + -- d_B Warn on build-in-place function calls -- d_C -- d_D -- d_E @@ -1003,6 +1003,10 @@ package body Debug is -- d_A Do not generate ALI files by setting Opt.Disable_ALI_File. + -- d_B Warn on build-in-place function calls. This allows users to + -- inspect their code in case it triggers compiler bugs related + -- to build-in-place calls. See known-problem entries for details. + -- d_F The compiler encodes the full path from an invocation construct to -- an external target, offering additional information to GNATBIND for -- purposes of error diagnostics. diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index c882630..e3fcbc7 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -306,6 +306,10 @@ package body Exp_Ch6 is -- out of. This ensures that the secondary stack is not released; otherwise -- the function result would be reclaimed before returning to the caller. + procedure Warn_BIP (Func_Call : Node_Id); + -- Give a warning on a build-in-place function call if the -gnatd_B switch + -- was given. + ---------------------------------------------- -- Add_Access_Actual_To_Build_In_Place_Call -- ---------------------------------------------- @@ -8739,6 +8743,8 @@ package body Exp_Ch6 is raise Program_Error; end if; + Warn_BIP (Func_Call); + Result_Subt := Available_View (Etype (Function_Id)); -- Create a temp for the function result. In the caller-allocates case, @@ -8995,6 +9001,8 @@ package body Exp_Ch6 is raise Program_Error; end if; + Warn_BIP (Func_Call); + Result_Subt := Etype (Function_Id); -- If the build-in-place function returns a controlled object, then the @@ -9142,6 +9150,8 @@ package body Exp_Ch6 is raise Program_Error; end if; + Warn_BIP (Func_Call); + Result_Subt := Etype (Func_Id); -- When the result subtype is unconstrained, an additional actual must @@ -9286,6 +9296,8 @@ package body Exp_Ch6 is Set_Is_Expanded_Build_In_Place_Call (Func_Call); + Warn_BIP (Func_Call); + -- Create an access type designating the function's result subtype. -- We use the type of the original call because it may be a call to an -- inherited operation, which the expansion has replaced with the parent @@ -10330,4 +10342,15 @@ package body Exp_Ch6 is return Unqual_BIP_Function_Call (Expr); end Unqual_BIP_Iface_Function_Call; + -------------- + -- Warn_BIP -- + -------------- + + procedure Warn_BIP (Func_Call : Node_Id) is + begin + if Debug_Flag_Underscore_BB then + Error_Msg_N ("build-in-place function call?", Func_Call); + end if; + end Warn_BIP; + end Exp_Ch6; |