diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cc6e73bb7c0..b3690ebc3bc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2014-02-24 Ed Schonberg + + * par-ch3.adb (P_Basic_Declarative_Items): If an improper body + appears in a list of basic declarations, complete the tree with + an empty statement list, to prevent cascaded errors and crashes + if semantic analysis is attempted. + 2014-02-24 Thomas Quinot * g-sercom-mingw.adb (Open): Fix incorrect test for error return diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 11e9f81c4d1..4f8afb0286f 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -4626,6 +4626,17 @@ package body Ch3 is then Error_Msg ("proper body not allowed in package spec", Sloc (Decl)); + -- Complete declaration of mangled subprogram body, for better + -- recovery if analysis is attempted. + + if Nkind_In + (Decl, N_Subprogram_Body, N_Package_Body, N_Task_Body) + then + Set_Handled_Statement_Sequence (Decl, + Make_Handled_Sequence_Of_Statements (Sloc (Decl), + Statements => New_List)); + end if; + -- Test for body stub scanned, not acceptable as basic decl item elsif Kind in N_Body_Stub then diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads index 92bf50c8d2f..274810e0ddb 100644 --- a/gcc/ada/s-os_lib.ads +++ b/gcc/ada/s-os_lib.ads @@ -48,6 +48,9 @@ -- be used by other predefined packages. User access to this package is via -- a renaming of this package in GNAT.OS_Lib (file g-os_lib.ads). +-- Note: a distinct body for this spec is included in the .NET runtime library +-- and must be kept in sync with changes made in this file. + pragma Compiler_Unit; with System; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index eea32001c05..f456131f2e4 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -311,10 +311,14 @@ package body Sem_Ch6 is Formal_Spec : Node_Id; begin Formal_Spec := First (Parameter_Specifications (New_Spec)); + + -- Create a new formal parameter at the same source position + while Present (Formal_Spec) loop Set_Defining_Identifier (Formal_Spec, - Make_Defining_Identifier (Sloc (Formal_Spec), + Make_Defining_Identifier + (Sloc (Defining_Identifier (Formal_Spec)), Chars => Chars (Defining_Identifier (Formal_Spec)))); Next (Formal_Spec); end loop;