aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 97368c0..d0288b2 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -3043,6 +3043,16 @@ package body Exp_Ch4 is
-- Local Declarations
+ Lib_Level_Target : constant Boolean :=
+ Nkind (Parent (Cnode)) = N_Object_Declaration
+ and then
+ Is_Library_Level_Entity (Defining_Identifier (Parent (Cnode)));
+
+ -- If the concatenation declares a library level entity, we call the
+ -- built-in concatenation routines to prevent code bloat, regardless
+ -- of optimization level. This is space-efficient, and prevent linking
+ -- problems when units are compiled with different optimizations.
+
Opnd_Typ : Entity_Id;
Ent : Entity_Id;
Len : Uint;
@@ -3571,8 +3581,10 @@ package body Exp_Ch4 is
if Atyp = Standard_String
and then NN in 2 .. 9
- and then (Opt.Optimization_Level = 0 or else Debug_Flag_Dot_CC)
- and then not Debug_Flag_Dot_C
+ and then (Lib_Level_Target
+ or else
+ ((Opt.Optimization_Level = 0 or else Debug_Flag_Dot_CC)
+ and then not Debug_Flag_Dot_C))
then
declare
RR : constant array (Nat range 2 .. 9) of RE_Id :=