Jeff Law [Mon, 30 Nov 2020 15:59:23 +0000 (08:59 -0700)]
Fix non-unique testnames
gcc/testsuite
* g++.dg/warn/Wnonnull5.C: Fix non-unique testnames.
* g++.dg/warn/Wplacement-new-size-8.C: Likewise.
Jonathan Wakely [Mon, 30 Nov 2020 15:02:03 +0000 (15:02 +0000)]
libstdc++: Add new C++20 headers to Doxygen settings
This doesn't actually have any effect unless you also change the
predefined value of __cplusplus, as it's currently 201703L. But if
somebody does want to do that, the new headers will get processed now.
libstdc++-v3/ChangeLog:
* doc/doxygen/user.cfg.in (INPUT): Add <latch> and <semaphore>.
Jonathan Wakely [Mon, 30 Nov 2020 14:39:54 +0000 (14:39 +0000)]
libstdc++: Reduce default test timeout to 360 seconds
The current default of 10 minutes is much longer than most tests need on
common hardware. The slow tests all now have a dg-timeout-factor
directive that gives them more time to run relative to the default. The
default can also be overridden in ~/.dejagnurc or DEJAGNU=site.exp, so
it seems unnecessary to have such a large default.
This reduces the default from 10 minutes to 6 minutes, which still seems
more than enough.
libstdc++-v3/ChangeLog:
* testsuite/lib/libstdc++.exp (libstdc++_init): Reduce
default tool_timeout to 360.
Jonathan Wakely [Mon, 30 Nov 2020 14:39:54 +0000 (14:39 +0000)]
libstdc++: Set dg-timeout-factor for more slow tests
As in r11-5449, this adds a muliplier to the timeout for slow tests.
This covers the majority of the <regex> and PSTL tests.
libstdc++-v3/ChangeLog:
* testsuite/20_util/specialized_algorithms/pstl/*: Add
dg-timeout-factor.
* testsuite/25_algorithms/pstl/*: Likewise.
* testsuite/26_numerics/pstl/*: Likewise.
* testsuite/28_regex/*: Likewise.
Tobias Burnus [Mon, 30 Nov 2020 14:30:51 +0000 (15:30 +0100)]
Fortran: With OpenACC, ignore OpenMP's cond comp sentinels
gcc/fortran/ChangeLog:
PR fortran/98011
* scanner.c (skip_free_comments, skip_fixed_comments): If only
-fopenacc but not -fopenmp is used, ignore OpenMP's conditional
compilation sentinels. Fix indentation, use 'else if' for readability.
gcc/testsuite/ChangeLog:
PR fortran/98011
* gfortran.dg/goacc/sentinel-free-form.f95:
* gfortran.dg/goacc-gomp/fixed-1.f: New test.
* gfortran.dg/goacc-gomp/free-1.f90: New test.
* gfortran.dg/goacc/fixed-5.f: New test.
Tobias Burnus [Mon, 30 Nov 2020 14:27:44 +0000 (15:27 +0100)]
Fortran: -fno-automatic and -fopenacc / recusion check cleanup
Options: -fopenmp and -fopenacc imply concurrent calls to a
procedure; now also -fopenacc implies -frecursive, disabling
that larger local const-size array variables use static memory.
Run-time recursion check: Always reset the check variable at the
end of the procedure; this avoids a bogus error with -fopenmp
when called twice nonconcurrently/nonrecursively. (Issue requires
using -fno-automatic or -fmax-stack-var-size= to trigger.)
gcc/fortran/ChangeLog:
PR fortran/98010
PR fortran/98013
* options.c (gfc_post_options): Also imply recursive with
-fopenacc.
* trans-decl.c (gfc_generate_function_code): Simplify condition.
Tobias Burnus [Mon, 30 Nov 2020 14:19:39 +0000 (15:19 +0100)]
Fortran's dump-parse-tree.c: Use '==' not '=' for '.eq.'.
gcc/fortran/
* dump-parse-tree.c (show_expr): Use '==' not '=' for '.eq.'.
Pierre-Marie de Rodat [Tue, 24 Nov 2020 06:29:50 +0000 (01:29 -0500)]
[Ada] s-trasym.ads: update the list of supported platforms
gcc/ada/
* libgnat/s-trasym.ads: Update the list of supported platforms.
Arnaud Charlet [Sat, 24 Oct 2020 11:14:15 +0000 (11:14 +0000)]
[Ada] Remove all ^L characters
gcc/ada/
* gcc-interface/Makefile.in, gcc-interface/trans.c: Remove ^L
characters.
Arnaud Charlet [Mon, 2 Nov 2020 17:27:55 +0000 (12:27 -0500)]
[Ada] Enable checks on runtime by default
gcc/ada/
* gcc-interface/Makefile.in (GNATLIBFLAGS): Enable checks by
default.
* libgnat/s-bitfie.ads: Suppress alignment checks.
* libgnat/s-bituti.adb: Minor reformatting.
* libgnat/s-secsta.adb (SS_Allocate): Support Size = 0.
Arnaud Charlet [Sun, 15 Nov 2020 16:20:42 +0000 (11:20 -0500)]
[Ada] Wrong replacement of Component.Discriminant
gcc/ada/
* exp_ch3.adb (Replace_Discr_Ref): Removed, no longer needed.
Piotr Trojanek [Sun, 15 Nov 2020 11:03:30 +0000 (12:03 +0100)]
[Ada] Minor reuse Is_Assignable
gcc/ada/
* sem_ch5.adb (Process_Statements): Replace low-level membership
test with a high-level wrapper.
Piotr Trojanek [Sun, 15 Nov 2020 00:21:41 +0000 (01:21 +0100)]
[Ada] Simplify analysis of assignment statements
gcc/ada/
* sem_ch5.adb (Set_Assignment_Type): Combine calls to Ekind
using membership test.
(Should_Transform_BIP_Assignment): Replace assignment to a
"Result" variable with simple return statements; avoid repeated
calls to Unqual_Conv by declaring a local constant.
Piotr Trojanek [Sat, 14 Nov 2020 22:26:05 +0000 (23:26 +0100)]
[Ada] Minor reuse Is_Protected_Component
gcc/ada/
* lib-xref.adb (Generate_Reference): Fix reference to
Analyze_Assignment.
* sem_ch5.adb (Diagnose_Non_Variable_Lhs): Reuse existing
utility function.
Eric Botcazou [Sat, 14 Nov 2020 15:12:04 +0000 (16:12 +0100)]
[Ada] Fix internal error on extended return and fixed-point result
gcc/ada/
* contracts.adb (Check_Type_Or_Object_External_Properties): Make
sure to exclude all return objects from the SPARK legality rule
on effectively volatile variables.
* exp_ch6.adb (Expand_N_Extended_Return_Statement): Use the fast
track only when the declaration of the return object can be
dropped.
Gary Dismukes [Mon, 2 Nov 2020 06:21:09 +0000 (01:21 -0500)]
[Ada] Implement inheritance for Default_Initial_Condition and address other gaps
gcc/ada/
* einfo.ads (Is_Partial_DIC_Procedure): New function.
(Partial_DIC_Procedure): New procedure.
* einfo.adb (Is_Partial_DIC_Procedure): New function to return
whether a subprogram is a partial Default_Initial_Condition
procedure by checking the name (to avoid adding a new field).
(DIC_Procedure): Add a test that excludes partial DIC procedures
from being returned.
(Partial_DIC_Procedure): New procedure to return the partial DIC
procedure of a type, if it has one (otherwise returns Empty).
(Set_DIC_Procedure): Remove check for duplicate DIC procedures.
* exp_aggr.adb (Gen_Assign): Generate a call to the type's DIC
procedure in the case where an array component is default
initialized (due to an association with a box).
(Build_Record_Aggr_Code): For an extension aggregate, generate a
call to the ancestor type's DIC procedure (if any) when the
ancestor part is a subtype mark. For a record component
association that was specified with a box (tested for by
checking the new flag Was_Default_Init_Box_Association),
generate a call to the component type's DIC procedure (if it has
one).
* exp_ch4.adb (Expand_N_Allocator): When the allocated object is
default initialized and the designated type has a DIC aspect,
generate a call to the DIC procedure.
* exp_util.ads (Build_DIC_Call): Change the formal Obj_Id to
name Obj_Name, and change its type from Entity_Id to Node_Id
(and update comment).
(Build_DIC_Procedure_Body): Add formal Partial_DIC, remove
formal For_Freeze, and update comment accordingly.
(Build_DIC_Procedure_Declaration): Add formal Partial_DIC and
update comment.
* exp_util.adb
(Build_DIC_Call): Revised to use its Obj_Name (formerly Obj_Id)
formal directly rather than calling New_Occurrence_Of on it, to
allow arbitrary names to be passed rather than being limited to
Entity_Ids.
(Build_DIC_Procedure_Body): Call Add_Parent_DICs to generate
checks for DICs associated with any parent types, implementing
the required "additive" semantics for DICs. When building a DIC
procedure body for a partial view (when Partial_DIC is True),
call Add_Own_DIC when the type has its own DIC. In the case of
"full" DIC procedures, a call is generated to any partial DIC
procedure of the type (unless the procedure has a null body),
along with checks for any DICs inherited by the full view.
(Build_DIC_Procedure_Declaration): Add handling for partial DIC
procedures. For the suffix of a regular DIC procedure's name,
use "DIC" (instead of "Default_Initial_Condition"), and for the
suffix of a partial DIC procedure's name, use "Partial_DIC".
(Add_DIC_Check): Add the DIC pragma to the list of seen pragmas
(Pragmas_Seen).
(Add_Inherited_Tagged_DIC): Remove the formals Par_Typ,
Deriv_Typ, and Obj_Id, and add formal Expr, which denotes DIC's
expression. Remove the call to Replace_References (which is now
done in Add_Inherited_DICs).
(Add_Inherited_DICs): New procedure to locate a DIC pragma
associated with a parent type, replace its references
appropriately (such as any current instance references), and add
a check for the DIC.
(Add_Own_DIC): Add an Obj_Id formal to allow caller to pass the
_init formal of the generated DIC procedure.
(Add_Parent_DICs): New procedure to traverse a type's parents,
looking for DICs associated with those and calling
Add_Inherited_DICs to apply the appropriate DIC checks.
(Is_Verifiable_DIC_Pragma): Treat pragmas that have an Empty
first argument the same as a pragma without any arguments
(returning False for that case).
* exp_ch3.adb (Init_One_Dimension): Generate calls to the
component's DIC procedure when needed.
(Possible_DIC_Call): New function nested in Init_One_Dimension
to build a call to the array component type's DIC-checking
function when appropriate.
(Build_Array_Init_Proc): The presence of a DIC on the component
type is an additional condition for generating an init proc for
an array type.
(Build_Init_Statements): When the record component's type has a
DIC, and the component declaration does not have an
initialization expression, generate a call to the component
type's DIC procedure.
(Expand_N_Object_Declaration): Modify the call to Build_DIC_Call
to pass a new occurrence of the object's defining id rather than
the id itself.
(Freeze_Type): Only build a type's DIC procedure (if it has one)
for types that are not interfaces.
* exp_spark.adb (Expand_SPARK_N_Freeze_Type): Remove From_Freeze
actual and add a ??? comment.
(Expand_SPARK_N_Object_Declaration): Modify call to
Build_DIC_Call to pass a new occurrence of the object id rather
than the object id itself.
* sem_aggr.adb (Resolve_Record_Aggregate): Declare local flag
Is_Box_Init_By_Default and set it in cases where the component
association has a box and the component is being initialized by
default (as opposed to initialized by an initialization
expression associated with the component's declaration).
(Add_Association): If the association has a box for a component
initialized by default, the flag
Was_Default_Init_Box_Association is set on the new component
association (for later testing during expansion).
(Get_Value): Reset Is_Box_Init_By_Default to False.
* sem_ch3.adb (Build_Assertion_Bodies_For_Type): Rearrange code
to build DIC procedure bodies for a (noninterface) type that
Has_Own_DIC (for partial type views) or Has_DIC (for full type
views) as appropriate.
* sem_ch13.adb (Analyze_Aspect_Specifications,
Aspect_Default_Initial_Condition): Add an extra argument to the
DIC pragma to denote the type associated with the pragma (for
use in Build_DIC_Procedure_Body).
* sem_prag.adb (Analyze_Pragma): Allow two arguments for pragma
Default_Initial_Condition. If not already present, add an extra
argument denoting the type that the pragma is associated with.
* sem_util.adb (Propagate_DIC_Attributes): Retrieve any partial
DIC procedure associated with the type and add it to the type's
list of subprograms (Subprograms_For_Type).
* sinfo.ads (Was_Default_Init_Box_Association): New flag on
N_Component_Association nodes. Add subprograms to get and set
flag, as well as updating the documentation.
* sinfo.adb (Was_Default_Init_Box_Association): New function to
retrieve the corresponding flag (Flag14).
(Set_Was_Default_Init_Box_Association): New procedure to set the
corresponding flag (Flag14).
Arnaud Charlet [Fri, 13 Nov 2020 14:56:14 +0000 (09:56 -0500)]
[Ada] Improve error recovery
gcc/ada/
* par-ch6.adb (P_Formal_Part): Remove extra call to Scan.
* par-tchk.adb: Minor reformatting.
Eric Botcazou [Thu, 12 Nov 2020 14:56:00 +0000 (15:56 +0100)]
[Ada] Reimplement Ada.Numerics.Big_Numbers.Big_Reals.Fixed_Conversions
gcc/ada/
* libgnat/a-nbnbre.adb (Float_Conversions): Instantiate Conv
package only once in the body.
(Fixed_Conversions.Float_Aux): New instance.
(Fixed_Conversions.Conv_I): Likewise.
(Fixed_Conversions.Conv_U): Likewise.
(Fixed_Conversions.LLLI): New subtype.
(Fixed_Conversions.LLLU): Likewise.
(Fixed_Conversions.Too_Large): New constant.
(Fixed_Conversions.To_Big_Real): Reimplement.
(Fixed_Conversions.From_Big_Real): Likewise.
Bob Duff [Thu, 12 Nov 2020 19:40:39 +0000 (14:40 -0500)]
[Ada] Compiler crash on limited conditional expressions
gcc/ada/
* exp_ch3.adb (Expand_N_Object_Declaration): Avoid crash in case
of conditional expression.
Eric Botcazou [Tue, 10 Nov 2020 11:14:56 +0000 (12:14 +0100)]
[Ada] Expand integer-only implementation of ordinary fixed-point types
gcc/ada/
* doc/gnat_rm/implementation_defined_attributes.rst (Pool_Address):
Fix pasto.
(Small_Denominator): New entry.
(Small_Numerator): Likewise.
* doc/gnat_rm/implementation_defined_characteristics.rst (3.5.9):
Relax conditions on 128-bit smalls and integer-only implementation.
* gnat_rm.texi: Regenerate.
* exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Fore>:
Relax conditions on integer implementation for ordinary fixed-point
types and pass a third parameter to the routine.
<Attribute_Small_Denominator>: Raise Program_Error.
<Attribute_Small_Numerator>: Likewise.
* exp_fixd.adb (Expand_Convert_Fixed_To_Fixed): Use a scaled divide
if the numerator and denominator of the small ratio are sufficiently
small integers.
(Expand_Convert_Fixed_To_Integer): Use a scaled divide if numerator
and denominator of the small value are sufficiently small integers.
(Expand_Convert_Integer_To_Fixed): Likewise.
* exp_imgv.adb (Expand_Image_Attribute): Relax the conditions on the
integer implementation for ordinary fixed-point types.
(Expand_Value_Attribute): Likewise.
* freeze.adb (Freeze_Fixed_Point_Type): Relax conditions on 128-bit
smalls.
* sem_attr.adb (Analyze_Attribute) <Attribute_Small_Denominator>:
Check no arguments, fixed-point and set type to Universal_Integer.
<Attribute_Small_Numerator>: Likewise.
(Eval_Attribute) <Attribute_Small_Denominator>: Fold statically.
<Attribute_Small_Numerator>: Likewise.
* snames.ads-tmpl (Name_Small_Denominator): New attribute name.
(Name_Small_Numerator): Likewise.
(Attribute_Id): Add Attribute_Small_{Denominator,Numerator}.
* libgnat/a-tifiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-tifiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-wtfiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-wtfiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-ztfiio.adb (Exact): Delete.
(Need_64): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/a-ztfiio__128.adb (Exact): Delete.
(Need_64): Likewise.
(Need_128): Likewise.
(OK_Get_32): New boolean constant.
(OK_Put_32): Likewise.
(OK_Get_64): Likewise.
(OK_Put_64): Likewise.
(OK_Get_128): Likewise.
(OK_Put_128): Likewise.
(E): Adjust.
(Get procedures): Likewise.
(Put procedures): Likewise.
* libgnat/s-fore_f.ads (Fore_Fixed): Adjust signature.
* libgnat/s-fore_f.adb (Fore_Fixed): Reimplement.
* libgnat/s-fofi32.ads (Fore_Fixed32): Adjust signature.
* libgnat/s-fofi64.ads (Fore_Fixed64): Likewise.
* libgnat/s-fofi128.ads (Fore_Fixed128): Likewise.
* libgnat/s-imagef.ads: Adjust description.
* libgnat/s-imagef.adb (Maxdigs): Move around.
(Set_Image_Integer): Remove assertion.
* libgnat/s-valuef.ads: Adjust description.
* libgnat/s-valuef.adb (Integer_To_Fixed): Minor tweak.
Ghjuvan Lacambre [Thu, 12 Nov 2020 08:38:58 +0000 (09:38 +0100)]
[Ada] Implement -gnateb switch
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Describe -gnateb switch.
* doc/gnat_ugn/the_gnat_compilation_model.rst: Mention -gnateb
switch in configuration pragma files section.
* gnat_ugn.texi: Regenerate.
* lib-writ.adb (Write_ALI): Strip directories from configuration
files path if needed.
* opt.ads: Declare Config_Files_Store_Basename option.
* par.adb (Par): Save configuration file checksum.
* switch-c.adb (Scan_Front_End_Switches): Set
Config_Files_Store_Basename true if -gnateb is present.
Arnaud Charlet [Wed, 11 Nov 2020 16:32:34 +0000 (11:32 -0500)]
[Ada] Potential read of uninitialized variable in exp_dist.adb
gcc/ada/
* exp_dist.adb (RCI_Cache): Initialize.
Arnaud Charlet [Wed, 11 Nov 2020 16:31:27 +0000 (11:31 -0500)]
[Ada] Address warning compiling terminals.c
gcc/ada/
* terminals.c (allocate_pty_desc): Copy one less byte since the
last byte will always be set to 0.
Eric Botcazou [Tue, 10 Nov 2020 17:43:52 +0000 (18:43 +0100)]
[Ada] Add stream-oriented attributes support for 128-bit integer types
gcc/ada/
* doc/gnat_ugn/building_executable_programs_with_gnat.rst (-xdr):
Document that XDR is not supported for 128-bit integer types.
* gnat_ugn.texi: Regenerate.
* exp_strm.adb (Build_Elementary_Input_Call): Deal with types
larger than Long_Long_Integer.
(Build_Elementary_Write_Call): Likewise.
* rtsfind.ads (RE_Id): Add RE_I_LLL{I,U] and RE_W_LLL{I,U}.
(RE_Unit_Table): Add entries for them.
* libgnat/s-stratt.ads (I_LLLI): New inline function.
(I_LLLU): Likewise.
(W_LLLI): New inline procedure.
(W_LLLU): Likewise.
* libgnat/s-stratt.adb (S_LLLI): New subtype of SEA.
(S_LLLU): Likewise.
(From_LLLI): New instance of Unchecked_Conversion.
(From_LLLU): Likewise.
(To_LLLI): Likewise.
(To_LLLU): Likewise.
(I_LLLI): Implement.
(I_LLLU): Likewise.
(W_LLLI): Likewise.
(W_LLLU): Likewise.
Ed Schonberg [Tue, 10 Nov 2020 15:16:49 +0000 (10:16 -0500)]
[Ada] Spurious error on iterator over container with modified private part
gcc/ada/
* exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Check the
signature of the private operation Get_Element_Access to prevent
accidental use of a user-defined homonym subprogram.
Yannick Moy [Tue, 10 Nov 2020 13:30:03 +0000 (14:30 +0100)]
[Ada] Add comment on special Heap variable used in GNATprove
gcc/ada/
* spark_xrefs.ads: Add comment for Heap that it may remain
Empty.
Pascal Obry [Sat, 7 Nov 2020 09:31:43 +0000 (10:31 +0100)]
[Ada] Fix serial port control setting on GNU/Linux
gcc/ada/
* libgnat/g-sercom__linux.adb (Set): Fix control flags of the
serial port setting.
Pascal Obry [Sat, 7 Nov 2020 09:30:09 +0000 (10:30 +0100)]
[Ada] Minor style fixes
gcc/ada/
* libgnat/g-sercom__linux.adb: Minor style fixes.
Piotr Trojanek [Mon, 9 Nov 2020 13:13:58 +0000 (14:13 +0100)]
[Ada] Fix folding of comparison operators in GNATprove mode
gcc/ada/
* exp_util.adb (Get_Current_Value_Condition): Don't use current
value tracking in GNATprove mode.
* sem_res.adb (Resolve_Comparison_Op): Remove incomplete
special-casing for folding in GNATprove mode.
Bob Duff [Sun, 8 Nov 2020 21:54:56 +0000 (16:54 -0500)]
[Ada] Crash on ghost assignment check for illegal code
gcc/ada/
* errout.adb (Error_Msg_NEL): Do not call Set_Posted if errors
are being ignored.
(Error_Msg): Change Errors_Must_Be_Ignored to use the getter.
* sem_ch8.adb (Find_Direct_Name): Do not skip all the error
checks when ignoring errors, but instead do not add an entry to
the Urefs table if errors are being ignored.
* exp_ch5.adb: Minor comment fix.
Yannick Moy [Fri, 6 Nov 2020 17:09:44 +0000 (18:09 +0100)]
[Ada] Add continuation message when others choice not allowed
gcc/ada/
* sem_aggr.adb (Resolve_Array_Aggregate): Improve error message.
Eric Botcazou [Sun, 8 Nov 2020 11:34:28 +0000 (12:34 +0100)]
[Ada] Small cleanup in System.Value_F
gcc/ada/
* libgnat/s-valuef.adb (Integer_To_Fixed): Do not modify numerator
or denominator in order to reduce the exponent.
Arnaud Charlet [Sat, 7 Nov 2020 18:53:05 +0000 (19:53 +0100)]
[Ada] Confusion in Transform_Function_Array and internal subprograms
gcc/ada/
* ali-util.adb (Get_File_Checksum): Remove dead code.
* exp_ch4.adb (Expand_Boolean_Operator, Expand_N_Op_Not,
Make_Boolean_Array_Op): Take Transform_Function_Array into
account.
* exp_ch6.adb (Expand_Call_Helper): Update comment. Code
cleanup.
* exp_util.adb (Build_Procedure_Form): Use new predefined name
Name_UP_RESULT.
* snames.ads-tmpl (Name_UP_RESULT): New predefined name. Code
cleanup: remove unused names from the project parser, moved to
gprbuild sources.
* xsnamest.adb: Add support for uppercase names.
Ed Schonberg [Fri, 6 Nov 2020 15:21:06 +0000 (10:21 -0500)]
[Ada] Spurious visibility error in subprogram body in with_clause
gcc/ada/
* sem_util.adb (Enter_Name): When an inherited operation for a
local derived type is hidden by an explicit declaration of a
non-overloadable entity in the same scope, make the inherited
operation non-visible to prevent its accidental use elsewhere.
Richard Biener [Mon, 30 Nov 2020 12:39:59 +0000 (13:39 +0100)]
tree-optimization/98064 - fix BB SLP live lane extract wrt LC SSA
This avoids breaking LC SSA when SLP codegen pulled an out-of-loop
def into a loop when merging with in-loop defs for an external def.
2020-11-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/98064
* tree-vect-loop.c (vectorizable_live_operation): Avoid
breaking LC SSA for BB vectorization.
* g++.dg/vect/pr98064.cc: New testcase.
Martin Liska [Mon, 30 Nov 2020 12:41:26 +0000 (13:41 +0100)]
changelog: allow subdir wildcard entry
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Allow sub-directory wildcard
changelog entry. Fix a typo caused by apostrophe escaping.
* gcc-changelog/test_email.py: Test it.
* gcc-changelog/test_patches.txt: Likewise.
Jonathan Wakely [Mon, 30 Nov 2020 12:28:25 +0000 (12:28 +0000)]
doc: Fix description of dg-require-effective-target
The optional target selector for the dg-require-effective-target
directive needs to be { target selector } not just { selector } as
currently documented.
gcc/ChangeLog:
* doc/sourcebuild.texi (Directives): Fix description of
dg-require-effective-target to include "target" in selector.
Richard Biener [Mon, 30 Nov 2020 09:41:36 +0000 (10:41 +0100)]
tree-optimization/98048 - fix vector lowering of ABSU_EXPR
This makes sure to use the correct type for the LHS of the scalar
replacement statement.
20220-11-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/98048
* tree-vect-generic.c (expand_vector_operations_1): Use the
correct type for the scalar LHS replacement.
* gcc.dg/vect/pr98048.c: New testcase.
Martin Liska [Mon, 30 Nov 2020 10:10:28 +0000 (11:10 +0100)]
gimple ISEL: fix BB stmt iteration
gcc/ChangeLog:
PR tree-optimization/98066
* gimple-isel.cc (gimple_expand_vec_exprs): Return when
gimple_expand_vec_exprs replaces last stmt.
Jonathan Wakely [Mon, 30 Nov 2020 11:41:03 +0000 (11:41 +0000)]
gcc-changelog: Add libstdc++-v3/testsuite to wildcard prefixes
This allows using "testsuite/*" in libstdc++-v3/ChangeLog entries, which
was one of the original motivations for adding wildcard support in the
first place:
https://gcc.gnu.org/pipermail/gcc/2020-June/232719.html
contrib/ChangeLog:
* gcc-changelog/git_commit.py (wildcard_prefixes): Add libstdc++
testsuite directory.
Ilya Leoshkevich [Tue, 24 Nov 2020 21:47:11 +0000 (22:47 +0100)]
rtl_dump_bb: fix segfault when reporting internal error
During ICE reporting, sometimes rtl_dump_bb is called on partially
initialized basic blocks. This produces another ICE, obscuring the
original problem.
Fix by checking that that basic blocks are initialized before touching
their bb_infos.
gcc/ChangeLog:
2020-11-25 Ilya Leoshkevich <iii@linux.ibm.com>
* cfgrtl.c (rtl_bb_info_initialized_p): New function.
(rtl_dump_bb): Use rtl_bb_info_initialized_p before accessing bb
insns.
Iain Buclaw [Sat, 28 Nov 2020 15:55:53 +0000 (16:55 +0100)]
d: Add freebsd support for D compiler and runtime
gcc/ChangeLog:
PR d/87818
* config.gcc (*-*-freebsd*): Add freebsd-d.o and t-freebsd.
* config/freebsd-d.c: New file.
* config/t-freebsd: New file.
libphobos/ChangeLog:
PR d/87818
* configure.tgt: Add x86_64-*-freebsd* and i?86-*-freebsd* as
supported targets.
Stam Markianos-Wright [Mon, 30 Nov 2020 10:32:58 +0000 (10:32 +0000)]
[Obvious] arm: Fix test from failing on some targets [PR91816]
This recently submitted test was found to fail on some Cortex-M
targets. This was because codegen on these CPUs would emit a ldr
instead of a movw/movt pair, resulting in an overall smaller test
(i.e. the branch wasn't as far) and the behaviour being tested
for not being triggered.
This commit doubles the size of the test to account for this.
gcc/testsuite/ChangeLog:
* gcc.target/arm/pr91816.c: New test.
Jakub Jelinek [Mon, 30 Nov 2020 09:55:43 +0000 (10:55 +0100)]
expansion: Improve double-word modulo by certain constant divisors [PR97459]
As discussed in the PR, e.g. on x86_64 (both -m32 and -m64) there is no
double-word modulo and so we expand it to a __{,u}mod[dt]i3 call.
For certain constant divisors we can do better. E.g. consider
32-bit word-size, 0x100000000ULL % 3 == 1, so we can use partly the Hacker's
delight modulo by summing digits approach and optimize
unsigned long long foo (unsigned long long x) { return x % 3; }
as
unsigned long long foo (unsigned long long x) {
unsigned int sum, carry;
carry = __builtin_add_overflow ((unsigned int) x, (unsigned int) (x >> 32), &sum);
sum += carry;
return sum % 3;
}
Similarly, 0x10000000ULL % 5 == 1 (note, 1 << 28), so
unsigned long long bar (unsigned long long x) { return x % 5; }
as
unsigned long long bar (unsigned long long x) {
unsigned int sum = x & ((1 << 28) - 1);
sum += (x >> 28) & ((1 << 28) - 1);
sum += (x >> 56);
return sum % 5;
}
etc.
And we can do also signed modulo,
long long baz (long long x) { return x % 5; }
as
long long baz (long long x) {
unsigned int sum = x & ((1 << 28) - 1);
sum += ((unsigned long long) x >> 28) & ((1 << 28) - 1);
sum += ((unsigned long long) x >> 56);
/* Sum adjustment for negative x. */
sum += (x >> 63) & 3;
unsigned int rem = sum % 5;
/* And finally adjust it to the right interval for negative values. */
return (int) (rem + ((x >> 63) & -4));
}
2020-11-30 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/97459
* internal-fn.h (expand_addsub_overflow): Declare.
* internal-fn.c (expand_addsub_overflow): No longer static.
* optabs.c (expand_doubleword_mod): New function.
(expand_binop): Optimize double-word mod with constant divisor.
* gcc.dg/pr97459-1.c: New test.
* gcc.dg/pr97459-2.c: New test.
Martin Liska [Mon, 30 Nov 2020 09:37:57 +0000 (10:37 +0100)]
changelog: Allow wildcard pattern only.
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Allow wildcard pattern only.
Kito Cheng [Fri, 20 Nov 2020 06:14:18 +0000 (14:14 +0800)]
RISC-V: Always define MULTILIB_DEFAULTS
- Define MULTILIB_DEFAULTS can reduce the total number of multilib if
the default arch and ABI are listed in the multilib config.
- This also simplify the implementation of --with-multilib-list.
gcc/ChangeLog:
* config.gcc (riscv*-*-*): Add TARGET_RISCV_DEFAULT_ABI and
TARGET_RISCV_DEFAULT_ARCH to tm_defines.
Remove including riscv/withmultilib.h for --with-multilib-list.
* config/riscv/riscv.h (STRINGIZING): New.
(__STRINGIZING): Ditto.
(MULTILIB_DEFAULTS): Ditto.
* config/riscv/withmultilib.h: Remove.
Kito Cheng [Wed, 25 Nov 2020 09:04:33 +0000 (17:04 +0800)]
Fix print_multilib_info when default arguments appear in the option list with '!'
This issue is found when we try to always define MULTILIB_DEFAULTS for -march
and -mabi for RISC-V back-end, however `-print-multi-lib` will skip
multi-lib setting if match any one of flag in MULTILIB_DEFAULTS, even
some options are specified in the option list with '!'.
e.g.
We have default march=rv32i and mabi=ilp32.
And we have following multi-lib set:
". !march=rv32i !march=rv32im !march=rv32imafc !mabi=ilp32 !mabi=ilp32f;"
"rv32i/ilp32 march=rv32i !march=rv32im !march=rv32imafc mabi=ilp32 !mabi=ilp32f;"
"rv32im/ilp32 !march=rv32i march=rv32im !march=rv32imafc mabi=ilp32 !mabi=ilp32f;"
"rv32imafc/ilp32f !march=rv32i !march=rv32ic !march=rv32im march=rv32imafc !mabi=ilp32 mabi=ilp32f;"
`-print-multi-lib` willl show `.` and `rv32imafc/ilp32f` only, because
the mabi=ilp32 is matched, however there is `!march=rv32i` in `rv32im/ilp32`, so
`rv32im/ilp32` should keep, because it reject march=rv32i.
Note: This can be reproduced via following configure options with patch [1]:
gcc/configure --target=riscv64-elf --with-arch=rv32i --with-abi=ilp32 \
--with-multilib-generator="rv32i-ilp32--;rv32im-ilp32--;rv32imafc-ilp32f--"
[1] https://gcc.gnu.org/pipermail/gcc-patches/2020-November/559707.html
gcc/ChangeLog:
* gcc.c (print_multilib_info): Check default arguments not
appeared in multi-lib option list with '!'
Stefan Kanthak [Mon, 30 Nov 2020 01:05:46 +0000 (18:05 -0700)]
fixed _bswapsi2 function
libgcc
* libgcc2.c (bswapsi2): Make constants unsigned.
Jeff Law [Mon, 30 Nov 2020 01:03:28 +0000 (18:03 -0700)]
Fix minor bug in ft32 widening multiply
gcc/
* config/ft32/ft32.md (umulsidi3): Do not allow constants as
arguments.
GCC Administrator [Mon, 30 Nov 2020 00:16:27 +0000 (00:16 +0000)]
Daily bump.
Harald Anlauf [Sun, 29 Nov 2020 22:23:16 +0000 (23:23 +0100)]
PR fortran/98017 - Suspected regression using PACK
When substituting a parameter variable of type character, the character
length was reset to 1. Fix this by copying the length.
gcc/fortran/ChangeLog:
* expr.c (simplify_parameter_variable): Fix up character length
after copying an array-valued expression.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr98017.f90: New test.
Jan Hubicka [Sun, 29 Nov 2020 22:23:33 +0000 (23:23 +0100)]
Fix handling of ignore_stores in ipa_merge_modref_summary_after_inlining
* ipa-modref.c (ipa_merge_modref_summary_after_inlining): Fix
handling of ignore_stores.
Jan Hubicka [Sun, 29 Nov 2020 22:22:24 +0000 (23:22 +0100)]
Fix freeing of thunk-info
PR jit/97867
* symtab-thunks.h (thunk_info::release): Use ggc_delete.
Martin Sebor [Sun, 29 Nov 2020 22:09:30 +0000 (15:09 -0700)]
Handle PHIs in compute_objsize.
PR middle-end/92936 - missing warning on a past-the-end store to a PHI
PR middle-end/92940 - incorrect offset and size in -Wstringop-overflow for out-of-bounds store into VLA and two offset ranges
PR middle-end/89428 - missing -Wstringop-overflow on a PHI with variable offset
gcc/ChangeLog:
PR middle-end/92936
PR middle-end/92940
PR middle-end/89428
* builtins.c (access_ref::access_ref): Initialize member.
(access_ref::phi): New function.
(access_ref::get_ref): New function.
(access_ref::add_offset): Remove duplicate assignment.
(maybe_warn_for_bound): Add "maybe" kind of warning messages.
(warn_for_access): Same.
(inform_access): Rename...
(access_ref::inform_access): ...to this. Print PHI arguments. Format
offset the same as size and simplify. Improve printing of allocation
functions and VLAs.
(check_access): Adjust to the above.
(gimple_parm_array_size): Change argument.
(handle_min_max_size): New function.
* builtins.h (class ssa_name_limit_t): Move class here from
tree-ssa-strlen.c.
(struct access_ref): Declare new members.
(gimple_parm_array_size): Change argument.
* tree-ssa-strlen.c (maybe_warn_overflow): Use access_ref and simplify.
(handle_builtin_memcpy): Correct argument passed to maybe_warn_overflow.
(handle_builtin_memset): Same.
(class ssa_name_limit_t): Move class to builtins.{h,c}.
gcc/testsuite/ChangeLog:
PR middle-end/92936
PR middle-end/92940
PR middle-end/89428
* c-c++-common/Wstringop-overflow-2.c: Adjust text of expected
informational notes.
* g++.dg/warn/Wstringop-overflow-3.C: Same.
* g++.dg/warn/Wplacement-new-size.C: Remove a test for a no longer
issued warning.
* gcc.dg/Warray-bounds-43.c: Removed unused declarations.
* gcc.dg/Wstringop-overflow-11.c: Remove xfails.
* gcc.dg/Wstringop-overflow-12.c: Same.
* gcc.dg/Wstringop-overflow-17.c: Adjust text of expected messages.
* gcc.dg/Wstringop-overflow-27.c: Same. Remove xfails.
* gcc.dg/Wstringop-overflow-28.c: Adjust text of expected messages.
* gcc.dg/Wstringop-overflow-29.c: Same.
* gcc.dg/Wstringop-overflow-37.c: Same.
* gcc.dg/Wstringop-overflow-46.c: Same.
* gcc.dg/Wstringop-overflow-47.c: Same.
* gcc.dg/Wstringop-overflow-54.c: Same.
* gcc.dg/warn-strnlen-no-nul.c: Add expected warning.
* gcc.dg/Wstringop-overflow-7.c: New test.
* gcc.dg/Wstringop-overflow-58.c: New test.
* gcc.dg/Wstringop-overflow-59.c: New test.
* gcc.dg/Wstringop-overflow-60.c: New test.
* gcc.dg/Wstringop-overflow-61.c: New test.
* gcc.dg/Wstringop-overflow-62.c: New test.
* gcc.dg/Wstringop-overflow-63.c: New test.
* gcc.dg/Wstringop-overflow-64.c: New test.
Iain Buclaw [Sat, 28 Nov 2020 20:40:51 +0000 (21:40 +0100)]
d: Add darwin support for D language front-end
gcc/ChangeLog:
* config.gcc (*-*-darwin*): Set d_target_objs and target_has_targetdm.
* config/elfos.h (TARGET_D_MINFO_SECTION): New macro.
(TARGET_D_MINFO_START_NAME): New macro.
(TARGET_D_MINFO_END_NAME): New macro.
* config/t-darwin: Add darwin-d.o.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (D language and ABI): Add @hook for
TARGET_D_MINFO_SECTION, TARGET_D_MINFO_START_NAME, and
TARGET_D_MINFO_END_NAME.
* config/darwin-d.c: New file.
gcc/d/ChangeLog:
* d-target.def (d_minfo_section): New hook.
(d_minfo_start_name): New hook.
(d_minfo_end_name): New hook.
* modules.cc: Include d-target.h.
(register_moduleinfo): Update to use new targetdm hooks.
Iain Buclaw [Sat, 28 Nov 2020 18:38:52 +0000 (19:38 +0100)]
configure: Support building D front-end on *-*-darwin*
The bootstrap has been confirmed to be succeeding, there's no need to
set it as an unsupported language.
ChangeLog:
PR d/87788
* configure.ac: Don't disable D for *-*-darwin*.
* configure: Regenerate.
John David Anglin [Sun, 29 Nov 2020 20:07:46 +0000 (20:07 +0000)]
Fix hppa64-hpux11 build to remove source paths from embedded path.
This change adds the +nodefaultrpath ld option to remove all library
paths that were specified with the -L option from the embedded path.
2020-11-29 John David Anglin <danglin@gcc.gnu.org>
ChangeLog:
* libtool.m4 (archive_cmds): Add +nodefaultrpath ld option on
hppa64-*-hpux11*.
libatomic/ChangeLog:
* configure: Regenerate.
libbacktrace/ChangeLog:
* configure: Regenerate.
libcc1/ChangeLog:
* configure: Regenerate.
libffi/ChangeLog:
* configure: Regenerate.
libgfortran/ChangeLog:
* configure: Regenerate.
libgomp/ChangeLog:
* configure: Regenerate.
libhsail-rt/ChangeLog:
* configure: Regenerate.
libitm/ChangeLog:
* configure: Regenerate.
libobjc/ChangeLog:
* configure: Regenerate.
liboffloadmic/ChangeLog:
* configure: Regenerate.
* plugin/configure: Regenerate.
libquadmath/ChangeLog:
* configure: Regenerate.
libsanitizer/ChangeLog:
* configure: Regenerate.
libssp/ChangeLog:
* configure: Regenerate.
libstdc++-v3/ChangeLog:
* configure: Regenerate.
libvtv/ChangeLog:
* configure: Regenerate.
lto-plugin/ChangeLog:
* configure: Regenerate.
zlib/ChangeLog:
* configure: Regenerate.
John David Anglin [Sun, 29 Nov 2020 15:57:40 +0000 (15:57 +0000)]
Fix PR ada/97504 on hppa*-*-hpux*.
2020-11-29 John David Anglin <danglin@gcc.gnu.org>
gcc/ada/
PR ada/97504
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <hppa*-*-hpux*>: Use wraplf
version of Aux_Long_Long_Float.
Jan Hubicka [Sun, 29 Nov 2020 15:31:47 +0000 (16:31 +0100)]
Skip EAF_UNUSED parameters in handle_pure_call
* tree-ssa-structalias.c (handle_pure_call): Skip EAF_UNUSED
parameters.
Jan Hubicka [Sun, 29 Nov 2020 15:27:35 +0000 (16:27 +0100)]
Detect unused parameters in ipa-modref
* ipa-modref.c (modref_lattice::merge): Do nothing if F is EAF_UNUSED.
(analyze_parms): Detect unused params.
(modref_merge_call_site_flags): Merge correct EAF_UNUSED.
Iain Buclaw [Sun, 29 Nov 2020 11:49:52 +0000 (12:49 +0100)]
d: Remove d_size_t from front-end sources (PR 87788)
The typedef for d_size_t assumes that the implementation of the
front-end is written in D itself, where size_t can map only to uint32_t
or uint64_t. As that is not the case for the current D front-end, the
typedef should be removed. This would fix the bootstrap on targets where
in C++ size_t is a long, such as darwin i386.
Reviewed-on: https://github.com/dlang/dmd/pull/12008
gcc/d/ChangeLog:
PR d/87788
* dmd/MERGE: Merge upsream dmd
45fa6cfd2.
GCC Administrator [Sun, 29 Nov 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.
Eric Botcazou [Sat, 28 Nov 2020 15:37:12 +0000 (16:37 +0100)]
Improve support of simple bit-fields in -fdump-ada-spec
This fixes an issue with nested structures and adds an Alignment clause
to counter the effect of the Pack aspect.
gcc/c-family/ChangeLog:
* c-ada-spec.c (dump_nested_type) <RECORD_TYPE>: Remove obsolete code.
(dump_ada_structure): Also deal with convention, unchecked union and
bit-field for nested types. In the latter case, print an Alignment
aspect along with the Pack aspect.
Ian Lance Taylor [Fri, 27 Nov 2020 00:11:28 +0000 (16:11 -0800)]
compiler: avoid follow-on errors for bad types
Mark bad types as erroneous, to avoid generating further errors.
This required some code using array types to check for errors.
For https://golang.org/issue/19880
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273626
Ian Lance Taylor [Thu, 26 Nov 2020 21:15:41 +0000 (13:15 -0800)]
compiler: better error for x, x := 1, 2
Was
assign.go:59:28: error: multiple assignments to x
Now
assign.go:59:28: error: ‘x’ repeated on left side of :=
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273546
Eric Botcazou [Sat, 28 Nov 2020 11:54:48 +0000 (12:54 +0100)]
Fix PR target/97939
The little dance around 4096 that add/sub instructions do on the SPARC
needs to be taken into account for the overflow arithmetic operations.
It cannot be done for unsigned overflow, but it can be done for signed
overflow.
gcc/ChangeLog:
PR target/97939
* config/sparc/predicates.md (arith_double_add_operand): Comment.
* config/sparc/sparc.md (uaddvdi4): Use arith_double_operand.
(addvdi4): Use arith_double_add_operand.
(addsi3): Remove useless attributes.
(addvsi4): Use arith_add_operand.
(*cmp_ccv_plus): Likewise and add second alternative accordingly.
(*cmp_ccxv_plus): Likewise.
(*cmp_ccv_plus_set): Likewise.
(*cmp_ccxv_plus_set): Likewise.
(*cmp_ccv_plus_sltu_set): Likewise.
(usubvdi4): Use arith_double_operand.
(subvdi4): Use arith_double_add_operand.
(subsi3): Remove useless attributes.
(subvsi4): Use arith_add_operand.
(*cmp_ccv_minus): Likewise and add second alternative accordingly.
(*cmp_ccxv_minus): Likewise.
(*cmp_ccv_minus_set): Likewise.
(*cmp_ccxv_minus_set): Likewise.
(*cmp_ccv_minus_sltu_set): Likewise.
(negsi2): Use register_operand.
(unegvsi3): Likewise.
(negvsi3) Likewise.
(*cmp_ccnz_neg): Likewise.
(*cmp_ccxnz_neg): Likewise.
(*cmp_ccnz_neg_set): Likewise.
(*cmp_ccxnz_neg_set): Likewise.
(*cmp_ccc_neg_set): Likewise.
(*cmp_ccxc_neg_set): Likewise.
(*cmp_ccc_neg_sltu_set): Likewise.
(*cmp_ccv_neg): Likewise.
(*cmp_ccxv_neg): Likewise.
(*cmp_ccv_neg_set): Likewise.
(*cmp_ccxv_neg_set): Likewise.
(*cmp_ccv_neg_sltu_set): Likewise.
gcc/testsuite/ChangeLog:
* gcc.target/sparc/overflow-6.c: New test.
Thomas Koenig [Sat, 28 Nov 2020 11:36:28 +0000 (12:36 +0100)]
Generate correct fn specs for some Fortran library functions.
This patch works by generating the correct fn spec from the
actual arguments in specific_intrinsic_symbol, and by passing this
down via gfc_get_extern_function_decl to gfc_get_function_type.
CSHIFT remains to be done.
gcc/fortran/ChangeLog:
PR fortran/97454
* trans-decl.c (gfc_get_extern_function_decl): Add argument
fnspec.
* trans-intrinsic.c (MAX_SPEC_ARG): Define.
(intrinsic_fnspec): New function.
(ADD_CHAR): Define.
(specific_intrinsic_symbol): Adjust comment. Pass
fn spec to gfc_get_extern_function_decl.
(gfc_conv_intrinsic_funcall): Add ANY, ALL, NORM2, PRODUCT
and SUM intrnisic. Add FIXME for cshift et al.
* trans-types.c (gfc_get_function_type): Add fnspec argument,
handle it.
* trans-types.h (gfc_get_function_type): Add optinal fnspec
argument.
* trans.h (gfc_get_extern_function_decl): Likewise.
GCC Administrator [Sat, 28 Nov 2020 00:16:38 +0000 (00:16 +0000)]
Daily bump.
Martin Sebor [Fri, 27 Nov 2020 23:04:30 +0000 (16:04 -0700)]
Revert previous change and use pragma to suppress -Wformat-diag.
gcc/cp/ChangeLog:
* error.c (add_quotes): Revert previous change and use pragma to
suppress -Wformat-diag.
Joseph Myers [Fri, 27 Nov 2020 22:40:01 +0000 (22:40 +0000)]
preprocessor: Fix #line overflow check [PR97602]
The preprocessor check for overflow (of linenum_type = unsigned int)
when reading the line number in a #line directive is incomplete; it
checks "reg < reg_prev" which doesn't cover all cases where
multiplying by 10 overflowed. Fix this by checking for overflow
before rather than after it occurs (using essentially the same logic
as used by e.g. glibc printf when reading width and precision values
from strings).
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
libcpp/
2020-11-27 Joseph Myers <joseph@codesourcery.com>
PR preprocessor/97602
* directives.c (strtolinenum): Check for overflow before it
occurs. Correct comment.
gcc/testsuite/
2020-11-27 Joseph Myers <joseph@codesourcery.com>
PR preprocessor/97602
* gcc.dg/cpp/line9.c, gcc.dg/cpp/line10.c: New tests.
Iain Buclaw [Fri, 27 Nov 2020 12:15:44 +0000 (13:15 +0100)]
libphobos: Fix segfault at run-time when using custom Fibers (PR 98025)
When libphobos is configured with --enable-cet, this adds extra fields
to the Fiber class to support the ucontext_t fallback implementation.
These fields get omitted when compiling user code unless they also used
`-fversion=CET' to build their project, which resulted in data being
overwritten from within swapcontext().
On reviewing the ucontext_t definitions, it was found that the shadow
stack fields were missing, and the struct size didn't match up on X32.
This has been fixed in upstream druntime and merged down here.
Reviewed-on: https://github.com/dlang/druntime/pull/3293
libphobos/ChangeLog:
PR d/98025
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac (DCFG_ENABLE_CET): Substitute.
* libdruntime/MERGE: Merge upstream druntime
0fe7974c.
* libdruntime/Makefile.in: Regenerate.
* libdruntime/core/thread.d: Import gcc.config.
(class Fiber): Add ucontext_t fields when GNU_Enable_CET is true.
* libdruntime/gcc/config.d.in (GNU_Enable_CET): Define.
* src/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
Iain Buclaw [Thu, 26 Nov 2020 10:31:25 +0000 (11:31 +0100)]
d: Merge upstream dmd
db0df3f7e.
Removes all support code and tests for the extern(Pascal) calling
convention.
Reviewed-on: https://github.com/dlang/dmd/pull/11994
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd
db0df3f7e.
* types.cc (TypeVisitor::visit (TypeFunction *)): Remove LINKpascal.
Iain Buclaw [Thu, 26 Nov 2020 10:23:11 +0000 (11:23 +0100)]
libphobos: Merge upstream druntime
d37ef985.
Adds support for FreeBSD/x86 53-bit precision reals, updates bindings
for FreeBSD 12.x, and removes all support code and tests for the
extern(Pascal) calling convention.
Reviewed-on: https://github.com/dlang/druntime/pull/3286
https://github.com/dlang/druntime/pull/3287
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime
d37ef985.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_FREEBSD): Add
core/sys/freebsd/config.d
* libdruntime/Makefile.in: Regenerate.
Iain Buclaw [Thu, 26 Nov 2020 10:15:32 +0000 (11:15 +0100)]
libphobos: Merge upstream phobos
38873fe6e.
Adds support for FreeBSD/x86 53-bit precision reals, and removes all
support code and tests for the extern(Pascal) calling convention.
Reviewed-on: https://github.com/dlang/phobos/pull/7704
https://github.com/dlang/phobos/pull/7705
libphobos/ChangeLog:
* src/MERGE: Merge upstream phobos
38873fe6e.
Iain Buclaw [Thu, 26 Nov 2020 09:46:36 +0000 (10:46 +0100)]
d: Add float and double overloads for all core.math intrinsics
For the math intrinsics: cos, fabs, ldexp, rint, rndtol, and sin, new
overloads have been added to the core.math module for matching float and
double types. These have been implemented in the compiler.
A recent change to dump_function_to_file started triggering some
scan-tree-dump tests to FAIL, these have been adjusted as well when
updating the test.
gcc/d/ChangeLog:
* intrinsics.cc (maybe_expand_intrinsic): Handle new intrinsics.
* intrinsics.def (INTRINSIC_COS): Add float and double overloads.
(INTRINSIC_FABS): Likewise.
(INTRINSIC_LDEXP): Likewise.
(INTRINSIC_RINT): Likewise.
(INTRINSIC_RNDTOL): Likewise.
(INTRINSIC_SIN): Likewise.
(INTRINSIC_TOPREC): Adjust signature.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime
5e4492c4.
gcc/testsuite/ChangeLog:
* gdc.dg/intrinsics.d: Adjust patterns in scan-tree-dump.
Uros Bizjak [Fri, 27 Nov 2020 17:41:56 +0000 (18:41 +0100)]
testsuite/i386: Fix XOP and FMA4 checking functions [PR98036].
Add missing returns and remove unnecessary postfix increments.
2020-11-27 Uroš Bizjak <ubizjak@gmail.com>
PR testsuite/98036
gcc/testsuite/
* gcc.target/i386/fma4-256-maccXX.c (check_maccps):
Remove unnecessary postfix increment on a returned variable.
(check_maccpd): Ditto.
* gcc.target/i386/fma4-256-msubXX.c (check_msubps): Ditto.
(check_msubpd): Ditto.
* gcc.target/i386/fma4-256-nmaccXX.c (check_nmaccps): Ditto.
(check_nmaccpd): Ditto.
* gcc.target/i386/fma4-256-nmsubXX.c (check_nmsubps): Ditto.
(check_nmsubpd): Ditto.
* gcc.target/i386/fma4-maccXX.c (check_maccps): Ditto.
(check_maccpd): Ditto.
(check_maccss): Ditto.
(check_maccsd): Ditto.
* gcc.target/i386/fma4-msubXX.c (check_msubps): Ditto.
(check_msubpd): Ditto.
(check_msubss): Ditto.
(check_msubsd): Ditto.
* gcc.target/i386/fma4-nmaccXX.c (check_nmaccps): Ditto.
(check_nmaccpd): Ditto.
(check_nmaccss): Ditto.
(check_nmaccsd): Ditto.
* gcc.target/i386/fma4-nmsubXX.c (check_nmsubps): Ditto.
(check_nmsubpd): Ditto.
(check_nmsubss): Ditto.
(check_nmsubsd): Ditto.
* gcc.target/i386/xop-haddX.c (check_sbyte2word): Add missing return.
(check_sbyte2dword):
Remove unnecessary postfix increment on a returned value.
(check_sbyte2qword): Ditto.
(check_sword2dword): Add missing return.
(check_sword2qword):
Remove unnecessary postfix increment on a returned value.
(check_dword2qword): Add missing return.
* gcc.target/i386/xop-hadduX.c (check_byte2word): Add missing return.
(check_byte2dword):
Remove unnecessary postfix increment on a returned value.
(check_byte2qword): Ditto.
(check_word2dword): Add missing return.
(check_word2qword):
Remove unnecessary postfix increment on a returned value.
(check_word2qword): Add missing return.
* gcc.target/i386/xop-hsubX.c (check_sbyte2word): Add missing return.
(check_sword2dword): Ditto.
(check_sword2qword): Ditto.
Jonathan Wakely [Fri, 27 Nov 2020 00:21:52 +0000 (00:21 +0000)]
libstdc++: Refactor dejagnu effective-target checks
This introduces two new procs to replace boilerplate in the
effective-target checks.
libstdc++-v3/ChangeLog:
* testsuite/lib/libstdc++.exp (v3_try_preprocess): Define
new proc to preprocess a chunk of code.
(v3_check_preprocessor_condition): Define new proc to test
a preprocessor condition depending on GCC or libstdc++ macros.
(check_v3_target_debug_mode, check_v3_target_normal_mode):
Use v3_try_preprocess.
(check_v3_target_normal_namespace)
(check_v3_target_parallel_mode, check_v3_target_cstdint)
(check_v3_target_cmath, check_v3_target_atomic_builtins)
(check_v3_target_gthreads, check_v3_target_gthreads_timed)
(check_v3_target_sleep, check_v3_target_sched_yield)
(check_v3_target_string_conversions, check_v3_target_swprintf)
(check_v3_target_binary_io, check_v3_target_nprocs): Use
v3_check_preprocessor_condition.
(check_effective_target_cxx11): Likewise.
(check_effective_target_random_device): Likewise.
(check_effective_target_tbb-backend): Likewise.
(check_effective_target_futex): Likewise.
(check_v3_target_little_endian) Call check_effective_target_le.
(check_effective_target_atomic-builtins): New proc to define
new effective-target keyword.
(check_effective_target_gthreads-timed): Likewise.
H.J. Lu [Fri, 27 Nov 2020 13:39:56 +0000 (05:39 -0800)]
INSTALL: Default to --enable-cet=auto
PR other/98027
* doc/install.texi: Default to --enable-cet=auto.
Thomas Schwinge [Fri, 27 Nov 2020 10:54:50 +0000 (11:54 +0100)]
In 'gcc/omp-oacc-kernels-decompose.cc:flatten_binds', don't choke on empty GIMPLE sequence
Also, instead of just examining the first statement of inner 'GIMPLE_BIND' (via
'inner_sequence' being a 'typedef gimple *gimple_seq'), in fact examine all
statements contained therein, which I suppose must've been the intention here.
This "fixes" the testcase 'c-c++-common/goacc/kernels-decompose-ice-2.c' (which
now runs into the same ICE as 'c-c++-common/goacc/kernels-decompose-ice-1.c',
etc.).
gcc/
* omp-oacc-kernels-decompose.cc (flatten_binds): Don't choke on
empty GIMPLE sequence, and examine all statements contained in
inner 'GIMPLE_BIND'.
gcc/testsuite/
* c-c++-common/goacc/kernels-decompose-ice-1.c: Adjust.
* c-c++-common/goacc/kernels-decompose-ice-2.c: Likewise.
Jonathan Wakely [Fri, 27 Nov 2020 12:15:44 +0000 (12:15 +0000)]
libstdc++: Fix -Wrange-loop-construct warnings in filesystem tests
Many tests do `for (const path& p : test_paths)` where test_paths is an
array of strings. To avoid -Wrange-loop-construct warnings the loop
variable should be an object, not a reference bound to a temporary.
libstdc++-v3/ChangeLog:
* testsuite/27_io/filesystem/operations/absolute.cc: Avoid
-Wrange-loop-construct warning.
* testsuite/27_io/filesystem/path/append/source.cc: Likewise.
* testsuite/27_io/filesystem/path/assign/copy.cc: Likewise.
* testsuite/27_io/filesystem/path/compare/path.cc: Likewise.
* testsuite/27_io/filesystem/path/construct/copy.cc: Likewise.
* testsuite/27_io/filesystem/path/decompose/extension.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/filename.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/parent_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/relative_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/root_directory.cc:
Likewise.
* testsuite/27_io/filesystem/path/decompose/root_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/itr/traversal.cc: Likewise.
* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc:
Likewise.
* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc:
Likewise.
* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc:
Likewise.
* testsuite/27_io/filesystem/path/nonmember/append.cc: Likewise.
* testsuite/27_io/filesystem/path/nonmember/cmp.cc: Likewise.
* testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc:
Likewise.
* testsuite/27_io/filesystem/path/nonmember/hash_value.cc:
Likewise.
* testsuite/27_io/filesystem/path/query/has_extension.cc:
Likewise.
* testsuite/27_io/filesystem/path/query/has_filename.cc:
Likewise.
* testsuite/27_io/filesystem/path/query/has_parent_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/query/has_relative_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/query/has_root_directory.cc:
Likewise.
* testsuite/27_io/filesystem/path/query/has_root_name.cc:
Likewise.
* testsuite/27_io/filesystem/path/query/has_root_path.cc:
Likewise.
* testsuite/27_io/filesystem/path/query/has_stem.cc: Likewise.
* testsuite/27_io/filesystem/path/query/is_relative.cc: Likewise.
* testsuite/experimental/filesystem/operations/absolute.cc:
Likewise.
* testsuite/experimental/filesystem/path/assign/copy.cc: Likewise.
* testsuite/experimental/filesystem/path/compare/path.cc:
Likewise.
* testsuite/experimental/filesystem/path/construct/copy.cc:
Likewise.
* testsuite/experimental/filesystem/path/decompose/extension.cc:
Likewise.
* testsuite/experimental/filesystem/path/decompose/filename.cc:
Likewise.
* testsuite/experimental/filesystem/path/decompose/parent_path.cc:
Likewise.
* testsuite/experimental/filesystem/path/decompose/relative_path.cc:
Likewise.
* testsuite/experimental/filesystem/path/decompose/root_directory.cc:
Likewise.
* testsuite/experimental/filesystem/path/decompose/root_path.cc:
Likewise.
* testsuite/experimental/filesystem/path/itr/traversal.cc:
Likewise.
* testsuite/experimental/filesystem/path/modifiers/remove_filename.cc:
Likewise.
* testsuite/experimental/filesystem/path/modifiers/replace_extension.cc:
Likewise.
* testsuite/experimental/filesystem/path/modifiers/replace_filename.cc:
Likewise.
* testsuite/experimental/filesystem/path/nonmember/hash_value.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/has_extension.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/has_filename.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/has_parent_path.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/has_relative_path.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/has_root_directory.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/has_root_name.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/has_root_path.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/has_stem.cc:
Likewise.
* testsuite/experimental/filesystem/path/query/is_relative.cc:
Likewise.
Martin Liska [Fri, 27 Nov 2020 12:43:25 +0000 (13:43 +0100)]
changelog: allow flexible "cherry picked" format.
It handles the following:
(cherry picked from commit
c0c7270cc4efd896fe99f8ad5409dbef089a407f (testsuite changes only))
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Use regex for cherry pick prefix.
* gcc-changelog/test_email.py: Test it.
* gcc-changelog/test_patches.txt: Likewise.
Jonathan Wakely [Fri, 27 Nov 2020 11:00:15 +0000 (11:00 +0000)]
libstdc++: Partially revert r11-5314
The changes in r11-5314 are broken, because it means we don't use
__gthread_once for the first few initializations, but after the program
becomes multi-threaded we will repeat the initialization, using
__gthread_once once this time. This leads to memory errors.
The use of __is_single_threaded() in locale::id::_M_id() is OK, because
the side effects are the same either way.
libstdc++-v3/ChangeLog:
* src/c++98/locale.cc (locale::facet::_S_get_c_locale()):
Revert change to use __is_single_threaded.
* src/c++98/locale_init.cc (locale::_S_initialize()):
Likewise.
Richard Biener [Fri, 27 Nov 2020 11:01:25 +0000 (12:01 +0100)]
tree-optimization/98024 - fix rnflow regression
The change to make PRE insertion iterate less had a typo in checking
successors RPO state. Fixing this exposes that regular PRE insertion
when facing a value that is the same on all edges inserts an
assignment in place of a PHI node but fails to set up things so that
this insertion is not repeated (it correctly does not return
'new_stuff'). But with the new iteration scheme this causes us
to repeatedly insert such assignment and change AVAIL_OUT over to
the newly inserted expression. The fix is to treat this as PHI
and insert into PHI_GEN, avoiding repetitive insertion.
2020-11-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/98024
* tree-ssa-pre.c (insert): Fix successor RPO order check.
(do_pre_regular_insertion): When inserting an assignment
in place of an all-same-value PHI still record that into
PHI_GEN.
Tobias Burnus [Fri, 27 Nov 2020 10:45:14 +0000 (11:45 +0100)]
gfortran.dg/gomp/requires-4.f90: Fix !$omp clause
gcc/testsuite/
* gfortran.dg/gomp/requires-4.f90: Fix typo in '!$omp' clause.
Tobias Burnus [Fri, 27 Nov 2020 10:40:11 +0000 (11:40 +0100)]
gfortran.dg/gomp/requires-4.f90: Fix !$omp syntax
gcc/testsuite/
* gfortran.dg/gomp/requires-4.f90: Fix '!$omp' syntax.
Jakub Jelinek [Fri, 27 Nov 2020 10:38:31 +0000 (11:38 +0100)]
tree-ssanames: Allow non-SSA_NAME arguments to get_range_info
My recent match.pd change required quite a lot of code due to the separate
need to handle INTEGER_CSTs and SSA_NAMEs, and after all, I didn't even
handle one case there, when in x * y / y the x is INTEGER_CST and y is
SSA_NAME.
The following patch allows to simplify it, by allowing non-SSA_NAME argument
to get_range_info, for INTEGER_CSTs it will return VR_RANGE with *min == *max
equal to the constnat, and for non-INTEGER_CST/SSA_NAMEs it will just return
VR_VARYING.
This allows not to simplify just the match.pd, but some other spots too.
2020-11-27 Jakub Jelinek <jakub@redhat.com>
* tree-ssanames.c (get_range_info): Handle INTEGER_CST by returning
VR_RANGE with both *min and *max set to the wide_int value of the
INTEGER_CST. Return VR_VARYING for non-SSA_NAMEs.
* match.pd ((t * 2) / 2) -> t): Handle also @0 being INTEGER_CST.
Simplify by calling get_range_info on everything.
* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Simplify by calling
get_range_info on everything.
* tree-scalar-evolution.c (iv_can_overflow_p): Likewise.
Jakub Jelinek [Fri, 27 Nov 2020 10:23:45 +0000 (11:23 +0100)]
gimple-fold: Fix another __builtin_clear_padding ICE
When playing with __builtin_bit_cast, I have noticed __builtin_clear_padding
ICE on the G class below. The artificial field with D type has offset 0
and size 8 bytes, but the following artificial field with E type has offset
0 and size 0, so it triggers the asserts that we don't move current position
backwards. Fixed by ignoring is_empty_type (TREE_TYPE (field)) fields, all
of their bits are padding which is what is added when skipping over to next
field anyway.
2020-11-27 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/88101
* gimple-fold.c (clear_padding_type): Ignore fields with is_empty_type
types.
* g++.dg/torture/builtin-clear-padding-3.C: New test.
Tobias Burnus [Fri, 27 Nov 2020 10:17:50 +0000 (11:17 +0100)]
OpenACC: Fix integer-type issue with collapse/tile [PR97880]
gcc/ChangeLog:
PR c/97880
* omp-expand.c (expand_oacc_collapse_init, expand_oacc_collapse_vars):
Use now passed diff_type.
(expand_oacc_for): Take largest type for diff_type, taking tiling
and collapsing into account.
gcc/testsuite/ChangeLog:
PR c/97880
* gcc.dg/goacc/tile-1.c: New test.
Kyrylo Tkachov [Fri, 27 Nov 2020 09:19:33 +0000 (09:19 +0000)]
aarch64: Introduce --param=aarch64-autovec-preference to select autovec preference in backend
This is a patch that introduces the aarch64-autovec-preference that can
take values from 0 - 4, 0 being the default.
It can be used to override the autovectorisation preferences in the
backend:
0 - use default scheme
1 - only use Advanced SIMD
2 - only use SVE
3 - use Advanced SIMD and SVE, prefer Advanced SIMD in the event of a
tie (as determined by costs)
4 - use Advanced SIMD and SVE, prefer SVE in the event of a tie (as
determined by costs)
It can valuable for experimentation when comparing SVE and Advanced SIMD
autovectorisation strategies.
It achieves this adjusting the order of the interleaved SVE and Advanced
SIMD modes in aarch64_autovectorize_vector_modes.
It also adjusts aarch64_preferred_simd_mode to use the new comparison
function to pick Advanced SIMD or SVE to start with.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
* config/aarch64/aarch64.opt
(-param=aarch64-autovec-preference): Define.
* config/aarch64/aarch64.c (aarch64_override_options_internal):
Set aarch64_sve_compare_costs to 0 when preferring only Advanced
SIMD.
(aarch64_cmp_autovec_modes): Define.
(aarch64_preferred_simd_mode): Adjust to use the above.
(aarch64_autovectorize_vector_modes): Likewise.
* doc/invoke.texi: Document aarch64-autovec-preference param.
Eric Botcazou [Fri, 6 Nov 2020 12:51:45 +0000 (13:51 +0100)]
[Ada] Small tweaks to couple of Value routines
gcc/ada/
* libgnat/s-valuef.adb (Integer_To_Fixed): Take into account the
extra digit when scaling up the input.
* libgnat/s-valuer.adb (Scan_Decimal_Digits): Restrict previous
change to fixed-point types.
(Scan_Integral_Digits): Likewise.
Piotr Trojanek [Fri, 6 Nov 2020 08:43:43 +0000 (09:43 +0100)]
[Ada] Simplify Parent_Is_Boolean with subtype memberships
gcc/ada/
* sem_res.adb (Parent_Is_Boolean): Simplify.
(Resolve_Op_Not): Reduce scope of a local variable.
Piotr Trojanek [Thu, 5 Nov 2020 10:35:26 +0000 (11:35 +0100)]
[Ada] Reuse Append_New_Elmt where possible
gcc/ada/
* cstand.adb: Simplify with Append_New_Elmt.
* sem_util.adb: Likewise.
Arnaud Charlet [Thu, 5 Nov 2020 09:48:28 +0000 (04:48 -0500)]
[Ada] Wrong compile time evaluation of Shift_Right
gcc/ada/
* sem_eval.adb (Fold_Shift): Fix evaluation of Shift_Right on
negative values.
Arnaud Charlet [Mon, 2 Nov 2020 09:17:02 +0000 (10:17 +0100)]
[Ada] Reference before declaration on C392015
gcc/ada/
* exp_ch6.adb (Expand_Call): Properly split
Transform_Function_Array and Modify_Tree_For_C.
Piotr Trojanek [Thu, 5 Nov 2020 20:09:28 +0000 (21:09 +0100)]
[Ada] Restore access type instead of mode out parameter
gcc/ada/
* sem_eval.ads (Compile_Time_Compare): Restore parameter Diff to
be of an access type.
* sem_eval.adb (Compile_Time_Compare): Adapt body and callers.
* sem_attr.adb (Eval_Attribute): Adapt callers.
Eric Botcazou [Thu, 5 Nov 2020 12:28:16 +0000 (13:28 +0100)]
[Ada] Small improvement to System.Value_R.Scan_Raw_Real
gcc/ada/
* libgnat/s-valuer.adb (Scan_Decimal_Digits): Round Extra.
(Scan_Integral_Digits): Likewise.
Yannick Moy [Wed, 4 Nov 2020 15:11:51 +0000 (16:11 +0100)]
[Ada] Do not apply range checks inside generics in GNATprove mode
gcc/ada/
* checks.adb (Selected_Range_Checks): Adapt the condition for
applying range checks so that it is not done inside generics.
Eric Botcazou [Wed, 4 Nov 2020 16:27:17 +0000 (17:27 +0100)]
[Ada] Do not use 128-bit division for 64-bit fixed-point types
gcc/ada/
* exp_fixd.adb (Build_Double_Divide): Only use a 128-bit
division if one of the operands is larger than 64 bits.
(Build_Double_Divide_Code): Likewise.
(Build_Scaled_Divide): Likewise.
(Build_Scaled_Divide_Code): Likewise.
Arnaud Charlet [Wed, 4 Nov 2020 13:58:47 +0000 (08:58 -0500)]
[Ada] To_GM_Time returning invalid value for Invalid_Time
gcc/ada/
* libgnat/s-os_lib.adb (To_GM_Time): Return valid and consistent
values for Invalid_Time.
Steve Baird [Wed, 21 Oct 2020 23:57:04 +0000 (16:57 -0700)]
[Ada] Implement AI12-0187 (Stable properties of abstract data types)
gcc/ada/
* snames.ads-tmpl: Define new Name_Stable_Properties Name_Id
value.
* aspects.ads, aspects.adb: Add new Aspect_Stable_Properties
enumeration literal to Aspect_Id type. Add Class_Present
parameter to Find_Aspect and related
functions (Find_Value_Of_Aspect and Has_Aspect).
* sem_util.adb (Has_Nontrivial_Precondition): Fix
previously-latent bug uncovered by adding Class_Present
parameter to Aspect.Find_Aspect. The code was wrong before, but
with the change the bug was more likely to make a user-visible
difference.
* sem_ch6.adb (Analyze_Operator_Symbol): If a string literal
like "abs" or "-" occurs in a Stable_Properties aspect
specification, then it is to be interpreted as an operator
symbol and not as a string literal.
* sem_ch13.ads: Export new Parse_Aspect_Stable_Properties
function, analogous to the existing Parse_Aspect_Aggregate
exported procedure.
* sem_ch13.adb: (Parse_Aspect_Stable_Properties): New function;
analogous to existing Parse_Aspect_Aggregate.
(Validate_Aspect_Stable_Properties): New procedure; analogous to
existing Validate_Aspect_Aggregate. Called from the same case
statement (casing on an Aspect_Id value) where
Validate_Aspect_Aggregate is called.
(Resolve_Aspect_Stable_Properties): New procedure; analogous to
existing Resolve_Aspect_Aggregate. Called from the same two case
statements (each casing on an Aspect_Id value) where
Resolve_Aspect_Aggregate is called.
(Analyze_Aspect_Specifications): Set Has_Delayed_Aspects and
Is_Delayed_Aspect attributes for Aspect_Stable_Properties aspect
specifications.
(Check_Aspect_At_End_Of_Declarations): The syntactic
"expression" for a Stable_Properties aspect specification is not
semantically an expression; it doesn't have a type. Thus, force
T to be empty in this case.
* contracts.adb (Expand_Subprogram_Contract): Add call to new
local procedure,
Expand_Subprogram_Contract.Add_Stable_Property_Contracts, which
generates Postcondition pragmas corresponding to stable property
checks.