From 6c56d9b8a6716973e5fbba1dc5e38507022b6006 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 4 Aug 2014 10:00:05 +0200 Subject: [PATCH] [multiple changes] 2014-08-04 Robert Dewar * exp_ch4.adb: Minor reformatting. 2014-08-04 Olivier Hainque * link.c: remove const on __gnat_objlist_file_supported for AIX 2014-08-04 Robert Dewar * sem_util.ads: Minor addition of comment. 2014-08-04 Vincent Celier * prj-dect.adb (Check_Package_Allowed): Allow package IDE in all projects, including aggregate and aggregate library projects. 2014-08-04 Yannick Moy * back_end.adb (Call_Back_End): Do not call gigi in GNATprove mode. 2014-08-04 Robert Dewar * sem_eval.adb (Test_In_Range): Always in range for Is_Known_Valid target type, where input type has smaller or equal size and does not have biased rep. 2014-08-04 Ed Schonberg * sem_attr.adb (Eval_Attribute): Constrained is not treated as a static attribute, and the Static flag must not be set on it during resolution. It may be constant-folded during expansion, but if expansion is disabled it is not a static expression. From-SVN: r213535 --- gcc/ada/ChangeLog | 34 ++++++++++++++++++++++++++++++++++ gcc/ada/back_end.adb | 11 ++++++++++- gcc/ada/exp_ch4.adb | 24 ++++++++++++++---------- gcc/ada/link.c | 4 ++-- gcc/ada/prj-dect.adb | 10 ++++++---- gcc/ada/sem_attr.adb | 6 ++++++ gcc/ada/sem_eval.adb | 12 ++++++++++++ gcc/ada/sem_util.ads | 3 ++- 8 files changed, 86 insertions(+), 18 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8f2243eb947..ed625f2a3e0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,37 @@ +2014-08-04 Robert Dewar + + * exp_ch4.adb: Minor reformatting. + +2014-08-04 Olivier Hainque + + * link.c: remove const on __gnat_objlist_file_supported for AIX + +2014-08-04 Robert Dewar + + * sem_util.ads: Minor addition of comment. + +2014-08-04 Vincent Celier + + * prj-dect.adb (Check_Package_Allowed): Allow package IDE in + all projects, including aggregate and aggregate library projects. + +2014-08-04 Yannick Moy + + * back_end.adb (Call_Back_End): Do not call gigi in GNATprove mode. + +2014-08-04 Robert Dewar + + * sem_eval.adb (Test_In_Range): Always in range for + Is_Known_Valid target type, where input type has smaller or + equal size and does not have biased rep. + +2014-08-04 Ed Schonberg + + * sem_attr.adb (Eval_Attribute): Constrained is not treated as + a static attribute, and the Static flag must not be set on it + during resolution. It may be constant-folded during expansion, + but if expansion is disabled it is not a static expression. + 2014-08-04 Hristian Kirtchev * sem_ch8.adb (Build_Class_Wide_Wrapper): Mark the primitive as diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb index 1d5de114e24..3e535547db6 100644 --- a/gcc/ada/back_end.adb +++ b/gcc/ada/back_end.adb @@ -126,7 +126,8 @@ package body Back_End is Nat (Physical_To_Logical (Last_Source_Line (J), J)); end loop; - -- Deal with case of generating SCIL, we should not be here! + -- Deal with case of generating SCIL, we should not be here unless + -- debugging CodePeer mode in GNAT. if Generate_SCIL then Error_Msg_N ("'S'C'I'L generation not available", Cunit (Main_Unit)); @@ -139,6 +140,14 @@ package body Back_End is end if; end if; + -- We should be here in GNATprove mode only when debugging GNAT. Do not + -- call gigi in that case, as it is not prepared to handle the special + -- form of the tree obtained in GNATprove mode. + + if GNATprove_Mode then + return; + end if; + -- The actual call to the back end gigi diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 6d43496d419..d012fc6f59a 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -10416,18 +10416,22 @@ package body Exp_Ch4 is -- If the level of the operand type is statically deeper than the -- level of the target type, then force Program_Error. Note that this -- can only occur for cases where the attribute is within the body of - -- an instantiation (otherwise the conversion will already have been - -- rejected as illegal). (Note: warnings are issued by the analyzer - -- for the instance cases.) The case where the target type is an - -- anonymous access type of a discriminant is excluded, because the - -- level of such a type depends on the context and currently the - -- level returned for such types is zero, resulting in warnings about - -- about check failures in certain legal cases involving class-wide - -- interfaces as the designated type (some cases, such as return - -- statements, are checked at run time, but not clear if these are - -- handled right in general, see 3.10.2(12/2-12.5/3) ???). + -- an instantiation, otherwise the conversion will already have been + -- rejected as illegal. + + -- Note: warnings are issued by the analyzer for the instance cases elsif In_Instance_Body + + -- The case where the target type is an anonymous access type of + -- a discriminant is excluded, because the level of such a type + -- depends on the context and currently the level returned for such + -- types is zero, resulting in warnings about about check failures + -- in certain legal cases involving class-wide interfaces as the + -- designated type (some cases, such as return statements, are + -- checked at run time, but not clear if these are handled right + -- in general, see 3.10.2(12/2-12.5/3) ???). + and then not (Ekind (Target_Type) = E_Anonymous_Access_Type and then Present (Associated_Node_For_Itype (Target_Type)) diff --git a/gcc/ada/link.c b/gcc/ada/link.c index 8a8e12033d7..ee591471af0 100644 --- a/gcc/ada/link.c +++ b/gcc/ada/link.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2012, Free Software Foundation, Inc. * + * Copyright (C) 1992-2014, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -153,7 +153,7 @@ const char *__gnat_run_path_option = ""; char __gnat_shared_libgnat_default = STATIC; char __gnat_shared_libgcc_default = STATIC; int __gnat_link_max = 15000; -const unsigned char __gnat_objlist_file_supported = 1; +unsigned char __gnat_objlist_file_supported = 1; const char *__gnat_object_library_extension = ".a"; unsigned char __gnat_separate_run_path_options = 0; const char *__gnat_default_libgcc_subdir = "lib"; diff --git a/gcc/ada/prj-dect.adb b/gcc/ada/prj-dect.adb index 028b2bc1a73..9053cfca54f 100644 --- a/gcc/ada/prj-dect.adb +++ b/gcc/ada/prj-dect.adb @@ -214,10 +214,12 @@ package body Prj.Dect is Project_Qualifier_Of (Project, In_Tree); Name : constant Name_Id := Name_Of (Current_Package, In_Tree); begin - if (Qualif = Aggregate and then Name /= Snames.Name_Builder) - or else (Qualif = Aggregate_Library - and then Name /= Snames.Name_Builder - and then Name /= Snames.Name_Install) + if Name /= Snames.Name_Ide + and then + ((Qualif = Aggregate and then Name /= Snames.Name_Builder) + or else + (Qualif = Aggregate_Library and then Name /= Snames.Name_Builder + and then Name /= Snames.Name_Install)) then Error_Msg_Name_1 := Name; Error_Msg diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index e3e9f5aaa49..2b4cee2e378 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -7775,6 +7775,12 @@ package body Sem_Attr is -- could be handled at compile time. To be looked at later. when Attribute_Constrained => + + -- The expander might fold it and set the static flag accordingly, + -- but with expansion disabled (as in ASIS), it remains as an + -- attribute reference, and this reference is not static. + + Set_Is_Static_Expression (N, False); null; --------------- diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 7cf4b3d37da..2fb5d3757c9 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -6193,6 +6193,18 @@ package body Sem_Eval is then return In_Range; + -- Another special case. For signed integer types, if the target type + -- has Is_Known_Valid set, and the source type does not have a larger + -- size, then the source value must be in range. We exclude biased + -- types, because they bizarrely can generate out of range values. + + elsif Is_Signed_Integer_Type (Etype (N)) + and then Is_Known_Valid (Typ) + and then Esize (Etype (N)) <= Esize (Typ) + and then not Has_Biased_Representation (Etype (N)) + then + return In_Range; + -- For all other cases, result is unknown else diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 84b4572b0b1..b322405401f 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -1318,7 +1318,8 @@ package Sem_Util is -- declaration. function Is_SPARK_Object_Reference (N : Node_Id) return Boolean; - -- Determines if the tree referenced by N represents an object in SPARK + -- Determines if the tree referenced by N represents an object in SPARK. + -- This differs from Is_Object_Reference in that ??? function Is_Statement (N : Node_Id) return Boolean; pragma Inline (Is_Statement); -- 2.30.2