gcc.git
4 years agointernal/syscall/unix: use getrandom_linux_generic.go on riscv
Tobias Klauser [Mon, 15 Jun 2020 11:57:39 +0000 (13:57 +0200)]
internal/syscall/unix: use getrandom_linux_generic.go on riscv

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/237899

4 years agoOptimize assignment to volatile aggregate variable
Eric Botcazou [Mon, 15 Jun 2020 17:56:00 +0000 (19:56 +0200)]
Optimize assignment to volatile aggregate variable

gimplify_modify_expr_rhs has an optimization whereby the assignment to
an aggregate variable from a read-only object with a DECL_INITIAL is
optimized into the direct assignment of the DECL_INITIAL, provided that
no temporary is created in the process.

The optimization is blocked if the read-only object is volatile, which
is OK as per the semantics of volatile, but also if the target variable
is volatile, on the grounds that the modified assignment might end up
being done on a per field basis, which is also OK.  But this latter
restriction is enforced a priori and there are cases where the modified
assignment would be OK, for example if there is only one field or the
DECL_INITIAL is equivalent to the empty CONSTRUCTOR, i.e. all zeros.

So, in the latter case, the patch changes gimplify_modify_expr_rhs to ask
gimplify_init_constructor whether the assignment would be done as a block,
which is easy because gimplify_init_constructor knows that it must create
a temporary if the LHS is volatile and this would not be the case, so it's
just a matter of completing the NOTIFY_TEMP_CREATION mechanism.

gcc/ChangeLog
* gimplify.c (gimplify_init_constructor) <AGGREGATE_TYPE>: Declare
new ENSURE_SINGLE_ACCESS constant and move variables down.  If it is
true and all elements are zero, then always clear.  Return GS_ERROR
if a temporary would be created for it and NOTIFY_TEMP_CREATION set.
(gimplify_modify_expr_rhs) <VAR_DECL>: If the target is volatile but
the type is aggregate non-addressable, ask gimplify_init_constructor
whether it can generate a single access to the target.

gcc/testsuite/ChangeLog
* gnat.dg/aggr30.ads, gnat.dg/aggr30.adb: New test.

4 years agoFix ICE in verify_sra_access_forest
Eric Botcazou [Mon, 15 Jun 2020 17:42:11 +0000 (19:42 +0200)]
Fix ICE in verify_sra_access_forest

This fixes an issue with reverse storage order in SRA, which is caught
by the built-in verifier in verify_sra_access_forest.  The problem is
that propagate_subaccesses_from_rhs changes the type of an access
from aggregate to scalar and, as discussed elsewhere, this must be
done with extra care in the presence of reverse storage order.

gcc/ChangeLog
* tree-sra.c (propagate_subaccesses_from_rhs): When a non-scalar
access on the LHS is replaced with a scalar access, propagate the
TYPE_REVERSE_STORAGE_ORDER flag of the type of the original access.

gcc/testsuite/ChangeLog
* gnat.dg/opt85.ads, gnat.dg/opt85.adb: New test.

4 years agolibstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20
Jonathan Wakely [Mon, 15 Jun 2020 13:31:26 +0000 (14:31 +0100)]
libstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20

Although not required by SD-6 or the C++20 draft, we define the macro
__cpp_lib_constexpr_char_traits to indicate support for P0432R1. This
updates the value in C++20 mode for the P1032R1 changes to char_traits.

* include/bits/char_traits.h (__cpp_lib_constexpr_char_traits):
Update value for C++20.
* include/std/version (__cpp_lib_constexpr_char_traits): Likewise.
* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
Update expected value.
* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
Likewise.

4 years agolibstdc++: Fix char_traits move with overlap
Paul Keir [Mon, 15 Jun 2020 13:31:26 +0000 (14:31 +0100)]
libstdc++: Fix char_traits move with overlap

Upon constexpr evaluation, char_traits move uses copy_backward, but its
last argument should be to the range end rather than its beginning.

2020-06-12  Paul Keir  <paul.keir@uws.ac.uk>

* include/bits/char_traits.h (char_traits::move): constexpr move with
overlap was using copy_backward incorrectly.
* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
New test.

4 years agogcc: xtensa: make TARGET_HAVE_TLS definition static
Max Filippov [Sun, 14 Jun 2020 08:07:01 +0000 (01:07 -0700)]
gcc: xtensa: make TARGET_HAVE_TLS definition static

Remove TARGET_THREADPTR reference from TARGET_HAVE_TLS to avoid
static data initialization dependency on xtensa core configuration.

2020-06-15  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/xtensa.c (TARGET_HAVE_TLS): Remove
TARGET_THREADPTR reference.
(xtensa_tls_symbol_p, xtensa_tls_referenced_p): Use
targetm.have_tls instead of TARGET_HAVE_TLS.
(xtensa_option_override): Set targetm.have_tls to false in
configurations without THREADPTR.

4 years agogcc: xtensa: add -mabi option for call0/windowed ABI
Max Filippov [Mon, 13 Apr 2020 06:53:32 +0000 (23:53 -0700)]
gcc: xtensa: add -mabi option for call0/windowed ABI

2020-06-15  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/elf.h (ASM_SPEC, LINK_SPEC): Pass ABI switch to
assembler/linker.
* config/xtensa/linux.h (ASM_SPEC, LINK_SPEC): Ditto.
* config/xtensa/uclinux.h (ASM_SPEC, LINK_SPEC): Ditto.
* config/xtensa/xtensa.c (xtensa_option_override): Initialize
xtensa_windowed_abi if needed.
* config/xtensa/xtensa.h (TARGET_WINDOWED_ABI_DEFAULT): New
macro.
(TARGET_WINDOWED_ABI): Redefine to xtensa_windowed_abi.
* config/xtensa/xtensa.opt (xtensa_windowed_abi): New target
option variable.
(mabi=call0, mabi=windowed): New options.
* doc/invoke.texi: Document new -mabi= Xtensa-specific options.

gcc/testsuite/
* gcc.target/xtensa/mabi-call0.c: New test.
* gcc.target/xtensa/mabi-windowed.c: New test.

libgcc/
* configure: Regenerate.
* configure.ac: Use AC_COMPILE_IFELSE instead of manual
preprocessor invocation to check for __XTENSA_CALL0_ABI__.

4 years agogcc: xtensa: make register elimination data static
Max Filippov [Mon, 15 Jun 2020 05:09:36 +0000 (22:09 -0700)]
gcc: xtensa: make register elimination data static

Remove ABI reference from the ELIMINABLE_REGS to avoid static data
initialization dependency on xtensa core configuration.

2020-06-15  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/xtensa.c (xtensa_can_eliminate): New function.
(TARGET_CAN_ELIMINATE): New macro.
* config/xtensa/xtensa.h
(XTENSA_WINDOWED_HARD_FRAME_POINTER_REGNUM)
(XTENSA_CALL0_HARD_FRAME_POINTER_REGNUM): New macros.
(HARD_FRAME_POINTER_REGNUM): Define using
XTENSA_*_HARD_FRAME_POINTER_REGNUM.
(ELIMINABLE_REGS): Replace lines with HARD_FRAME_POINTER_REGNUM
by lines with XTENSA_WINDOWED_HARD_FRAME_POINTER_REGNUM and
XTENSA_CALL0_HARD_FRAME_POINTER_REGNUM.

4 years agoBRIG FE testsuite: Fix all dump-scans
Martin Jambor [Mon, 15 Jun 2020 09:45:24 +0000 (11:45 +0200)]
BRIG FE testsuite: Fix all dump-scans

since Alexandre's revamp of dump files handling in
r11-627-g1dedc12d186, BRIG FE has been receiving slightly different
-dumpbase (e.g. smoke_test.brig instead of smoke_test.hsail.brig when
compiling file smoke_test.hsail.brig) and the testsuite then could not
find the generated dump files it wanted to scan.  I have not really
looked into why that changed, the easiest fix seems to me to remove
the hsail part already when generating the binary brig file from the
textual HSAIL representation.

gcc/testsuite/ChangeLog:

2020-06-09  Martin Jambor  <mjambor@suse.cz>

* lib/brig.exp (brig_target_compile): Strip hsail extension when
gnerating the name of the binary brig file.

4 years agovect: Use LOOP_VINFO_DATAREFS and LOOP_VINFO_DDRS consistently
Fei Yang [Sat, 13 Jun 2020 02:42:49 +0000 (10:42 +0800)]
vect: Use LOOP_VINFO_DATAREFS and LOOP_VINFO_DDRS consistently

Minor code refactorings in tree-vect-data-refs.c and tree-vect-loop.c.
Use LOOP_VINFO_DATAREFS and LOOP_VINFO_DDRS when possible and rename
several parameters to make code more consistent.

2020-06-13  Felix Yang  <felix.yang@huawei.com>

gcc/
* tree-vect-data-refs.c (vect_verify_datarefs_alignment): Rename
parameter to loop_vinfo and update uses.  Use LOOP_VINFO_DATAREFS
when possible.
(vect_analyze_data_refs_alignment): Likewise, and use LOOP_VINFO_DDRS
when possible.
* tree-vect-loop.c (vect_dissolve_slp_only_groups): Use
LOOP_VINFO_DATAREFS when possible.
(update_epilogue_loop_vinfo): Likewise.

4 years ago[Ada] Rewrite Sem_Eval.Predicates_Match predicate
Eric Botcazou [Thu, 2 Apr 2020 20:14:04 +0000 (22:14 +0200)]
[Ada] Rewrite Sem_Eval.Predicates_Match predicate

2020-06-15  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_eval.ads (Predicates_Match): Fix description.
* sem_eval.adb (Predicates_Match): Rewrite.

4 years ago[Ada] Makefile.rtl: minor file renamings
Ed Falis [Wed, 1 Apr 2020 18:20:15 +0000 (14:20 -0400)]
[Ada] Makefile.rtl: minor file renamings

2020-06-15  Ed Falis  <falis@adacore.com>

gcc/ada/

* Makefile.rtl: Change name of hie/g-io__vxworks-ppc-cert.adb.

4 years ago[Ada] Improve error message on premature usage of subtypes
Arnaud Charlet [Thu, 2 Apr 2020 07:39:15 +0000 (03:39 -0400)]
[Ada] Improve error message on premature usage of subtypes

2020-06-15  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_ch8.adb (Premature_Usage): Add support for subtype
references and replace set of if-then-else by a case statement.

4 years ago[Ada] Do expect task discriminants in Global and Depends contracts
Piotr Trojanek [Wed, 1 Apr 2020 16:19:40 +0000 (18:19 +0200)]
[Ada] Do expect task discriminants in Global and Depends contracts

2020-06-15  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_prag.adb (Analyze_Depends_In_Decl_Part,
Analyze_Global_In_Decl_Part): Bring back task discriminants for
analysis of the Global/Depends contracts; add comments.

4 years ago[Ada] Implement AI12-0343 Return Statement Checks
Eric Botcazou [Wed, 1 Apr 2020 17:13:06 +0000 (19:13 +0200)]
[Ada] Implement AI12-0343 Return Statement Checks

2020-06-15  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* einfo.ads (Return_Applies_To): Document special usage for E_Block.
* einfo.adb (Write_Field8_Name): Write it for E_Block too.
* exp_ch4.adb (Expand_N_Type_Conversion): Remove implementation of
the check prescribed by AI05-0073.
* exp_ch6.adb (Apply_CW_Accessibility_Check): New procedure to apply
the check prescribed by AI95-344 extracted from...
(Expand_N_Extended_Return_Statement): Apply the check prescribed by
AI95-344 to the expression, if present.  Suppress only access checks
when analyzing the rewritten result.
(Expand_Simple_Function_Return): ...here.  Rename local variable.
Call Apply_CW_Accessibility_Check to apply the check prescribed by
AI95-344, but do not do it for the simple return statement generated
by the expansion of an extended return statement.  Apply the check
prescribed by AI05-0073 to all functions returning anonymous access
type designating a specific tagged type, but not if the expression
was null or tag checks are suppressed for the type, and use Not In
operator rather than comparing the tags explicitly.
* sem.adb (Analyze): Handle all Suppress values.
* sem_ch6.adb (Analyze_Function_Return): Do not explicitly apply
predicate checks in the case of an extended return statement.
Do not apply an implicit conversion to the anonymous access result
type in the case of the simple return statement generated by the
expansion of an extended return statement.
(New_Overloaded_Entity): Small comment tweak.
* treepr.adb (Print_Node): Fix typo in flag string.

4 years ago[Ada] T'Image calls T'Put_Image
Bob Duff [Tue, 31 Mar 2020 22:59:11 +0000 (18:59 -0400)]
[Ada] T'Image calls T'Put_Image

2020-06-15  Bob Duff  <duff@adacore.com>

gcc/ada/

* exp_put_image.ads, exp_put_image.adb
(Image_Should_Call_Put_Image): New function to determine whether
the call to Put_Image should be generated.
(Build_Image_Call): New procedure to generate the call to
Put_Image.
* exp_imgv.adb (Expand_Image_Attribute): Use underlying types to
bypass privacy (only in Ada 2020). If
Image_Should_Call_Put_Image is True (which happens only in Ada
2020), then call Build_Image_Call.
* rtsfind.ads, rtsfind.adb: Add the necessary declarations in
Ada.Strings.Text_Output.Buffers.
* sem_attr.adb (Check_Image_Type): Enable the Ada 2020 case.
* libgnat/a-stoufo.ads, libgnat/a-stoufo.adb: Use the less
restrictive type that allows newline characters.

4 years ago[Ada] Minor editorial changes in comments
Gary Dismukes [Wed, 1 Apr 2020 16:38:16 +0000 (12:38 -0400)]
[Ada] Minor editorial changes in comments

2020-06-15  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

* exp_ch9.ads (Build_Master_Declaration): Add commas.
* exp_ch9.adb (Build_Master_Entity): Spelling fix ("build" =>
"built").
(Build_Task_Activation_Call): Fix word order.

4 years ago[Ada] Allow uninitialized values on Big_Positive/Natural
Arnaud Charlet [Wed, 1 Apr 2020 15:46:22 +0000 (11:46 -0400)]
[Ada] Allow uninitialized values on Big_Positive/Natural

2020-06-15  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* libgnat/a-nbnbin.ads (Big_Positive, Big_Natural): Fix
predicate.

4 years ago[Ada] Fix analysis of Relaxed_Initialization for bodies-as-specs
Piotr Trojanek [Wed, 1 Apr 2020 09:43:39 +0000 (11:43 +0200)]
[Ada] Fix analysis of Relaxed_Initialization for bodies-as-specs

2020-06-15  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): Fix
dealing with scopes on subprogram bodies that act as specs.
* sem_util.adb (Has_Relaxed_Initialization): Fix trivial
mistake.

4 years ago[Ada] Crash in tagged type constructor with task components
Javier Miranda [Sat, 28 Mar 2020 18:52:14 +0000 (14:52 -0400)]
[Ada] Crash in tagged type constructor with task components

2020-06-15  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* restrict.ads (Set_Global_No_Tasking, Global_No_Tasking): New
subprograms.
* restrict.adb (Set_Global_No_Tasking, Global_No_Tasking): New
subprograms.
* sem_ch3.adb (Access_Definition): Do not skip building masters
since they may be required for BIP calls.
(Analyze_Subtype_Declaration): Propagate attribute
Is_Limited_Record in class-wide subtypes and subtypes with
cloned subtype attribute; propagate attribute
Is_Limited_Interface.
* sem_ch6.adb (Check_Anonymous_Return): Do not skip building
masters since they may be required for BIP calls. Use
Build_Master_Declaration to declare the _master variable.
(Create_Extra_Formals): Add decoration of Has_Master_Entity when
the _master formal is added.
* exp_ch3.adb (Init_Formals): Adding formal to decorate it with
attribute Has_Master_Entity when the _master formal is added.
(Build_Master): Do not skip building masters since they may be
required for BIP calls.
(Expand_N_Object_Declaration): Ensure activation chain and
master entity for objects initialized with BIP function calls.
* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Adding support to detect and save restriction No_Tasking when
set in the run-time package System or in a global configuration
pragmas file.
* sem_util.adb (Current_Entity_In_Scope): Overload this
subprogram to allow searching for an entity by its Name.
* sem_util.ads (Current_Entity_In_Scope): Update comment.
* exp_ch4.adb (Expand_N_Allocator): Do not skip building masters
since they may be required for BIP calls.
* exp_ch6.ads (Might_Have_Tasks): New subprogram.
* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Add
support for BIP calls returning objects that may have tasks.
(Make_Build_In_Place_Call_In_Allocator): Build the activation
chain if the result might have tasks.
(Make_Build_In_Place_Iface_Call_In_Allocator): Build the class
wide master for the result type.
(Might_Have_Tasks): New subprogram.
(Needs_BIP_Task_Actuals): Returns False when restriction
No_Tasking is globally set.
* exp_ch9.ads (Build_Master_Declaration): New subprogram.
* exp_ch9.adb (Build_Activation_Chain_Entity): No action
performed when restriction No_Tasking is globally set.
(Build_Class_Wide_Master): No action performed when restriction
No_Tasking is globally set; use Build_Master_Declaration to
declare the _master variable.
(Build_Master_Declaration): New subprogram.
(Build_Master_Entity): No action performed when restriction
No_Tasking is globally set; added support to handle transient
scopes and _finalizer routines.
(Build_Master_Renaming): No action performed when restriction
No_Tasking is globally set.
(Build_Task_Activation_Call): Skip generating the call when
the chain is an ignored ghost entity.
(Find_Master_Scope): Generalize the code that detects transient
scopes with master entity.
* einfo.ads (Has_Nested_Subprogram): Minor comment reformatting.

4 years ago[Ada] Missing errors on aspect checking
Arnaud Charlet [Wed, 25 Mar 2020 10:15:26 +0000 (06:15 -0400)]
[Ada] Missing errors on aspect checking

2020-06-15  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_attr.adb (Eval_Attribute): Protect against previous
errors.
* sem_ch13.adb (Analyze_Aspect_Default_Value): Remove redundant
error checking, handling in Analyze_Aspect_Specifications.
(Analyze_Aspect_Specifications): Refine error messages on
Default_[Component_]Value.
(Check_Aspect_Too_Late): New procedure.
(Rep_Item_Too_Late.Is_Derived_Type_With_Constraint): Remove,
dead code.
* aspects.ads (Is_Representation_Aspect): Default_Value is a
representation aspect.

4 years ago[Ada] AI12-0260 Functions Is_Basic and To_Basic in Wide_Characters.Handling
Arnaud Charlet [Tue, 31 Mar 2020 11:47:17 +0000 (07:47 -0400)]
[Ada] AI12-0260 Functions Is_Basic and To_Basic in Wide_Characters.Handling

2020-06-15  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* libgnat/a-wichha.ads, libgnat/a-wichha.adb,
libgnat/a-wichun.ads, libgnat/a-wichun.adb (Is_Basic, To_Basic):
New.
* libgnat/s-utf_32.ads, libgnat/s-utf_32.adb (Is_UTF_32_Basic,
To_UTF_32_Basic, Decomposition_Search): New subprograms.
(Unicode_Decomposition): New table.

4 years ago[Ada] Passing actual parameter values to out formals when Default_Value is set
Gary Dismukes [Tue, 31 Mar 2020 22:27:06 +0000 (18:27 -0400)]
[Ada] Passing actual parameter values to out formals when Default_Value is set

2020-06-15  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

* exp_ch6.adb (Add_Call_By_Copy_Code): In the case of a view
conversion passed to a scalar out-mode parameter where the
formal has Default_Value set, declare the copy temp with the
base type of the formal's subtype and initialize the copy temp
with the actual's value.

4 years ago[Ada] Bad access checks on if/case expression as actual
Justin Squirek [Thu, 12 Mar 2020 11:01:43 +0000 (07:01 -0400)]
[Ada] Bad access checks on if/case expression as actual

2020-06-15  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* exp_ch4.adb (Expand_N_Case_Expression): Set default value for
Target to silence potential warnings.
(Expand_N_If_Expression): Add calculation to check when the if
expression is used directly in the context of an actual of an
anonymous access type and add a special path to force expansion
of the if expression in this case.
* exp_ch6.adb (Expand_Branch): Generate an assignment to the
level temporary for a given branch.
(Expand_Call_Helper): Add expansion to allow for creating a
temporary to store associated accessiblity levels on each branch
of the conditional expression.  Also perform expansion of
function calls into expressions with actions, and fixup
references to N with Call_Node.
(Insert_Level_Assign): Move through nested conditional
expressions to each branch.
* sem_util.ads, sem_util.adb (Is_Anonymous_Access_Actual): Added
to detect when to force expansion of if expressions.

4 years ago[Ada] Do not expect task discriminants in Global and Depends contracts
Piotr Trojanek [Tue, 31 Mar 2020 12:49:14 +0000 (14:49 +0200)]
[Ada] Do not expect task discriminants in Global and Depends contracts

2020-06-15  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_prag.adb (Analyze_Depends_In_Decl_Part,
Analyze_Global_In_Decl_Part): Do not install task discriminants
for analysis of the Global/Depends contracts.

4 years ago[Ada] Do not expect Global or Depends on single protected objects
Piotr Trojanek [Thu, 26 Mar 2020 19:31:21 +0000 (20:31 +0100)]
[Ada] Do not expect Global or Depends on single protected objects

2020-06-15  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* contracts.adb (Analyze_Object_Contract): Do not expect
Global/Depends on single protected units.

4 years ago[Ada] Incorrect accessibility checks on functions calls
Justin Squirek [Mon, 30 Mar 2020 09:35:22 +0000 (05:35 -0400)]
[Ada] Incorrect accessibility checks on functions calls

2020-06-15  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* sem_res.adb (Valid_Conversion): Add missing condition to
trigger proper static accessiblity failiures when the target
type is an anonymous access.

4 years ago[Ada] Replace repeated Ekind with Ekind_In
Piotr Trojanek [Mon, 23 Mar 2020 23:04:11 +0000 (00:04 +0100)]
[Ada] Replace repeated Ekind with Ekind_In

2020-06-15  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* exp_ch6.adb (Expand_Call_Helper): Replace repeated Ekind with
Ekind_In.

4 years ago[Ada] Remove excessive parens
Piotr Trojanek [Tue, 24 Mar 2020 09:27:10 +0000 (10:27 +0100)]
[Ada] Remove excessive parens

2020-06-15  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* exp_ch6.adb, sem_util.adb: Remove excessive parents,
especially since they don't make the code any easier to read.

4 years ago[Ada] Support aspect Relaxed_Initialization and attribute Initialized
Piotr Trojanek [Fri, 27 Mar 2020 22:39:03 +0000 (23:39 +0100)]
[Ada] Support aspect Relaxed_Initialization and attribute Initialized

2020-06-15  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* aspects.ads (Aspect_Id): Add Aspect_Relaxed_Initialization.
(Implementation_Defined_Aspect): Add new aspect.
(Aspect_Argument): Add new aspect with Optional_Expression
argument.
(Is_Representation_Aspect): Add new aspect as a
non-representation one.
(Aspect_Names): Add name for the new aspect.
(Aspect_Delay): Add new aspect as a non-delayed one.
* sem_ch3.adb: Minor reformatting.
* einfo.ads, einfo.adb (Is_Relaxed_Initialization_State): New
query; reuses existing code for querying abstract state options.
* exp_attr.adb (Expand_N_Attribute_Reference): For now ignore
attribute 'Initialized.
* sem_attr.adb (Analyze_Attribute_Old_Result): Allow attribute
'Result to be used in the aspect Relaxed_Initialization
expression.
(Analyze_Attribute): Analyze attribute 'Initialized; based on
existing code for attribute 'Valid_Scalars.
(Eval_Attribute): Do not expect attribute 'Initialized, just
like attribute 'Valid_Scalars is not expected.
* sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): New
routine.
(Analyze_Aspect_Specifications): Analyze new aspect in a
dedicated routine.
(Check_Aspect_At_Freeze_Point): Do not expect new aspect.
* sem_prag.adb (Analyze_Abstract_State): Support option
Relaxed_Initialization on abstract states.
* sem_util.ads, sem_util.adb (Has_Relaxed_Initialization): New
query for the GNATprove backend.
* snames.ads-tmpl (Snames): Add Name_Ids for the new aspect and
attribute; add an Attribute_Id for the new attribute.

4 years ago[Ada] Put_Image: Enable for access-to-subprogram types
Bob Duff [Mon, 30 Mar 2020 19:34:28 +0000 (15:34 -0400)]
[Ada] Put_Image: Enable for access-to-subprogram types

2020-06-15  Bob Duff  <duff@adacore.com>

gcc/ada/

* exp_put_image.adb, libgnat/s-putima.adb, libgnat/s-putima.ads,
rtsfind.ads: Enable Put_Image if Is_Access_Subprogram_Type (Typ).
Remove comment saying it's disabled in that case.  Rename
Put_Image_Access_Prot to be Put_Image_Access_Prot_Subp to
clarify that we're talking about access-to-subprogram, not
access-to-protected-object.

4 years ago[Ada] Clean up error handling of 'Image
Bob Duff [Mon, 30 Mar 2020 14:20:33 +0000 (10:20 -0400)]
[Ada] Clean up error handling of 'Image

2020-06-15  Bob Duff  <duff@adacore.com>

gcc/ada/

* sem_attr.adb (Check_Image_Type): New procedure for checking
the type, depending on language version. Disable the Ada 2020
support until the corresponding expander work is done.
(Analyze_Image_Attribute): Call Check_Image_Type.  Rearrange the
code to be simplier and more logical.  When P_Type is modified,
modify P_Base_Type accordingly.
* sem_util.adb (Is_Object_Image): Do not return False if the
prefix is a type. X'Image should be considered an image of an
object iff X is an object (albeit illegal pre-2020 if
nonscalar).

4 years ago[Ada] Put_Image: Enable for access-to-subprogram types
Bob Duff [Mon, 30 Mar 2020 14:18:34 +0000 (10:18 -0400)]
[Ada] Put_Image: Enable for access-to-subprogram types

2020-06-15  Bob Duff  <duff@adacore.com>

gcc/ada/

* libgnat/s-putima.ads, libgnat/s-putima.adb
(Put_Image_Access_Subp, Put_Image_Access_Prot): New procedures
for printing access-to-subprogram objects.  Remove an explicit
" ", because Put_Image includes the annoying leading blank.
* rtsfind.ads: Add new procedures in s-putima.
* exp_put_image.adb: Call new procedures as appropriate.

4 years ago[Ada] Put_Image: Implement for private types with full real type
Bob Duff [Mon, 30 Mar 2020 14:16:49 +0000 (10:16 -0400)]
[Ada] Put_Image: Implement for private types with full real type

2020-06-15  Bob Duff  <duff@adacore.com>

gcc/ada/

* exp_imgv.adb (Expand_Image_Attribute): Allow private types.
Put_Image generates Image for numeric types, and private types
whose full type is numeric. This requires the Conversion_OK flag
for integer and floating-point types. For fixed point, we need
the extra conversion.
* exp_put_image.adb (Build_Elementary_Put_Image_Call): Remove
special handling of real types.
(Enable_Put_Image): Enable for reals.

4 years ago[Ada] Put_Image improvements for strings
Bob Duff [Mon, 30 Mar 2020 14:14:27 +0000 (10:14 -0400)]
[Ada] Put_Image improvements for strings

2020-06-15  Bob Duff  <duff@adacore.com>

gcc/ada/

* exp_attr.adb (Put_Image): Use underlying type for strings.
Remove unchecked union processing.
* exp_put_image.adb (Tagged_Put_Image_Enabled): Use -gnatd_z to
enable default Put_Image for tagged types.  This allows testing
that feature.
(Build_String_Put_Image_Call): Set Conversion_OK flag.
(Make_Component_List_Attributes): Remove unchecked union
processing.
(Enable_Put_Image): Disable for unchecked unions.  Enable for
nonscalar types (which were mistakenly disabled in earlier
changes).
* debug.adb: Document -gnatd_z switch.
* libgnat/s-putima.adb (Put_Image_String, Put_Image_Wide_String,
Put_Image_Wide_Wide_String): Double double-quote characters.
Forget about special handling of control characters for now --
that's rare enough to not be a priority, and it's not clear what
the right thing to do is anyway.
* namet.adb: Minor: Improve debugger-friendliness.
* sinfo.ads: Minor: Add "???" comment.

4 years ago[Ada] Remove unreferenced and dubious Is_Renaming_Declaration
Piotr Trojanek [Wed, 25 Mar 2020 19:04:54 +0000 (20:04 +0100)]
[Ada] Remove unreferenced and dubious Is_Renaming_Declaration

2020-06-15  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_util.ads, sem_util.adb (Is_Renaming_Declaration): Remove.

4 years ago[Ada] Link failure with call to expression function in precondition
Ed Schonberg [Mon, 30 Mar 2020 12:26:27 +0000 (08:26 -0400)]
[Ada] Link failure with call to expression function in precondition

2020-06-15  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* freeze.adb (Freeze_Expression): When traversing the tree
looking for the proper insertion point for the freeze node of an
entity that is declared in an outer scope, set the candidate
subprogram body node properly.  Previous code has an off-by-one
error.

4 years ago[Ada] Implement AI12-0077 Has_Same_Storage on objects of size zero
Eric Botcazou [Mon, 30 Mar 2020 10:38:01 +0000 (12:38 +0200)]
[Ada] Implement AI12-0077 Has_Same_Storage on objects of size zero

2020-06-15  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference) <Has_Same_Storage>:
Do not do superfluous work.  Add the condition (X'Size /= 0) on
both paths and turn binary AND into short-circuit AND THEN.

4 years ago[Ada] Update 'Loop_Entry checking to match changes in 'Old rules.
Steve Baird [Fri, 27 Mar 2020 22:50:29 +0000 (15:50 -0700)]
[Ada] Update 'Loop_Entry checking to match changes in 'Old rules.

2020-06-15  Steve Baird  <baird@adacore.com>

gcc/ada/

* sem_attr.adb (Analyze_Attribute): In the Loop_Entry case,
replace a call to Statically_Denotes_Object with a call to
Statically_Names_Object and clean up the preceding comment.

4 years ago[Ada] Use uniform type resolution for membership tests
Eric Botcazou [Sun, 29 Mar 2020 13:42:31 +0000 (15:42 +0200)]
[Ada] Use uniform type resolution for membership tests

2020-06-15  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_res.adb (Resolve_Set_Membership): Remove local variable.
In the non-overloaded case, call Intersect_Types on the left
operand and the first alternative to get the resolution type.
But test the subtype of the left operand to give the warning.

4 years agoRISC-V: Suppress warning for signed and unsigned integer comparison.
Kito Cheng [Mon, 15 Jun 2020 03:51:13 +0000 (11:51 +0800)]
RISC-V: Suppress warning for signed and unsigned integer comparison.

gcc/ChangeLog:

* config/riscv/riscv.c (riscv_gen_gpr_save_insn): Change type to
unsigned for i.
(riscv_gpr_save_operation_p): Change type to unsigned for i and
len.

4 years agoOptimize multiplication for V8QI,V16QI,V32QI under TARGET_AVX512BW.
liuhongt [Wed, 3 Jun 2020 09:25:47 +0000 (17:25 +0800)]
Optimize multiplication for V8QI,V16QI,V32QI under TARGET_AVX512BW.

2020-06-13   Hongtao Liu  <hongtao.liu@intel.com>

gcc/ChangeLog:
PR target/95488
* config/i386/i386-expand.c (ix86_expand_vecmul_qihi): New
function.
* config/i386/i386-protos.h (ix86_expand_vecmul_qihi): Declare.
* config/i386/sse.md (mul<mode>3): Drop mask_name since
there's no real simd int8 multiplication instruction with
mask. Also optimize it under TARGET_AVX512BW.
(mulv8qi3): New expander.

gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512bw-pr95488-1.c: New test.
* gcc.target/i386/avx512bw-pr95488-2.c: Ditto.
* gcc.target/i386/avx512vl-pr95488-1.c: Ditto.
* gcc.target/i386/avx512vl-pr95488-2.c: Ditto.

4 years agoDaily bump.
GCC Administrator [Mon, 15 Jun 2020 00:16:21 +0000 (00:16 +0000)]
Daily bump.

4 years agoAvoid crash when global symbol table is empty with -fdump-fortran-global.
Thomas Koenig [Sun, 14 Jun 2020 15:37:49 +0000 (17:37 +0200)]
Avoid crash when global symbol table is empty with -fdump-fortran-global.

This just avoids a crash with -fdump-fortran-global when the
global symbol table is empty.  This is strictly a developer's
option, no user impact.

gcc/fortran/ChangeLog:

2020-06-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/42122
* dump-parse-tree.c (gfc_dump_global_symbols):  If the symroot is
empty, just output "empty".

4 years agoPR fortran/95088 - Buffer overflows with PDTs, submodules and long symbols
Harald Anlauf [Sun, 14 Jun 2020 14:12:47 +0000 (16:12 +0200)]
PR fortran/95088 - Buffer overflows with PDTs, submodules and long symbols

With PDTs (parameterized derived types) and submodules, name mangling
results in variably long internal symbols.  Instead of using a fixed-size
intermediate buffer, which is actually not really needed, just use a
pointer to strings.

2020-06-14  Harald Anlauf  <anlauf@gmx.de>

gcc/fortran/
PR fortran/95088
* class.c (get_unique_type_string): Replace use of fixed size
buffer by internally passing a pointer to strings.

4 years agoAlways use locations from get and put arguments for error messages.
Thomas Koenig [Sun, 14 Jun 2020 12:39:03 +0000 (14:39 +0200)]
Always use locations from get and put arguments for error messages.

A simple and obvios patch - the error location was taken
from a variable that was not initialized for optional
variables.

gcc/fortran/ChangeLog:

* check.c (gfc_check_random_seed): Always use locations
from get and put arguments for error messages.

gcc/testsuite/ChangeLog:

* gfortran.dg/random_seed_4.f90: New test.

4 years agoWhen avoiding double deallocation, look at namespace, expression and component.
Thomas Koenig [Sun, 14 Jun 2020 11:01:24 +0000 (13:01 +0200)]
When avoiding double deallocation, look at namespace, expression and component.

Our finalization handling is a mess.  Really, we should get to try and get
this fixed for gcc 11.

In the meantime, here is a patch which fixes a regression I introduced
when fixing a regression with a memory leak.  The important thing
here is to realize that we do not need to finalize (and deallocate)
multiple times for the same expression and the same component
in the same namespace.  It might cause code size regressions, but
better big code than wrong code...

gcc/fortran/ChangeLog:

PR fortran/94109
* class.c (finalize_component): Return early if finalization has
already happened for expression and component within namespace.
* gfortran.h (gfc_was_finalized): New type.
(gfc_namespace): Add member was_finalzed.
(gfc_expr): Remove finalized.
* symbol.c (gfc_free_namespace): Free was_finalized.

gcc/testsuite/ChangeLog:

PR fortran/94109
* gfortran.dg/finalize_34.f90: Adjust free counts.
* gfortran.dg/finalize_36.f90: New test.

4 years agod: Fix line lengths after mechanical field renames.
Iain Buclaw [Sun, 14 Jun 2020 09:42:01 +0000 (11:42 +0200)]
d: Fix line lengths after mechanical field renames.

gcc/d/ChangeLog:

* expr.cc (ExprVisitor::visit (AssocArrayLiteralExp *)): Fix line
lengths, no functional change.
* typeinfo.cc (TypeInfoVisitor::layout_interfaces): Likewise.
(layout_classinfo_interfaces): Likewise.

4 years agotestsuite: Re-add gdc.test prefix in test names (PR testsuite/95575)
Iain Buclaw [Sun, 14 Jun 2020 09:02:52 +0000 (11:02 +0200)]
testsuite: Re-add gdc.test prefix in test names (PR testsuite/95575)

gcc/testsuite/ChangeLog:

PR testsuite/95575
* lib/gdc-utils.exp (gdc-do-test): Re-add $subdir link and inclusion
in filename.

4 years agoDaily bump.
GCC Administrator [Sun, 14 Jun 2020 00:16:18 +0000 (00:16 +0000)]
Daily bump.

4 years agoCorrect test to avoid failures in ILP32.
Martin Sebor [Sat, 13 Jun 2020 17:29:01 +0000 (11:29 -0600)]
Correct test to avoid failures in ILP32.

Amends: PR middle-end/95353 - spurious -Wstringop-overflow writing to a trailing array plus offset.

gcc/testsuite/ChangeLog:
* gcc.dg/builtin-stringop-chk-5.c: Make assertions independent of
data model.

4 years agoRemove failing test case accidentally committed.
Thomas Koenig [Sat, 13 Jun 2020 09:40:52 +0000 (11:40 +0200)]
Remove failing test case accidentally committed.

When committing 0cfc34ad1293a5e19f1dc67c461c58d99222ac9d, I
accidentylly committed gcc/testsuite/gfortran.dg/finalize_36.f90 .
This removes this, again.

gcc/testsuite/ChangeLog:

* gfortran.dg/finalize_36.f90: Remove accidentally
committed test case.

4 years agoDisable -Wstringop-overflow warning after checking code path of caller.
Thomas Koenig [Sat, 13 Jun 2020 08:04:33 +0000 (10:04 +0200)]
Disable -Wstringop-overflow warning after checking code path of caller.

The warning that is disabled, only on this single line, has been
inspected and found to be not applicable; it is known that the size
of the buffer is safe.

libgfortran/ChangeLog:

2020-06-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR libfortran/95313
* io/write.c (ztoa_big): Disable -Wstringop-overflow for one
line.

4 years agoDaily bump.
GCC Administrator [Sat, 13 Jun 2020 00:16:25 +0000 (00:16 +0000)]
Daily bump.

4 years agoruntime: fix arenaBaseOffset for aix/ppc
Clément Chigot [Tue, 9 Jun 2020 09:36:01 +0000 (11:36 +0200)]
runtime: fix arenaBaseOffset for aix/ppc

The arenaBaseOffset modifications was aimed only for aix/ppc64.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/237038

4 years agogo.test: update issue4085b.go to version from Go 1.13
Ian Lance Taylor [Fri, 12 Jun 2020 21:00:11 +0000 (14:00 -0700)]
go.test: update issue4085b.go to version from Go 1.13

This lets the test pass on AIX.

Not updating to master because we get slightly different error messages,
so that is a more complex change.

4 years agotsan: Add param to disable func-entry-exit instrumentation
Marco Elver [Wed, 10 Jun 2020 14:21:21 +0000 (16:21 +0200)]
tsan: Add param to disable func-entry-exit instrumentation

Adds param tsan-instrument-func-entry-exit, which controls if
__tsan_func_{entry,exit} calls should be emitted or not. The default
behaviour is to emit the calls.

This may be required by alternative race detection runtimes. One such
runtime is the Kernel Concurrency Sanitizer (KCSAN):

https://github.com/google/ktsan/wiki/KCSAN

After this change, GCC should satisfy all requirements for KCSAN:

https://lore.kernel.org/lkml/20200515150338.190344-7-elver@google.com/

gcc/ChangeLog:

* gimplify.c (gimplify_function_tree): Optimize and do not emit
IFN_TSAN_FUNC_EXIT in a finally block if we do not need it.
* params.opt: Add --param=tsan-instrument-func-entry-exit=.
* tsan.c (instrument_memory_accesses): Make
fentry_exit_instrument bool depend on new param.

gcc/testsuite/ChangeLog:

* c-c++-common/tsan/func_entry_exit.c: New test.
* c-c++-common/tsan/func_entry_exit_disabled.c: New test.

4 years agoAdd .clang-tidy to git ignored.
Martin Liska [Fri, 12 Jun 2020 14:02:18 +0000 (16:02 +0200)]
Add .clang-tidy to git ignored.

Installed as obvious.

ChangeLog:

* .gitignore: Add .clang-tidy.

4 years agotestcase for shared DR alignment
Richard Biener [Fri, 12 Jun 2020 11:02:56 +0000 (13:02 +0200)]
testcase for shared DR alignment

This adds a reduced C testcase from libgomp.fortran/examples-4/target-1.f90
and libgomp.fortran/examples-4/target_data-1.f90 FAILs, showing a case
of SLP instance stmt sharing that affects the shared dataref alignment
info.

2020-06-12  Richard Biener  <rguenther@suse.de>

* gcc.dg/vect/bb-slp-44.c: New testcase.

4 years agovect: Fix an ICE in vect_loop_versioning [PR95570]
Fei Yang [Fri, 12 Jun 2020 10:37:00 +0000 (11:37 +0100)]
vect: Fix an ICE in vect_loop_versioning [PR95570]

In the test case for PR95570, the only data reference in the loop is a
gather-statter access.  Scalar evolution analysis for this data reference
failed, so DR_STEP is NULL_TREE.  This leads to the segmentation fault.
We should filter out scatter-gather access in vect_enhance_data_refs_alignment.

2020-06-12  Felix Yang  <felix.yang@huawei.com>

gcc/
PR tree-optimization/95570
* tree-vect-data-refs.c (vect_relevant_for_alignment_p): New function.
(vect_verify_datarefs_alignment): Call it to filter out data references
in the loop whose alignment is irrelevant.
(vect_get_peeling_costs_all_drs): Likewise.
(vect_peeling_supportable): Likewise.
(vect_enhance_data_refs_alignment): Likewise.

gcc/testsuite/

PR tree-optimization/95570
* gcc.dg/vect/pr95570.c: New test.

4 years agofix vectorizable_condition ICE with EXTRACT_LAST_REDUCTION
Richard Biener [Fri, 12 Jun 2020 10:06:53 +0000 (12:06 +0200)]
fix vectorizable_condition ICE with EXTRACT_LAST_REDUCTION

The previous reorg missed a guard around the else clause access.

2020-06-12  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95633
* tree-vect-stmts.c (vectorizable_condition): Properly
guard the vec_else_clause access with EXTRACT_LAST_REDUCTION.

4 years agolibstdc++: Improve tests for std::atomic_flag
Jonathan Wakely [Fri, 12 Jun 2020 09:33:37 +0000 (10:33 +0100)]
libstdc++: Improve tests for std::atomic_flag

The tests for clear() and test_and_set() didn't cover all cases.

* testsuite/29_atomics/atomic_flag/clear/1.cc: Also test clear()
when the value is currently set.
* testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc:
Actually check the return value.
* testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc:
Likewise.

4 years agolibstdc++: Make std::atomic_flag::test members const
Jonathan Wakely [Fri, 12 Jun 2020 09:22:05 +0000 (10:22 +0100)]
libstdc++: Make std::atomic_flag::test members const

Also fix the tests so they run without an explicit -std=gnu++2a in the
RUNTESTFLAGS, and test the new function on const-qualified objects.

* include/bits/atomic_base.h (atomic_flag::test): Add missing
const qualifiers.
* testsuite/29_atomics/atomic_flag/test/explicit.cc: Add
dg-options and verify results of test function.
* testsuite/29_atomics/atomic_flag/test/implicit.cc: Likewise.

4 years ago[Ada] Fix anonymous-to-named access type implicit conversion legality checking
Steve Baird [Fri, 27 Mar 2020 18:56:40 +0000 (11:56 -0700)]
[Ada] Fix anonymous-to-named access type implicit conversion legality checking

2020-06-12  Steve Baird  <baird@adacore.com>

gcc/ada/

* sem_res.adb (Valid_Conversion): The simpler cases of
violations of the aforementioned 8.6 rule are already handled
correctly. These include cases where the operand of the type
conversion is an access parameter or a stand-alone object of an
anonymous access type. Add code to detect violations where the
operand of the type conversion is an access discriminant whose
accessibility level is tied to one of the other simpler cases.
This is implemented in a new function,
Valid_Conversion.Is_Discrim_Of_Bad_Access_Conversion_Argument,
which is called in place of the previous test.

4 years ago[Ada] Enable Put_Image in pre-Ada-2020 modes
Bob Duff [Fri, 27 Mar 2020 12:26:19 +0000 (08:26 -0400)]
[Ada] Enable Put_Image in pre-Ada-2020 modes

2020-06-12  Bob Duff  <duff@adacore.com>

gcc/ada/

* exp_attr.adb (Put_Image): Remove assertion. This assertion is
False in mixed-Ada-version programs.
* exp_put_image.adb (Tagged_Put_Image_Enabled): New flag to make
it easy to experiment with Put_Image on tagged types. False in
this version.
(Enable_Put_Image): Enable in pre-2020.  Workarounds: Disable
for tagged types if Tagged_Put_Image_Enabled is False. Disable
for access-to-subprogram types.  Disable if errors have been
detected, or Sink is unavailable.
(Preload_Sink): Move all conditionals here, from Sem_Ch10, so
they can be nearby related code in Enable_Put_Image.  Load Sink
only if we have seen a tagged type.  This removes the dilemma
about calling Preload_Sink when compiling the compiler, which
caused unwanted dependences.
* exp_put_image.ads (Preload_Sink): New formal Compilation_Unit,
needed to move all conditionals here, from Sem_Ch10.
* libgnat/a-stouut.adb (Put_UTF_8): Make this suitable for
inlining, so we don't get warnings about inlining in some tests.
And so it can be inlined!
* opt.ads (Tagged_Seen): New flag (see Preload_Sink).
* scng.adb (Scan): Set new Tagged_Seen flag.
* sem_ch10.adb (Analyze_Compilation_Unit): Move conditionals and
comments regarding Preload_Sink into Preload_Sink.

4 years ago[Ada] AI12-0074 View conversions and out parameters passed by copy
Arnaud Charlet [Thu, 26 Mar 2020 09:53:30 +0000 (05:53 -0400)]
[Ada] AI12-0074 View conversions and out parameters passed by copy

2020-06-12  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_res.adb (Resolve_Actuals): Check for AI12-0074.

4 years ago[Ada] Bump secondary stack alignment factor in full runtimes
Olivier Hainque [Tue, 24 Mar 2020 08:49:29 +0000 (08:49 +0000)]
[Ada] Bump secondary stack alignment factor in full runtimes

2020-06-12  Olivier Hainque  <hainque@adacore.com>

gcc/ada/

* libgnat/s-secsta.ads (Memory_Alignment): New constant, memory
alignment for chunks and allocated blocks. Initialize to
Standard'Maximum_Alignment * 2.
(Chunk_Memory): Use it.
* libgnat/s-secsta.adb (Round_Up): Likewise.

4 years ago[Ada] Alphabetic ordering for name and pragmas
Piotr Trojanek [Wed, 25 Mar 2020 17:59:04 +0000 (18:59 +0100)]
[Ada] Alphabetic ordering for name and pragmas

2020-06-12  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* par-prag.adb: Fix ordering.
* snames.ads-tmpl (Name_Test_Case, Pragma_Test_Case): Likewise.
* sem_prag.adb (Sig_Flags): Likewise.

4 years ago[Ada] Fix handling of Ada 83 OUT parameter rule
Arnaud Charlet [Wed, 25 Mar 2020 17:39:46 +0000 (13:39 -0400)]
[Ada] Fix handling of Ada 83 OUT parameter rule

2020-06-12  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* sem_res.adb (Resolve_Entity_Name): Fix handling of expressions
containing array attributes wrt Ada 83 detection.

4 years ago[Ada] Implement AI12-0369
Steve Baird [Mon, 23 Mar 2020 23:20:17 +0000 (16:20 -0700)]
[Ada] Implement AI12-0369

2020-06-12  Steve Baird  <baird@adacore.com>

gcc/ada/

* sem_util.ads, sem_util.adb: Define 3 new Boolean-valued
functions - Statically_Denotes_Entity,
Statically_Denotes_Object, and Statically_Names_Object. The
first two were taken from sem_attr.adb. The term "statically
names" is defined in the Ada RM and the new function
Statically_Names_Object is intended to reflect that definition,
or more precisely, as described in a comment in the code, to
reflect the expected future definition of that term.
* sem_attr.adb: Delete functions Statically_Denotes_Object and
Statically_Denotes_Entity; these two functions have been moved
to package Sem_Util. Replace call to Statically_Denotes_Object
with a call to Statically_Names_Object as per AI12-0217 (a
binding interpretation, so no Ada_Version check).
* exp_ch9.adb (Expand_Entry_Barrier.Is_Simple_Barrier): Change
name of function (it was previously Is_Simple_Barrier_Name)
because the function should return True in the case of a static
expression; implement this requirement.  Change function to
include a call to Statically_Names_Object so that, for Ada_2020
and later, it will return True for appropriate subcomponent
names.
(Expand_Entry_Barrier.Is_Pure_Barrier): Handle
N_Indexed_Component and N_Selected_Component cases by calling
Statically_Names_Object.
(Expand_Entry_Barrier): Reorganize to treat Simple_Barriers and
Pure_Barriers more uniformly.  Prevent cascaded errors.

4 years ago[Ada] Compiler locks up with -gnatX and formal subprogram with aspects
Ed Schonberg [Wed, 25 Mar 2020 16:49:13 +0000 (12:49 -0400)]
[Ada] Compiler locks up with -gnatX and formal subprogram with aspects

2020-06-12  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch12.adb (Find_Matching_Actual): Add guard on search loops
to detect a compilation error when using a compiler built
without assertions.
(Instantiate_Formal_Subprogram): Create a new subprogram name
for the actual only if formal has contract aspects and expansion
is enabled.

4 years ago[Ada] Improve code generated for assignment of dynamic record aggregates
Eric Botcazou [Tue, 24 Mar 2020 13:57:09 +0000 (14:57 +0100)]
[Ada] Improve code generated for assignment of dynamic record aggregates

2020-06-12  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_aggr.adb: Add with and use clauses for Sem_Mech.
(Get_Base_Object): New function to get the base object of a node.
(In_Place_Assign_OK): Add Target_Object parameter.  Deal with a
qualified expression on entry.  Remove short-circuit for array
aggregates with a single "others" choice.  Do not look into the
components of the aggregate if the parent is an allocator.
(Check_Component): Add T_OK parameter and rewrite.
(Safe_Component): Invoke Check_Component with T_OK set to False.
(Convert_To_Assignments): Try to use an in-place assignment for
any target; for that, call Get_Base_Object on the target and pass
the result to In_Place_Assign_OK.
(Expand_Array_Aggregate): Use Parent_Kind and Parent_Node more
consistently.  For an assignment, call Get_Base_Object on the
target and pass the result to In_Place_Assign_OK.

4 years ago[Ada] Don't correct socket timeout on Windows Server 2019
Dmitriy Anisimkov [Mon, 23 Mar 2020 10:16:51 +0000 (16:16 +0600)]
[Ada] Don't correct socket timeout on Windows Server 2019

2020-06-12  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

* socket.c (__gnat_minus_500ms): Use GetVersionEx to detect
Windows Server version.
* libgnat/g-sothco.ads (Minus_500ms_Windows_Timeout): Remade to
Boolean constant.
* libgnat/g-socket.adb (Set_Socket_Option): Use
Minus_500ms_Windows_Timeout constant instead of function call.

4 years ago[Ada] AI12-0350 Swap for Indefinite_Holders
Arnaud Charlet [Mon, 23 Mar 2020 08:49:13 +0000 (04:49 -0400)]
[Ada] AI12-0350 Swap for Indefinite_Holders

2020-06-12  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* libgnat/a-coinho.ads, libgnat/a-coinho.adb,
libgnat/a-coinho__shared.ads, libgnat/a-coinho__shared.adb
(Swap): New procedure.

4 years ago[Ada] Fix handling of subprograms declared in a protected body
Arnaud Charlet [Tue, 24 Mar 2020 08:40:18 +0000 (04:40 -0400)]
[Ada] Fix handling of subprograms declared in a protected body

2020-06-12  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_ch6.adb (Expand_N_Subprogram_Declaration): Do nothing for
a subprogram declared in a protected body.
* exp_ch9.ads, exp_ch9.adb
(Build_Private_Protected_Declaration): Moved to sem_ch6.adb.
(Expand_N_Protected_Body): Do nothing for a subprogram declared
in a protected body.
* sem_ch6.adb (Build_Internal_Protected_Declaration): Moved from
exp_ch9.adb and renamed and fixed to ensure in particular that
such subprograms have convention Intrinsic and have no protected
version.
(Analyze_Subprogram_Body_Helper): Call
Build_Internal_Protected_Declaration.
(Move_Pragmas): Moved up and merged with the more general
version from Build_Private_Protected_Declaration. We only want
to copy selected pragmas, most pragmas are not suitable for a
copy on the spec.

4 years ago[Ada] Diagnose illegal overriding indicators in protected bodies
Ed Schonberg [Mon, 23 Mar 2020 21:44:29 +0000 (17:44 -0400)]
[Ada] Diagnose illegal overriding indicators in protected bodies

2020-06-12  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch6.adb (Check_Overriding_Indicatior): Reject an
overriding indicator on a subprogram declared within a protected
body.

4 years ago[Ada] Reuse Is_Entry where possible
Piotr Trojanek [Mon, 23 Mar 2020 23:04:11 +0000 (00:04 +0100)]
[Ada] Reuse Is_Entry where possible

2020-06-12  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* contracts.adb, einfo.adb, sem_ch4.adb, sem_ch6.adb,
sem_res.adb, sem_util.adb: Replace Ekind_In with Is_Entry.

4 years ago[Ada] Detect overlapping actuals in entry calls
Piotr Trojanek [Mon, 23 Mar 2020 22:39:10 +0000 (23:39 +0100)]
[Ada] Detect overlapping actuals in entry calls

2020-06-12  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_res.adb (Resolve_Entry_Call): Add call to
Warn_On_Overlapping_Actuals.

4 years ago[Ada] ACATS 4.2Q - BDD2007
Arnaud Charlet [Sat, 21 Mar 2020 16:34:20 +0000 (12:34 -0400)]
[Ada] ACATS 4.2Q - BDD2007

2020-06-12  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* aspects.ads (Is_Representation_Aspect): New array.
* sem_ch13.adb (Analyze_Aspect_Specifications): Check
13.1(9.2/5) for representation aspects.

gcc/testsuite/

* gnat.dg/rep_clause8.adb: Update error location.

4 years ago[Ada] Put_Image: preload type Sink, change what types have it enabled
Bob Duff [Mon, 23 Mar 2020 16:40:45 +0000 (12:40 -0400)]
[Ada] Put_Image: preload type Sink, change what types have it enabled

2020-06-12  Bob Duff  <duff@adacore.com>

gcc/ada/

* exp_put_image.ads, exp_put_image.adb (Preload_Sink): Procedure
for preloading type Sink.  This has the side effect of loading
various dependents, including Ada.Strings.UTF_Encoding.
(Enable_Put_Image): Disable Put_Image in pre-2020 versions of
Ada.  This limitation can probably be lifted later.  Enable for
tagged types except in predefined units.  Disable for CPP types;
Put_Image is legal, just prints the type name.
* sem_attr.adb (Check_Put_Image_Attribute): Don't complain about
Put_Image of CPP types; instead call the "unknown" version of
Put_Image.
* sem_ch10.adb (Analyze_Compilation_Unit): Call Preload_Sink.

4 years ago[Ada] Remove redundant iterations in checks for overlapping actuals
Piotr Trojanek [Wed, 18 Mar 2020 17:38:12 +0000 (18:38 +0100)]
[Ada] Remove redundant iterations in checks for overlapping actuals

2020-06-12  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_warn.adb (Warn_On_Overlapping_Actuals): Simplify.

4 years ago[Ada] Remove suppression for overlapping actuals in internal units
Piotr Trojanek [Wed, 18 Mar 2020 17:25:41 +0000 (18:25 +0100)]
[Ada] Remove suppression for overlapping actuals in internal units

2020-06-12  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_warn.adb (Warn_On_Overlapping_Actuals): Remove suppression
for internal units.

4 years ago[Ada] ACATS 4.1Q - CDD2A04 - RLS not followed
Arnaud Charlet [Sat, 21 Mar 2020 19:03:58 +0000 (15:03 -0400)]
[Ada] ACATS 4.1Q - CDD2A04 - RLS not followed

2020-06-12  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_strm.adb (Build_Elementary_Input_Call): Add support for 24
bits elementary types.
* rtsfind.ads: Add 24 bits integer streaming routines.
* sem_ch13.adb (Analyze_Attribute_Definition_Clause
[Attribute_Stream_Size]): Add support for 24 bits elementary
types.
* libgnat/s-stratt.ads, libgnat/s-stratt.adb,
libgnat/s-stratt__xdr.adb: Add support for signed and unsigned
24 bits integers.

4 years ago[Ada] Simplify getting discriminant value from a list of constraints
Piotr Trojanek [Fri, 13 Mar 2020 20:32:25 +0000 (21:32 +0100)]
[Ada] Simplify getting discriminant value from a list of constraints

2020-06-12  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* sem_ch3.adb (Get_Discr_Value): Cleanup.

4 years ago[Ada] Implement AI12-0175 Preelaborable packages with address clauses
Eric Botcazou [Fri, 20 Mar 2020 22:00:32 +0000 (23:00 +0100)]
[Ada] Implement AI12-0175 Preelaborable packages with address clauses

2020-06-12  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* rtsfind.ads (RTU_Id): Add System_Address_To_Access_Conversions.
* sem_elab.adb (Elaboration_Phase_Active): Alphabetize.
(Finalize_All_Data_Structures): Likewise.
(Error_Preelaborated_Call): New procedure.
(Build_Call_Marker): Set Is_Preelaborable_Call flag in marker.
(Build_Access_Marker): Likewise.
(Build_Subprogram_Invocation): Likewise.
(Build_Task_Activation): Likewise.
(Check_Preelaborated_Call): Return when the call is preelaborable.
Call Error_Preelaborated_Call to give the error otherwise.
(Check_Elab_Call): Likewise.
* sem_util.adb (Is_Preelaborable_Function): New predicate.
(Is_Non_Preelaborable_Construct.Visit): Recurse on the
Explicit_Actual_Parameter field of N_Parameter_Association.
(Is_Non_Preelaborable_Construct.Visit_Subexpression): In Ada 2020,
for a call to a preelaborable function, visit the parameter list;
otherwise, raise Non_Preelaborable exception.
(Is_Preelaborable_Construct): Likewise, but recursively check the
parameters instead and return false upon failure, otherwise true.
* sinfo.ads (Is_Preelaborable_Call): New flag in call marker nodes.
(Is_Preelaborable_Call): New inline function.
(Set_Is_Preelaborable_Call): New inline procedure.
* sinfo.adb (Is_Preelaborable_Call): New inline function.
(Set_Is_Preelaborable_Call): New inline procedure.

4 years ago[Ada] Remove unnecessary use_clause from stringt.ads
Bob Duff [Sat, 21 Mar 2020 21:29:21 +0000 (17:29 -0400)]
[Ada] Remove unnecessary use_clause from stringt.ads

2020-06-12  Bob Duff  <duff@adacore.com>

gcc/ada/

* stringt.ads: Remove "use System;".

4 years ago[Ada] Small cleanup in handling of Ada 2012 implicit dereferences
Eric Botcazou [Sat, 21 Mar 2020 12:25:45 +0000 (13:25 +0100)]
[Ada] Small cleanup in handling of Ada 2012 implicit dereferences

2020-06-12  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_ch4.adb (Try_Container_Indexing): Replace call to
First_Discriminant by Get_Reference_Discriminant to get the
reference discriminant.
* sem_ch13.adb (Check_Indexing_Functions): Likewise.
* sem_ch5.adb (Preanalyze_Range): Call Get_Reference_Discriminant
to get the reference discriminant.
* sem_util.adb (Is_OK_Variable_For_Out_Formal): Treat all
Ada 2012 implicit dereferences in only one place.
(Is_Variable): Minor tweak.

4 years ago[Ada] Compiler crash on instance with overloaded actual and aspects
Ed Schonberg [Fri, 20 Mar 2020 13:24:49 +0000 (09:24 -0400)]
[Ada] Compiler crash on instance with overloaded actual and aspects

2020-06-12  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch12.adb (Has_Contracts): New predicate to check whether a
formal subprogram carries an aspect specification for a pre- or
postcondition.
(Build_Subprogram_Wrappers): If actual is overloaded, create a
new name to be used in call inside wrapper body. This names
carries the interpretations of the actual, and is resolved when
the body is analyzed.
(Build_Subprogram_Body_Wrapper): Use this generated name in
call.
(Build_Subprogram_Decl_Wrapper): Build profile of wrapper from
the profile of formal, and reset type entities for subsequent
analysis.

4 years ago[Ada] Put_Image attribute
Bob Duff [Thu, 19 Mar 2020 22:17:36 +0000 (18:17 -0400)]
[Ada] Put_Image attribute

2020-06-12  Bob Duff  <duff@adacore.com>

gcc/ada/

* debug.adb: Remove usage of -gnatd_z.
* exp_attr.adb, exp_put_image.ads, exp_put_image.adb: Clean up
the enable/disable code. If Put_Image is disabled for a type,
systematically call the "unknown" version.  Improve comments.
Consolidate workarounds.  Remove usage of -gnatd_z.

4 years ago[Ada] Fix typos in comments
Eric Botcazou [Thu, 19 Mar 2020 21:12:09 +0000 (22:12 +0100)]
[Ada] Fix typos in comments

2020-06-12  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_elab.adb: Fix typos in comments.

4 years ago[Ada] Missing accessibility error on object in type conversion
Justin Squirek [Thu, 19 Mar 2020 20:59:30 +0000 (16:59 -0400)]
[Ada] Missing accessibility error on object in type conversion

2020-06-12  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* sem_util.adb (Object_Access_Level): Add processing of implicit
dereferences.

4 years ago[Ada] Ada2020: update Big_Numbers.* specs
Bob Duff [Wed, 18 Mar 2020 21:17:58 +0000 (17:17 -0400)]
[Ada] Ada2020: update Big_Numbers.* specs

2020-06-12  Bob Duff  <duff@adacore.com>

gcc/ada/

* libgnat/a-nbnbin.adb, libgnat/a-nbnbin.ads,
libgnat/a-nbnbin__gmp.adb, libgnat/a-nbnbre.adb,
libgnat/a-nbnbre.ads: Update Put_Image, and uncomment the aspect
specification.  Add pragmas Ada_2020.
* libgnat/a-stouut.ads, libgnat/a-stteou.ads: Add Preelaborate,
because the Big_Numbers packages have Preelaborate, and now
depend on these Text_Output packages.

4 years ago[Ada] Implement AI12-0269 No_Return for functions
Eric Botcazou [Wed, 18 Mar 2020 22:13:20 +0000 (23:13 +0100)]
[Ada] Implement AI12-0269 No_Return for functions

2020-06-12  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* einfo.ads (No_Return): Document it for all subprograms.
* einfo.adb (Set_No_Return): Adjust assertion accordingly.
* sem_ch3.adb (Check_Abstract_Overriding): Implement the
check prescribed by RM 6.5.1(6/2) here instead of...
(Derive_Subprogram): Adjust comment accordingly.
* sem_disp.adb (Override_Dispatching_Operation): ...here.
Remove superfluous return statement.
* sem_ch6.adb (Check_No_Return_Expression): New procedure.
(Analyze_Function_Return): Call it to implement the check
prescribed by AI12-0269 for simple return statements of
No_Return functions, and also checks extended statements.
(Analyze_Return_Statement): Only give an error on a return
statement in No_Return procedures.  Use idiomatic form.
* sem_ch8.adb (Analyze_Subprogram_Renaming): Adjust error
message for No_Return renaming subprogram.
* sem_prag.adb (Analyze_Pragma) <Pragma_No_Return>: Accept
it on functions and generic functions in Ada 2020.

4 years agomatch any program name when pruning collect messages
Alexandre Oliva [Fri, 12 Jun 2020 08:08:33 +0000 (05:08 -0300)]
match any program name when pruning collect messages

When collect* programs have an executable suffix, they may include it
in their outputs.  Match them when pruning gcc output, making room for
other program names to print them.

for  gcc/testsuite/ChangeLog

* lib/prune.exp (prune_gcc_output): Match any executable name
in collect messages.

4 years agoFix few -Wformat-diag warnings.
Martin Liška [Thu, 11 Jun 2020 08:43:36 +0000 (10:43 +0200)]
Fix few -Wformat-diag warnings.

Ready for master?

Thanks,
Martin

gcc/ChangeLog:

* cgraphunit.c (process_symver_attribute): Wrap weakref keyword.
* dbgcnt.c (dbg_cnt_set_limit_by_index): Do not print extra new
line.
* lto-wrapper.c (merge_and_complain): Wrap option names.

4 years agovect: Factor out and rename some functions/macros
Kewen Lin [Fri, 12 Jun 2020 06:14:40 +0000 (01:14 -0500)]
vect: Factor out and rename some functions/macros

Power supports vector memory access with length (in bytes) instructions.
Like existing fully masking for SVE, it is another approach to vectorize
the loop using partially-populated vectors.

As Richard Sandiford suggested, we should share the codes in approaches
with partial vectors if possible.  This patch is to:
  1) factor out two functions:
     - vect_min_prec_for_max_niters
     - vect_known_niters_smaller_than_vf.
  2) rename four functions:
     - vect_iv_limit_for_full_masking
     - check_load_store_masking
     - vect_set_loop_condition_masked
     - vect_set_loop_condition_unmasked
  3) rename macros LOOP_VINFO_MASK_COMPARE_TYPE and LOOP_VINFO_MASK_IV_TYPE.

Bootstrapped/regtested on aarch64-linux-gnu.

gcc/ChangeLog:

* tree-vect-loop-manip.c (vect_set_loop_controls_directly): Rename
LOOP_VINFO_MASK_COMPARE_TYPE to LOOP_VINFO_RGROUP_COMPARE_TYPE.  Rename
LOOP_VINFO_MASK_IV_TYPE to LOOP_VINFO_RGROUP_IV_TYPE.
(vect_set_loop_condition_masked): Renamed to ...
(vect_set_loop_condition_partial_vectors): ... this.  Rename
LOOP_VINFO_MASK_COMPARE_TYPE to LOOP_VINFO_RGROUP_COMPARE_TYPE.  Rename
vect_iv_limit_for_full_masking to vect_iv_limit_for_partial_vectors.
(vect_set_loop_condition_unmasked): Renamed to ...
(vect_set_loop_condition_normal): ... this.
(vect_set_loop_condition): Rename vect_set_loop_condition_unmasked to
vect_set_loop_condition_normal.  Rename vect_set_loop_condition_masked
to vect_set_loop_condition_partial_vectors.
(vect_prepare_for_masked_peels): Rename LOOP_VINFO_MASK_COMPARE_TYPE
to LOOP_VINFO_RGROUP_COMPARE_TYPE.
* tree-vect-loop.c (vect_known_niters_smaller_than_vf): New, factored
out from ...
(vect_analyze_loop_costing): ... this.
(_loop_vec_info::_loop_vec_info): Rename mask_compare_type to
compare_type.
(vect_min_prec_for_max_niters): New, factored out from ...
(vect_verify_full_masking): ... this.  Rename
vect_iv_limit_for_full_masking to vect_iv_limit_for_partial_vectors.
Rename LOOP_VINFO_MASK_COMPARE_TYPE to LOOP_VINFO_RGROUP_COMPARE_TYPE.
Rename LOOP_VINFO_MASK_IV_TYPE to LOOP_VINFO_RGROUP_IV_TYPE.
(vectorizable_reduction): Update some dumpings with partial
vectors instead of fully-masked.
(vectorizable_live_operation): Likewise.
(vect_iv_limit_for_full_masking): Renamed to ...
(vect_iv_limit_for_partial_vectors): ... this.
* tree-vect-stmts.c (check_load_store_masking): Renamed to ...
(check_load_store_for_partial_vectors): ... this.  Update some
dumpings with partial vectors instead of fully-masked.
(vectorizable_store): Rename check_load_store_masking to
check_load_store_for_partial_vectors.
(vectorizable_load): Likewise.
* tree-vectorizer.h (LOOP_VINFO_MASK_COMPARE_TYPE): Renamed to ...
(LOOP_VINFO_RGROUP_COMPARE_TYPE): ... this.
(LOOP_VINFO_MASK_IV_TYPE): Renamed to ...
(LOOP_VINFO_RGROUP_IV_TYPE): ... this.
(vect_iv_limit_for_full_masking): Renamed to ...
(vect_iv_limit_for_partial_vectors): this.
(_loop_vec_info): Rename mask_compare_type to rgroup_compare_type.
Rename iv_type to rgroup_iv_type.

4 years agorecog: Use parameter packs for operator()
Richard Sandiford [Fri, 12 Jun 2020 07:16:48 +0000 (08:16 +0100)]
recog: Use parameter packs for operator()

This patch uses parameter packs to define insn_gen_fn::operator().
I guess in some ways it's C++-ification for its own sake, but it does
make things simpler and removes the current artificial limit of 16
arguments.

Note that the call is still strongly typed: all arguments have to have
implicit conversions to rtx.  Error messages for bad arguments look
reasonable.

I'm sure there are more elegant ways of getting the function type,
but this version at least fits on one line, so I didn't try too
hard to find an alternative.

2020-06-12  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* recog.h (insn_gen_fn::f0, insn_gen_fn::f1, insn_gen_fn::f2)
(insn_gen_fn::f3, insn_gen_fn::f4, insn_gen_fn::f5, insn_gen_fn::f6)
(insn_gen_fn::f7, insn_gen_fn::f8, insn_gen_fn::f9, insn_gen_fn::f10)
(insn_gen_fn::f11, insn_gen_fn::f12, insn_gen_fn::f13)
(insn_gen_fn::f14, insn_gen_fn::f15, insn_gen_fn::f16): Delete.
(insn_gen_fn::operator()): Replace overloaded definitions with
a parameter-pack version.

4 years agox86: Add UNSPECV_PATCHABLE_AREA
H.J. Lu [Mon, 3 Feb 2020 18:22:57 +0000 (10:22 -0800)]
x86: Add UNSPECV_PATCHABLE_AREA

Currently patchable area is at the wrong place.  It is placed immediately
after function label, before both .cfi_startproc and ENDBR.  This patch
adds UNSPECV_PATCHABLE_AREA for pseudo patchable area instruction and
changes ENDBR insertion pass to also insert patchable area instruction.
TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY is defined to avoid placing
patchable area before .cfi_startproc and ENDBR.

gcc/

PR target/93492
* config/i386/i386-features.c (rest_of_insert_endbranch):
Renamed to ...
(rest_of_insert_endbr_and_patchable_area): Change return type
to void. Add need_endbr and patchable_area_size arguments.
Don't call timevar_push nor timevar_pop.  Replace
endbr_queued_at_entrance with insn_queued_at_entrance.  Insert
UNSPECV_PATCHABLE_AREA for patchable area.
(pass_data_insert_endbranch): Renamed to ...
(pass_data_insert_endbr_and_patchable_area): This.  Change
pass name to endbr_and_patchable_area.
(pass_insert_endbranch): Renamed to ...
(pass_insert_endbr_and_patchable_area): This.  Add need_endbr
and patchable_area_size;.
(pass_insert_endbr_and_patchable_area::gate): Set and check
need_endbr and patchable_area_size.
(pass_insert_endbr_and_patchable_area::execute): Call
timevar_push and timevar_pop.  Pass need_endbr and
patchable_area_size to rest_of_insert_endbr_and_patchable_area.
(make_pass_insert_endbranch): Renamed to ...
(make_pass_insert_endbr_and_patchable_area): This.
* config/i386/i386-passes.def: Replace pass_insert_endbranch
with pass_insert_endbr_and_patchable_area.
* config/i386/i386-protos.h (ix86_output_patchable_area): New.
(make_pass_insert_endbranch): Renamed to ...
(make_pass_insert_endbr_and_patchable_area): This.
* config/i386/i386.c (ix86_asm_output_function_label): Set
function_label_emitted to true.
(ix86_print_patchable_function_entry): New function.
(ix86_output_patchable_area): Likewise.
(x86_function_profiler): Replace endbr_queued_at_entrance with
insn_queued_at_entrance.  Generate ENDBR only for TYPE_ENDBR.
Call ix86_output_patchable_area to generate patchable area if
needed.
(TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY): New.
* config/i386/i386.h (queued_insn_type): New.
(machine_function): Add function_label_emitted.  Replace
endbr_queued_at_entrance with insn_queued_at_entrance.
* config/i386/i386.md (UNSPECV_PATCHABLE_AREA): New.
(patchable_area): New.

gcc/testsuite/

PR target/93492
* gcc.target/i386/pr93492-1.c: New test.
* gcc.target/i386/pr93492-2.c: Likewise.
* gcc.target/i386/pr93492-3.c: Likewise.
* gcc.target/i386/pr93492-4.c: Likewise.
* gcc.target/i386/pr93492-5.c: Likewise.

4 years agoDaily bump.
GCC Administrator [Fri, 12 Jun 2020 00:16:29 +0000 (00:16 +0000)]
Daily bump.

4 years agoc++: constrained class template friend [PR93467]
Patrick Palka [Thu, 11 Jun 2020 20:33:41 +0000 (16:33 -0400)]
c++: constrained class template friend [PR93467]

This fixes two issues in our handling of constrained class template
friend declarations.

The first issue is that we fail to set the constraints on the injected
class template declaration during tsubst_friend_class.

The second issue is that the template parameter levels within the parsed
constraints of a class template friend declaration are shifted if the
enclosing class is a template, and this shift leads to spurious
constraint mismatch errors in associate_classtype_constraints if the
friend declaration refers to an already declared class template.

gcc/cp/ChangeLog:

PR c++/93467
* constraint.cc (associate_classtype_constraints): If there is a
discrepancy between the current template depth and the template
depth of the original declaration, then adjust the template
parameter depth within the current constraints appropriately.
* pt.c (tsubst_friend_class): Substitute into and set the
constraints on the injected declaration.

gcc/testsuite/ChangeLog:

PR c++/93467
* g++.dg/cpp2a/concepts-friend6.C: New test.
* g++.dg/cpp2a/concepts-friend7.C: New test.