From 45fbea4f6603667baa877577a5ccf6326c53babd Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 23 Oct 2015 12:52:34 +0200 Subject: [PATCH] [multiple changes] 2015-10-23 Olivier Hainque * tracebak.c: Fallback to generic unwinder for gcc-sjlj on x86 & x86_64 linux * tracebak.c: Rework x86 & x86_64 sections to resort to the generic unwinder if __USING_SJLJ_EXCEPTIONS__. 2015-10-23 Javier Miranda * sem_util.adb (Check_Function_Writable_Actuals): For function calls restrict the check to elementary types, as requested by RM 6.4.1(6.15/3) 2015-10-23 Arnaud Charlet * exp_unst.adb (Unnest_Subprogram): Suppress initialization on Decl_ARECnT since we are taking care of all initializations in the generated code. From-SVN: r229233 --- gcc/ada/ChangeLog | 19 +++++++++++++++++++ gcc/ada/exp_unst.adb | 6 ++++++ gcc/ada/sem_util.adb | 26 ++++++++++++++++++++++---- gcc/ada/tracebak.c | 37 +++++++++++-------------------------- 4 files changed, 58 insertions(+), 30 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9a521162c7f..b811165802b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,22 @@ +2015-10-23 Olivier Hainque + + * tracebak.c: Fallback to generic unwinder for gcc-sjlj on x86 & + x86_64 linux + * tracebak.c: Rework x86 & x86_64 sections to resort to the + generic unwinder if __USING_SJLJ_EXCEPTIONS__. + +2015-10-23 Javier Miranda + + * sem_util.adb (Check_Function_Writable_Actuals): For function + calls restrict the check to elementary types, as requested by + RM 6.4.1(6.15/3) + +2015-10-23 Arnaud Charlet + + * exp_unst.adb (Unnest_Subprogram): Suppress initialization on + Decl_ARECnT since we are taking care of all initializations in + the generated code. + 2015-10-23 Ed Schonberg * sem_dim.adb (Analyze_Dimension_Extension_Or_Record_Aggregate): diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index c2a72431d34..238261e6422 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -1174,6 +1174,9 @@ package body Exp_Unst is -- Now we can insert the AREC declarations into the body -- type ARECnT is record .. end record; + -- pragma Suppress_Initialization (ARECnT); + -- Note that we need to set the Suppress_Initialization + -- flag after Decl_ARECnT has been analyzed. Decl_ARECnT := Make_Full_Type_Declaration (Loc, @@ -1262,6 +1265,9 @@ package body Exp_Unst is Analyze (Decl_ARECn, Suppress => All_Checks); Analyze (Decl_ARECnP, Suppress => All_Checks); + Set_Suppress_Initialization + (Defining_Identifier (Decl_ARECnT)); + if Present (Decl_Assign) then Analyze (Decl_Assign, Suppress => All_Checks); end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index f6c3ebd2f31..35b32697d25 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -2232,11 +2232,26 @@ package body Sem_Util is end if; if Is_Writable_Actual then - if Contains (Writable_Actuals_List, N) then + + -- Skip checking the error in non-elementary types since + -- RM 6.4.1(6.15/3) is restricted to elementary types, but + -- store this actual in Writable_Actuals_List since it is + -- needed to perform checks on other constructs that have + -- arbitrary order of evaluation (for example, aggregates). + + if not Is_Elementary_Type (Etype (N)) then + if not Contains (Writable_Actuals_List, N) then + Append_New_Elmt (N, To => Writable_Actuals_List); + end if; + + -- Second occurrence of an elementary type writable actual + + elsif Contains (Writable_Actuals_List, N) then -- Report the error on the second occurrence of the -- identifier. We cannot assume that N is the second - -- occurrence, since Traverse_Func walks through Field2 + -- occurrence (according to their location in the + -- sources), since Traverse_Func walks through Field2 -- last (see comment in the body of Traverse_Func). declare @@ -2262,9 +2277,12 @@ package body Sem_Util is Error_Node, Id); return Abandon; end; - end if; - Append_New_Elmt (N, To => Writable_Actuals_List); + -- First occurrence of a elementary type writable actual + + else + Append_New_Elmt (N, To => Writable_Actuals_List); + end if; else if Identifiers_List = No_Elist then diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c index 3ea9531ba3e..c91f1479daa 100644 --- a/gcc/ada/tracebak.c +++ b/gcc/ada/tracebak.c @@ -415,9 +415,9 @@ struct layout window of frame N-1 (positive offset from fp), in which we retrieve the saved return address. We then end up with our caller's return address. */ -/*------------------------------- x86 ----------------------------------*/ +/*---------------------------- x86 & x86_64 ---------------------------------*/ -#elif defined (__i386__) +#elif defined (__i386__) || defined (__x86_64__) #if defined (__WIN32) #include @@ -428,10 +428,12 @@ struct layout #define IS_BAD_PTR(ptr) 0 #endif -/* Starting with GCC 4.6, -fomit-frame-pointer is turned on by default for - 32-bit x86/Linux as well and DWARF 2 unwind tables are emitted instead. - See the x86-64 case below for the drawbacks with this approach. */ -#if defined (__linux__) && (__GNUC__ * 10 + __GNUC_MINOR__ > 45) +/* Use the dwarf2 unwinder when we expect to have dwarf2 tables at + hand. Backtraces will reliably stop on frames missing such tables, + but our only alternative is the generic unwinder which requires + compilation forcing a frame pointer to be reliable. */ + +#if defined (__linux__) && !defined (__USING_SJLJ_EXCEPTIONS__) #define USE_GCC_UNWINDER #else #define USE_GENERIC_UNWINDER @@ -444,9 +446,9 @@ struct layout }; #define FRAME_LEVEL 1 -/* builtin_frame_address (1) is expected to work on this target, and (0) might - return the soft stack pointer, which does not designate a location where a - backchain and a return address might be found. */ +/* builtin_frame_address (1) is expected to work on this family of targets, + and (0) might return the soft stack pointer, which does not designate a + location where a backchain and a return address might be found. */ #define FRAME_OFFSET(FP) 0 #define PC_ADJUST -2 @@ -478,23 +480,6 @@ struct layout || ((*((ptr) - 1) & 0xff) == 0xff) \ || (((*(ptr) & 0xd0ff) == 0xd0ff)))) -/*----------------------------- x86_64 ---------------------------------*/ - -#elif defined (__x86_64__) - -#define USE_GCC_UNWINDER -/* The generic unwinder is not used for this target because it is based - on frame layout assumptions that are not reliable on this target (the - rbp register is very likely used for something else than storing the - frame pointer in optimized code). Hence, we use the GCC unwinder - based on DWARF 2 call frame information, although it has the drawback - of not being able to unwind through frames compiled without DWARF 2 - information. -*/ - -#define PC_ADJUST -2 -/* The minimum size of call instructions on this architecture is 2 bytes */ - /*----------------------------- ia64 ---------------------------------*/ #elif defined (__ia64__) && (defined (__linux__) || defined (__hpux__)) -- 2.30.2