gcc.git
4 years agoadd vect_get_slp_vect_def
Richard Biener [Thu, 4 Jun 2020 12:59:16 +0000 (14:59 +0200)]
add vect_get_slp_vect_def

This adds vect_get_slp_vect_def to get at a SLP nodes vectorized def,
abstracting away the details.  It also fixes one stray failure to
use SLP_TREE_REPRESENTATIVE.

2020-05-04  Richard Biener  <rguenther@suse.de>

* tree-vectorizer.h (vect_get_slp_vect_def): Declare.
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use it.
* tree-vect-stmts.c (vect_transform_stmt): Likewise.
(vect_is_simple_use): Use SLP_TREE_REPRESENTATIVE.
* tree-vect-slp.c (vect_get_slp_vect_defs): Fold into single
use ...
(vect_get_slp_defs): ... here.
(vect_get_slp_vect_def): New function.

4 years agoAdd explicit SLP_TREE_LANES
Richard Biener [Fri, 29 May 2020 09:23:05 +0000 (11:23 +0200)]
Add explicit SLP_TREE_LANES

This adds an explicit number of scalar lanes to the SLP node
avoiding to dispatch between stmts/ops and eventually not require
those vectors at all.

2020-05-27  Richard Biener  <rguenther@suse.de>

* tree-vectorizer.h (_slp_tree::lanes): New.
(SLP_TREE_LANES): Likewise.
* tree-vect-loop.c (vect_create_epilog_for_reduction): Use it.
(vectorizable_reduction): Likewise.
(vect_transform_cycle_phi): Likewise.
(vectorizable_induction): Likewise.
(vectorizable_live_operation): Likewise.
* tree-vect-slp.c (_slp_tree::_slp_tree): Initialize lanes.
(vect_create_new_slp_node): Likewise.
(slp_copy_subtree): Copy it.
(vect_optimize_slp): Use it.
(vect_slp_analyze_node_operations_1): Likewise.
(vect_slp_convert_to_external): Likewise.
(vect_bb_vectorization_profitable_p): Likewise.
* tree-vect-stmts.c (vectorizable_load): Likewise.
(get_vectype_for_scalar_type): Likewise.

4 years agolibstdc++: Make std::copy_n work with negative and non-integral sizes
Jonathan Wakely [Thu, 4 Jun 2020 12:52:21 +0000 (13:52 +0100)]
libstdc++: Make std::copy_n work with negative and non-integral sizes

Since it was added in C++11, std::copy_n and std::ranges::copy_n should
do nothing given a negative size, but for random access iterators we add
the size to the iterator, possibly resulting in undefined behaviour.

Also, C++20 clarified that std::copy_n requires the Size type to be
convertible to an integral type. We previously assumed that it could be
directly used in arithmetic expressions, without conversion to an
integral type.

This also fixes a bug in the random_access_iterator_wrapper helper adds
some convenience aliases for using the iterator wrappers.

libstdc++-v3/ChangeLog:

* include/bits/ranges_algobase.h (__copy_n_fn): Only call
ranges::copy for positive values.
* include/bits/stl_algo.h (copy_n): Convert Size argument to an
integral type and only call __copy_n for positive values.
* testsuite/util/testsuite_iterators.h
(random_access_iterator_wrapper::operator+=): Fix range check for
negative values.
(output_container, input_container, forward_container)
(bidirectional_container, random_access_container): New alias
templates.
* testsuite/25_algorithms/copy_n/5.cc: New test.

4 years agoSimplify SLP code wrt SLP_TREE_DEF_TYPE
Richard Biener [Thu, 4 Jun 2020 12:17:21 +0000 (14:17 +0200)]
Simplify SLP code wrt SLP_TREE_DEF_TYPE

The following removes the ugly pushing of SLP_TREE_DEF_TYPE to
stmt_infos and instead makes sure to handle invariants fully
in vect_is_simple_use plus adjusting a few places I refrained
from touching when enforcing vector types for them.

It also simplifies building SLP nodes with all external operands
from scalars by not doing that in the parent but instead not
building those from the start.  That also gets rid of
vect_update_all_shared_vectypes.

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

* tree-vect-slp.c (vect_update_all_shared_vectypes): Remove.
(vect_build_slp_tree_2): Simplify building all external op
nodes from scalars.
(vect_slp_analyze_node_operations): Remove push/pop of
STMT_VINFO_DEF_TYPE.
(vect_schedule_slp_instance): Likewise.
* tree-vect-stmts.c (ect_check_store_rhs): Pass in the
stmt_info, use the vect_is_simple_use overload combining
SLP and stmt_info analysis.
(vect_is_simple_cond): Likewise.
(vectorizable_store): Adjust.
(vectorizable_condition): Likewise.
(vect_is_simple_use): Fully handle invariant SLP nodes
here.  Amend stmt_info operand extraction with COND_EXPR
and masked stores.
* tree-vect-loop.c (vectorizable_reduction): Deal with
COND_EXPR representation ugliness.

4 years agoFix zero-masking for vcvtps2ph when dest operand is memory.
liuhongt [Fri, 29 May 2020 05:38:49 +0000 (13:38 +0800)]
Fix zero-masking for vcvtps2ph when dest operand is memory.

When dest is memory, zero-masking is not valid, only merging-masking is available,

2020-06-24  Hongtao Liu  <hongtao.liu@inte.com>

gcc/ChangeLog:
PR target/95254
* config/i386/sse.md (*vcvtps2ph_store<merge_mask_name>):
Refine from *vcvtps2ph_store<mask_name>.
(vcvtps2ph256<mask_name>): Refine constraint from vm to v.
(<mask_codefor>avx512f_vcvtps2ph512<mask_name>): Ditto.
(*vcvtps2ph256<merge_mask_name>): New define_insn.
(*avx512f_vcvtps2ph512<merge_mask_name>): Ditto.
* config/i386/subst.md (merge_mask): New define_subst.
(merge_mask_name): New define_subst_attr.
(merge_mask_operand3): Ditto.

gcc/testsuite/ChangeLog:
* gcc.target/i386/avx512f-vcvtps2ph-pr95254.c: New test.
* gcc.target/i386/avx512vl-vcvtps2ph-pr95254.c: Ditto.

4 years ago[Ada] AI12-0184: Long Long C Data types
Arnaud Charlet [Thu, 30 Jan 2020 09:05:44 +0000 (04:05 -0500)]
[Ada] AI12-0184: Long Long C Data types

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

gcc/ada/

* libgnat/i-c.ads (long_long, unsigned_long_long): New
definitions.

4 years ago[Ada] New package Ada.Task_Initialization
Arnaud Charlet [Thu, 23 Jan 2020 15:48:08 +0000 (10:48 -0500)]
[Ada] New package Ada.Task_Initialization

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

gcc/ada/

* Makefile.rtl: add a-tasini object
* impunit.adb (Non_Imp_File_Names_95): Add s-tasini.
* libgnarl/a-tasini.ads, libgnarl/a-tasini.adb: New files.
* libgnarl/s-taskin.ads (Global_Initialization_Handler): New.
* libgnarl/s-tassta.adb (Task_Wrapper): Call
Global_Initialization_Handler if non null.

4 years ago[Ada] Ada_2020: contracts for formal subprograms
Ed Schonberg [Fri, 24 Jan 2020 19:14:14 +0000 (14:14 -0500)]
[Ada] Ada_2020: contracts for formal subprograms

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

gcc/ada/

* sem_ch12.adb (Build_Suprogram_Body_Wrapper,
Build_Subprogram_Decl_Wrapper): New suprograms, to create the
wrappers needed to implement contracts on formsl subprograms at
the point of instantiation.
(Build_Subprogram_Wrappers): New subprogram within
Analyze_Associations, calls the above when the formal subprogram
has contracts, and expansion is enabled.
(Instantiate_Formal_Subprogram): If the actual is not an entity,
such as a function attribute, or a synchronized operation,
create a function with an internal name and call it within the
wrapper.
(Analyze_Generic_Formal_Part): Analyze contracts at the end of
the list of formal declarations.
* sem_prag.adb (Analyze_Pre_Post_Condtion): In Ada_2020 the
aspect and corresponding pragma can appear on a formal
subprogram declaration.
(Find_Related_Declaration_Or_Body): Ditto.

4 years ago[Ada] Add missing conversion in call to Finalize primitive
Eric Botcazou [Wed, 29 Jan 2020 15:15:09 +0000 (16:15 +0100)]
[Ada] Add missing conversion in call to Finalize primitive

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

gcc/ada/

* exp_ch7.adb (Make_Final_Call): Set the type of the object, if
it is unanalyzed, before calling Convert_View on it.

4 years ago[Ada] Get rid of Disable_FE_Inline_Always
Arnaud Charlet [Tue, 28 Jan 2020 19:13:14 +0000 (14:13 -0500)]
[Ada] Get rid of Disable_FE_Inline_Always

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

gcc/ada/

* adabkend.adb, back_end.ads, opt.ads, sem_ch6.adb: Get rid of
Disable_FE_Inline_Always.

4 years ago[Ada] Fix a couple of oversights in previous change
Eric Botcazou [Tue, 28 Jan 2020 22:52:17 +0000 (23:52 +0100)]
[Ada] Fix a couple of oversights in previous change

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

gcc/ada/

* exp_ch7.adb (Make_Final_Call): Add missing guard.
* sem_ch3.adb (Copy_And_Build): Adjust recursive call for
private types.
(Build_Derived_Private_Type): Deal with underlying full views.

4 years ago[Ada] Put_Image attribute
Bob Duff [Tue, 28 Jan 2020 20:06:41 +0000 (15:06 -0500)]
[Ada] Put_Image attribute

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

gcc/ada/

* libgnat/a-stobbu.adb, libgnat/a-stobbu.ads,
libgnat/a-stobfi.adb, libgnat/a-stobfi.ads,
libgnat/a-stoubu.adb, libgnat/a-stoubu.ads,
libgnat/a-stoufi.adb, libgnat/a-stoufi.ads,
libgnat/a-stoufo.adb, libgnat/a-stoufo.ads,
libgnat/a-stouut.adb, libgnat/a-stouut.ads,
libgnat/a-stteou.ads, libgnat/s-putaim.adb,
libgnat/s-putaim.ads, libgnat/s-putima.adb, libgnat/s-putima.ads
(Ada.Strings.Text_Output and children, System.Put_Images): New
runtime support for Put_Image.
* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add
exp_put_image.o.
* exp_put_image.adb, exp_put_image.ads: New compiler package
that generates calls to runtime routines that implement
Put_Image.
* Makefile.rtl: Add object files for Ada.Strings.Text_Output and
children and System.Put_Images.
* aspects.adb: Simplify initialization of Canonical_Aspect.
* aspects.ads: Improve documentation. Add Aspect_Put_Image.
* exp_attr.adb: Add support for Put_Image, by calling routines
in Exp_Put_Image.
* sem_util.adb (Is_Predefined_Dispatching_Operation): Return
True for new TSS_Put_Image operation.
* exp_ch3.adb: For tagged types, build a dispatching
TSS_Put_Image operation by calling routines in Exp_Put_Image.
* exp_disp.adb, exp_disp.ads: Make TSS_Put_Image be number 10,
adjusting other operations' numbers after 10. We choose 10
because that's the last number shared by all runtimes.
* exp_strm.adb: Use named notation as appropriate.
* exp_cg.adb, exp_tss.ads: Add TSS_Put_Image.
* libgnat/a-tags.ads: Modify Max_Predef_Prims for the new
TSS_Put_Image.
* impunit.adb: Add new runtime packages.
* rtsfind.adb, rtsfind.ads: Add support for
Ada.Strings.Text_Output, Ada.Strings.Text_Output.Utils, and
System.Put_Images.
* sem_attr.adb: Error checking for Put_Image calls.
* sem_ch12.adb (Valid_Default_Attribute): Support for passing
Put_Image as a generic formal parameter.
* sem_ch13.adb: Analysis of Put_Image aspect. Turn it into a
Put_Image attribute definition clause.
* sem_ch8.adb (Analyze_Subprogram_Renaming): Support for
renaming of the Put_Image attribute.
* snames.adb-tmpl: Fix comments.
* snames.ads-tmpl (Name_Put_Image): New Name_Id.
(Attribute_Put_Image): New Attribute_Id.
* tbuild.adb, tbuild.ads (Make_Increment): New utility.

4 years ago[Ada] Alignment clause ignored on completion derived from private type
Eric Botcazou [Mon, 27 Jan 2020 11:50:23 +0000 (12:50 +0100)]
[Ada] Alignment clause ignored on completion derived from private type

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

gcc/ada/

* exp_attr.adb (xpand_N_Attribute_Reference) <Input>: Call
Find_Inherited_TSS to look up the Stream_Read TSS.
<Output>: Likewise for the Stream_Write TSS.
* exp_ch7.adb (Make_Final_Call): Call Underlying_Type on
private types to account for underlying full views.
* exp_strm.ads  (Build_Record_Or_Elementary_Input_Function):
Remove Use_Underlying parameter.
* exp_strm.adb (Build_Record_Or_Elementary_Input_Function):
Likewise and adjust accordingly.
* exp_tss.adb (Find_Inherited_TSS): Deal with full views.
Call Find_Inherited_TSS recursively on the parent type if
the base type is a derived type.
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Take
into account underlying full views for derived types.
* sem_ch3.adb (Copy_And_Build): Look up the underlying full
view only for a completion.  Be prepared for private types.
(Build_Derived_Private_Type): Build an underlying full view
for a completion in the general case too.

4 years ago[Ada] Remove OpenACC support
Arnaud Charlet [Sun, 26 Jan 2020 20:32:43 +0000 (15:32 -0500)]
[Ada] Remove OpenACC support

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

gcc/ada/

* back_end.adb, opt.ads, par-prag.adb, sem_ch5.adb,
sem_prag.adb, sinfo.adb, sinfo.ads, snames.ads-tmpl,
doc/gnat_rm/implementation_defined_pragmas.rst: Remove
experimental support for OpenACC.
* gcc-interface/misc.c, gcc-interface/trans.c,
gcc-interface/lang.opt: Ditto.
* gnat_rm.texi: Regenerate.

gcc/testsuite/

* gnat.dg/openacc1.adb: Remove testcase.

4 years ago[Ada] Remove obsolete reference to gigi in comment
Eric Botcazou [Tue, 28 Jan 2020 09:03:23 +0000 (10:03 +0100)]
[Ada] Remove obsolete reference to gigi in comment

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

gcc/ada/

* checks.adb (Generate_Discriminant_Check): Remove obsolete
comment.

4 years ago[Ada] Implement AI12-0275 (Make subtype_mark optional in object renamings)
Gary Dismukes [Fri, 24 Jan 2020 19:11:47 +0000 (14:11 -0500)]
[Ada] Implement AI12-0275 (Make subtype_mark optional in object renamings)

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

gcc/ada/

* par-ch3.adb (P_Identifier_Declarations): Add parsing of object
renamings that have neither a subtype_mark nor an
access_definition. Issue an error if the version is earlier than
Ada_2020, and suggest using -gnatX.
* sem_ch8.adb (Analyze_Object_Renaming): Handle
object_renaming_declarations that don't have an explicit
subtype. Errors are issued when the name is inappropriate or
ambiguous, and otherwise the Etype of the renaming entity is set
from the Etype of the renamed object.
* sem_util.adb (Has_Null_Exclusion): Allow for the case of no
subtype given in an N_Object_Renaming_Declaration.
* sprint.adb (Sprint_Node_Actual): Handle printing of
N_Object_Renaming_Declarations that are specified without an
explicit subtype.

4 years ago[Ada] Fix glitch for N_Delta_Aggregate/N_Case_Expression/N_Quantified_Expression
Eric Botcazou [Wed, 22 Jan 2020 08:33:40 +0000 (09:33 +0100)]
[Ada] Fix glitch for N_Delta_Aggregate/N_Case_Expression/N_Quantified_Expression

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

gcc/ada/

* sinfo.ads (N_Delta_Aggregate): Document Etype field.
(N_Case_Expression): Likewise.
(Is_Syntactic_Field) <N_Quantified_Expression>: Adjust.
<N_Case_Expression>: Likewise.

4 years ago[Ada] Avoid redefining IS_DIR_SEPARATOR macro
Arnaud Charlet [Sat, 25 Jan 2020 10:00:20 +0000 (05:00 -0500)]
[Ada] Avoid redefining IS_DIR_SEPARATOR macro

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

gcc/ada/

* adaint.c: Avoid redefining IS_DIR_SEPARATOR macro.

4 years ago[Ada] Wrong walk order in Walk_Library_Items
Arnaud Charlet [Fri, 24 Jan 2020 16:58:35 +0000 (11:58 -0500)]
[Ada] Wrong walk order in Walk_Library_Items

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

gcc/ada/

* sem.adb (Walk_Library_Items): Defer processing of main spec
after all other specs and before processing bodies.

4 years ago[Ada] Import Adafinal as convention Ada
Arnaud Charlet [Thu, 23 Jan 2020 19:03:35 +0000 (14:03 -0500)]
[Ada] Import Adafinal as convention Ada

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

gcc/ada/

* bindgen.adb (Gen_Adafinal): Adafinal is convention Ada, not C.

4 years ago[Ada] Incorrect source line range on subprogram body with contract
Ed Schonberg [Thu, 23 Jan 2020 16:00:46 +0000 (11:00 -0500)]
[Ada] Incorrect source line range on subprogram body with contract

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

gcc/ada/

* sinput.adb (Sloc_Range): Ignore node in the tree if it appears
in a unit different from that of the node whose Sloc range we
are computing. This is necessary when computing the source range
of a subprogram body whose declaration includes a pre- or
postcondition, because declaration and body may appear in
different units, and the expanded code for the body includes
copies of the contract code.

4 years ago[Ada] Revamp dump and aux output names
Alexandre Oliva [Fri, 24 Jan 2020 00:15:30 +0000 (21:15 -0300)]
[Ada] Revamp dump and aux output names

2020-06-04  Alexandre Oliva  <oliva@adacore.com>

gcc/ada/

* switch.adb (Is_Internal_GCC_Switch): Recognize dumpdir and
dumpbase-ext.  Mark auxbase and auxbase-strip for removal.

4 years ago[Ada] Set convention and inlined flag on default null procedure
Eric Botcazou [Thu, 23 Jan 2020 20:52:19 +0000 (21:52 +0100)]
[Ada] Set convention and inlined flag on default null procedure

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

gcc/ada/

* sem_attr.adb (Resolve_Attribute) <Access>: Do not generate
the secondary message about a missing pragma if the convention
of the prefix is Intrinsic.
* sem_ch12.adb (Instantiate_Formal_Subprogram): Only set the
Convention and the Is_Inlined flag on a null procedure.

4 years ago[Ada] Missing accessibility check on access discriminant in extended return
Justin Squirek [Thu, 23 Jan 2020 18:12:11 +0000 (13:12 -0500)]
[Ada] Missing accessibility check on access discriminant in extended return

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

gcc/ada/

* sem_ch6.adb (Check_Return_Obj_Accessibility): Change to
Check_Return_Construct_Accessibility to better reflect its
purpose.  Add loop to properly obtain the object declaration
from an expanded extended return statement and add calls to get
the original node for associated values. Also, avoid checks when
the return statement being examined comes from an internally
generated function.

4 years ago[Ada] Fix Is_Absolute_Path on Windows
Dmitriy Anisimkov [Thu, 23 Jan 2020 06:38:47 +0000 (12:38 +0600)]
[Ada] Fix Is_Absolute_Path on Windows

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

gcc/ada/

* adaint.c (__gnat_is_absolute_path): Check for directory
separator after drive and colon.
(IS_DIR_SEPARATOR): Define new inline substitution.

4 years ago[Ada] Update the documentation in checks.ads about range checks
Eric Botcazou [Thu, 23 Jan 2020 15:40:14 +0000 (16:40 +0100)]
[Ada] Update the documentation in checks.ads about range checks

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

gcc/ada/

* checks.ads: Update documentation about range checks and fix
minor other things.

4 years ago[Ada] Small tweak to special handling of private index types
Eric Botcazou [Mon, 20 Jan 2020 10:24:07 +0000 (11:24 +0100)]
[Ada] Small tweak to special handling of private index types

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

gcc/ada/

* sem_ch3.adb (Array_Type_Declaration): Apply special handling
of private index types to generic packages and restrict it to
index types defined in the current scope.

4 years ago[Ada] New procedure Register_Global_Unhandled_Action
Arnaud Charlet [Wed, 22 Jan 2020 11:43:54 +0000 (06:43 -0500)]
[Ada] New procedure Register_Global_Unhandled_Action

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

gcc/ada/

* libgnat/a-exextr.adb (Global_Unhandled_Action): New global
variable.
(Notify_Exception): Take into account Global_Unhandled_Action
and fix latent race condition.
(Exception_Action): Mark Favor_Top_Level so that variables can
be atomic.
(Global_Action): Mark atomic to remove the need for a lock.
* libgnat/g-excact.ads, libgnat/g-excact.adb
(Register_Global_Unhandled_Action): New procedure.
(Register_Global_Action): Remove lock.
* libgnat/s-stalib.ads (Raise_Action): Mark Favor_Top_Level to
be compatible with Exception_Action.
* sem_warn.adb (Warn_On_Unreferenced_Entity): Fix logic wrt
Volatile entities and entities with an address clause: the code
did not match the comment/intent.

4 years ago[Ada] Update URL and bug report instructions
Arnaud Charlet [Wed, 22 Jan 2020 12:13:42 +0000 (07:13 -0500)]
[Ada] Update URL and bug report instructions

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

gcc/ada/

* comperr.adb (Compiler_Abort): Update URL and bug report
instructions.

4 years ago[Ada] Avoid buffer overflow in Long_Long_Float_Text_IO
Steve Baird [Sat, 18 Jan 2020 06:10:13 +0000 (22:10 -0800)]
[Ada] Avoid buffer overflow in Long_Long_Float_Text_IO

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

gcc/ada/

* libgnat/s-imgrea.ads: Declare a named number
Max_Real_Image_Length with value 5200.  Provide a comment
explaining why this value was chosen.
* libgnat/s-imgrea.adb (Set_Image_Real): Increase the upper
bound of the local String variable Digs to
Max_Real_Image_Length.
* libgnat/a-tiflau.adb (Put): Increase the upper bound of the
local String variable Buf to Max_Real_Image_Length.
(Puts): Increase the upper bound of the local String variable
Buf to Max_Real_Image_Length.

4 years ago[Ada] Remove System.Parameters.Single_Lock
Arnaud Charlet [Tue, 21 Jan 2020 11:44:25 +0000 (06:44 -0500)]
[Ada] Remove System.Parameters.Single_Lock

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

gcc/ada/

* libgnarl/a-dynpri.adb, libgnarl/a-taside.adb,
libgnarl/a-taster.adb, libgnarl/s-interr.adb,
libgnarl/s-interr__sigaction.adb, libgnarl/s-taasde.adb,
libgnarl/s-taenca.adb, libgnarl/s-taenca.ads,
libgnarl/s-taprop.ads, libgnarl/s-taprop__hpux-dce.adb,
libgnarl/s-taprop__linux.adb, libgnarl/s-taprop__mingw.adb,
libgnarl/s-taprop__posix.adb, libgnarl/s-taprop__qnx.adb,
libgnarl/s-taprop__solaris.adb, libgnarl/s-taprop__vxworks.adb,
libgnarl/s-tarest.adb, libgnarl/s-tasini.adb,
libgnarl/s-tasque.adb, libgnarl/s-tasque.ads,
libgnarl/s-tasren.adb, libgnarl/s-tasren.ads,
libgnarl/s-tassta.adb, libgnarl/s-tasuti.adb,
libgnarl/s-tasuti.ads, libgnarl/s-tpoben.adb,
libgnarl/s-tpobop.adb, libgnarl/s-tpopmo.adb,
libgnarl/s-tposen.adb, libgnat/s-parame.ads,
libgnat/s-parame__ae653.ads, libgnat/s-parame__hpux.ads,
libgnat/s-parame__vxworks.ads: Remove references to Single_Lock
and Global_Lock.

4 years ago[Ada] Continuation of "Get rid of more references to Universal_Integer"
Arnaud Charlet [Mon, 20 Jan 2020 11:07:09 +0000 (06:07 -0500)]
[Ada] Continuation of "Get rid of more references to Universal_Integer"

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

gcc/ada/

* libgnat/s-atopar.adb, libgnat/s-atopex.adb: Use Object_Size
instead of Size, otherwise many derived types will be rejected
(e.g. a type with a 14 bits 'Size and a 16 bits 'Object_Size).

4 years ago[Ada] Add another ad-hoc case to the Has_Private_View mechanism
Eric Botcazou [Sun, 19 Jan 2020 17:25:37 +0000 (18:25 +0100)]
[Ada] Add another ad-hoc case to the Has_Private_View mechanism

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

gcc/ada/

* sem_ch12.adb (Copy_Generic_Node): Add special handling for a
conversion between access types.

4 years ago[Ada] Fix fallout of cleanup to Has_Private_View mechanism
Eric Botcazou [Sat, 18 Jan 2020 22:40:05 +0000 (23:40 +0100)]
[Ada] Fix fallout of cleanup to Has_Private_View mechanism

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

gcc/ada/

* sem_ch12.adb (Check_Generic_Actuals): Also restore the proper
views of the actuals of the parent instances if the formals are
used as actuals of the children.
(Instantiate_Type): Add comment.

4 years ago[Ada] Minor editorial fixes
Gary Dismukes [Fri, 17 Jan 2020 22:50:13 +0000 (17:50 -0500)]
[Ada] Minor editorial fixes

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

gcc/ada/

* sem_ch12.adb: Minor editorial fixes.

4 years agocselim: Extend to check non-trapping for more references [PR89430]
Hao Liu [Thu, 4 Jun 2020 08:28:37 +0000 (16:28 +0800)]
cselim: Extend to check non-trapping for more references [PR89430]

If there is a dominating store, a store to the same reference can not be
trapped.  But previously, it only supports such check on MEM_REFs.
So this patch extends it to support ARRAY_REFs and COMPONENT_REFs.

This patch also supports a special case: if there is a dominating load of
local variable without address escape, a store is not trapped, as local
stack is always writable.  Other loads are ignored for simplicity, as they
don't help to check if a store can be trapped (the memory may be read-only).

gcc/ChangeLog:

PR tree-optimization/89430
* tree-ssa-phiopt.c
(struct name_to_bb): Rename to ref_to_bb; add a new field exp;
remove ssa_name_ver, store, offset fields.
(struct ssa_names_hasher): Rename to refs_hasher; update functions.
(class nontrapping_dom_walker): Rename m_seen_ssa_names to m_seen_refs.
(nontrapping_dom_walker::add_or_mark_expr): Extend to support ARRAY_REFs
and COMPONENT_REFs.

gcc/testsuite/ChangeLog:

PR tree-optimization/89430
* gcc.dg/tree-ssa/pr89430-1.c: Remove xfail.
* gcc.dg/tree-ssa/pr89430-2.c: Remove xfail.
* gcc.dg/tree-ssa/pr89430-5.c: Remove xfail.
* gcc.dg/tree-ssa/pr89430-6.c: Remove xfail.
* gcc.dg/tree-ssa/pr89430-7-comp-ref.c: New test.
* gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c: New test.
* gcc.dg/tree-ssa/ssa-pre-17.c: Add -fno-tree-cselim.

4 years agoFix missing assemble_external in ASM_OUTPUT_FDESC
Andreas Schwab [Fri, 15 May 2020 15:38:30 +0000 (17:38 +0200)]
Fix missing assemble_external in ASM_OUTPUT_FDESC

When TARGET_VTABLE_USES_DESCRIPTORS is defined then function pointers in
the vtable are output by ASM_OUTPUT_FDESC.  The only current user of
this is ia64, but its implementation of ASM_OUTPUT_FDESC lacks a call to
assemble_external.  Thus if there is no other reference to the function
the weak declaration for it will be missing.

PR target/95154
* config/ia64/ia64.h (ASM_OUTPUT_FDESC): Call assemble_external.

4 years agoMissing __divtf3@@GCC_4.4.0 on ia64
Andreas Schwab [Thu, 21 Nov 2013 14:15:40 +0000 (15:15 +0100)]
Missing __divtf3@@GCC_4.4.0 on ia64

gcc/testsuite/
PR libfortran/59227
* gfortran.dg/erf_3.F90: Remove XFAIL on ia64-*-linux*.

libgcc/
PR target/59230
PR libfortran/59227
* config/ia64/t-softfp-compat (softfp_file_list): Filter out
soft-fp/divtf3.c.
(LIB2ADD): Add config/ia64/divtf3.c.
* config/ia64/divtf3.c: New file.

4 years agoFix uppercase in trunc<mode><pmov_dst_3>2.
liuhongt [Thu, 4 Jun 2020 05:22:09 +0000 (13:22 +0800)]
Fix uppercase in trunc<mode><pmov_dst_3>2.

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

gcc/ChangeLog:
* config/i386/sse.md (pmov_dst_3_lower): New mode attribute.
(trunc<mode><pmov_dst_3_lower>2): Refine from
trunc<mode><pmov_dst_3>2.

gcc/testsuite
* gcc.target/i386/pr92658-avx512bw-trunc.c: Adjust testcase.

4 years agoc++: Reject some further reinterpret casts in constexpr [PR82304, PR95307]
Jakub Jelinek [Thu, 4 Jun 2020 07:09:01 +0000 (09:09 +0200)]
c++: Reject some further reinterpret casts in constexpr [PR82304, PR95307]

cxx_eval_outermost_constant_expr had a check for reinterpret_casts from
pointers (well, it checked from ADDR_EXPRs) to integral type, but that
only caught such cases at the toplevel of expressions.
As the comment said, it should be done even inside of the expressions,
but at the point of the writing e.g. pointer differences used to be a
problem.  We now have POINTER_DIFF_EXPR, so this is no longer an issue.

Had to do it just for CONVERT_EXPR, because the FE emits NOP_EXPR casts
from pointers to integrals in various spots, e.g. for the PMR & 1 tests,
though on NOP_EXPR we have the REINTERPRET_CAST_P bit that we do check,
while on CONVERT_EXPR we don't.

2020-06-04  Jakub Jelinek  <jakub@redhat.com>

PR c++/82304
PR c++/95307
* constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
conversions from pointer types to arithmetic types here...
(cxx_eval_outermost_constant_expr): ... instead of here.

* g++.dg/template/pr79650.C: Expect different diagnostics and expect
it on all lines that do pointer to integer casts.
* g++.dg/cpp1y/constexpr-shift1.C: Expect different diagnostics.
* g++.dg/cpp1y/constexpr-82304.C: New test.
* g++.dg/cpp0x/constexpr-95307.C: New test.

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

4 years agoProvide diagnostic hints for missing C++ cinttypes string constants.
Mark Wielaard [Sat, 23 May 2020 22:44:22 +0000 (00:44 +0200)]
Provide diagnostic hints for missing C++ cinttypes string constants.

When reporting an error in cp_parser and we notice a string literal
followed by an unknown name check whether there is a known standard
header containing a string macro with the same name, then add a hint
to the error message to include that header.

gcc/c-family/ChangeLog:

* known-headers.cc (get_cp_stdlib_header_for_string_macro_name):
New function.
* known-headers.h (get_cp_stdlib_header_for_string_macro_name):
New function declaration.

gcc/cp/ChangeLog:

* parser.c (cp_lexer_safe_previous_token): New function.
(cp_parser_error_1): Add name_hint if the previous token is
a string literal and next token is a CPP_NAME and we have a
missing header suggestion for the name.

gcc/testsuite/ChangeLog:

* g++.dg/spellcheck-inttypes.C: Add string-literal testcases.

4 years agoProvide diagnostic hints for missing C inttypes.h string constants.
Mark Wielaard [Thu, 21 May 2020 23:10:50 +0000 (01:10 +0200)]
Provide diagnostic hints for missing C inttypes.h string constants.

This adds a flag to c_parser so we know when we were trying to
construct a string literal. If there is a parse error and we were
constructing a string literal, and the next token is an unknown
identifier name, and we know there is a standard header that defines
that name as a string literal, then add a missing header hint to
the error messsage.

The list of macro names are also used when providing a hint for
missing identifiers.

gcc/c-family/ChangeLog:

* known-headers.cc (get_string_macro_hint): New function.
(get_stdlib_header_for_name): Use get_string_macro_hint.
(get_c_stdlib_header_for_string_macro_name): New function.
* known-headers.h (get_c_stdlib_header_for_string_macro_name):
New function declaration.

gcc/c/ChangeLog:

* c-parser.c (struct c_parser): Add seen_string_literal
bitfield.
(c_parser_consume_token): Reset seen_string_literal.
(c_parser_error_richloc): Add name_hint if seen_string_literal
and next token is a CPP_NAME and we have a missing header
suggestion for the name.
(c_parser_string_literal): Set seen_string_literal.

gcc/testsuite/ChangeLog:

* gcc.dg/spellcheck-inttypes.c: New test.
* g++.dg/spellcheck-inttypes.C: Likewise.

4 years agodiagnostics: Add function call parens matching to c_parser.
Mark Wielaard [Sun, 24 May 2020 16:01:51 +0000 (18:01 +0200)]
diagnostics: Add function call parens matching to c_parser.

The C++ parser already tracks function call parens matching, but the C
parser doesn't. This adds the same functionality to the C parser and adds
a testcase showing the C++ and C parser matching function call parens
in an error message.

gcc/c/ChangeLog:

* c-parser.c (c_parser_postfix_expression_after_primary): Add
scope with matching_parens after CPP_OPEN_PAREN.

gcc/testsuite/ChangeLog:

* c-c++-common/missing-close-func-paren.c: New test.

4 years agooptimize tanh(x) / sinh (x) to 1/ cosh (x)
Vitor Guidi [Wed, 3 Jun 2020 23:01:21 +0000 (17:01 -0600)]
optimize tanh(x) / sinh (x) to 1/ cosh (x)

gcc/
* match.pd (tanh/sinh -> 1/cosh): New simplification.

gcc/testsuite

* gcc.dg/tanhbysinh.c: New testcase.

4 years agoUpdate gcc sv.po.
Joseph Myers [Wed, 3 Jun 2020 22:18:54 +0000 (22:18 +0000)]
Update gcc sv.po.

* sv.po: Update.

4 years agoidentify lfs prefixed case PR95347
Aaron Sawdey [Tue, 2 Jun 2020 20:48:01 +0000 (15:48 -0500)]
identify lfs prefixed case PR95347

The same problem also arises for plfs where prefixed_load_p()
doesn't recognize it so we get just lfs in the asm output
with an @pcrel address.

PR target/95347
* config/rs6000/rs6000.c (is_stfs_insn): Rename to
is_lfs_stfs_insn and make it recognize lfs as well.
(prefixed_store_p): Use is_lfs_stfs_insn().
(prefixed_load_p): Use is_lfs_stfs_insn() to recognize lfs.

4 years agoc++: more constrained nested partial specialization
Patrick Palka [Wed, 3 Jun 2020 20:37:24 +0000 (16:37 -0400)]
c++: more constrained nested partial specialization

When checking that a constrained partial specialization is more
constrained than the primary template, we pass only the innermost level
of generic template arguments to strictly_subsumes.  This leads to us
doing a nonsensical substitution from normalize_concept_check if the
full set of template arguments has multiple levels, and it ultimately
causes strictly_subsumes to sometimes erroneously return false as in the
testcase below.

gcc/cp/ChangeLog:

* pt.c (process_partial_specialization): Pass the full set of
generic template arguments to strictly_subsumes.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-partial-spec8.C: New test.

4 years agoc++: constrained nested partial specialization [PR92103]
Patrick Palka [Wed, 3 Jun 2020 20:40:28 +0000 (16:40 -0400)]
c++: constrained nested partial specialization [PR92103]

When determining the most specialized partial specialization of a
primary template that is nested inside a class template, we first
tsubst the outer template arguments into the TEMPLATE_DECL of each
partial specialization, and then check for satisfaction of each of the
new TEMPLATE_DECL's constraints.

But tsubst_template_decl does not currently guarantee that constraints
from the original DECL_TEMPLATE_RESULT get reattached to the new
DECL_TEMPLATE_RESULT.  In the testcase below, this leads to the
constraints_satisfied_p check in most_specialized_partial_spec to
trivially return true for each of the partial specializations.

I'm not sure if such a guarantee would be desirable, but in this case we
can just check constraints_satisfied_p on the original TEMPLATE_DECL
instead of on the tsubsted TEMPLATE_DECL here, which is what this patch
does (alongside some reorganizing).

gcc/cp/ChangeLog:

PR c++/92103
* pt.c (most_specialized_partial_spec): Reorganize the loop over
DECL_TEMPLATE_SPECIALIZATIONS.  Check constraints_satisfied_p on
the original template declaration, not on the tsubsted one.

gcc/testsuite/ChangeLog:

PR c++/92103
* g++.dg/cpp2a/concepts-partial-spec7.C: New test.

4 years agoOptimize ODR enum streaming
Jan Hubicka [Wed, 3 Jun 2020 19:16:43 +0000 (21:16 +0200)]
Optimize ODR enum streaming

it turns out that half of the global decl stream of cc1 LTO build consits
TREE_LISTS, identifiers and integer cosntats representing TYPE_VALUES of enums.
Those are streamed only to produce ODR warning and used otherwise, so this
patch moves the info to a separate section that is represented and streamed
more effectively.

This also adds place for more info that may be used for ODR diagnostics
(i.e. at the moment we do not warn when the declarations differs i.e. by the
associated member functions and their types) and the type inheritance graph
rather then poluting the global stream.

I was bit unsure what enums we want to store into the section.  All parsed
enums is probably too expensive, only those enums streamed to represent IL is
bit hard to get, so I went for those seen by free lang data.

As a plus we now get bit more precise warning because also the location of
mismatched enum CONST_DECL is streamed.

It changes:
[WPA] read 4608466 unshared trees
[WPA] read 2942094 mergeable SCCs of average size 1.365328
[WPA] 8625389 tree bodies read in total
[WPA] tree SCC table: size 524287, 247652 elements, collision ratio: 0.383702
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 2694442 SCCs, 228 collisions (0.000085)
[WPA] Merged 2694419 SCCs
[WPA] Merged 3731982 tree bodies
[WPA] Merged 633335 types
[WPA] 122077 types prevailed (155548 associated trees)
...
[WPA] Compression: 110593119 input bytes, 287696614 uncompressed bytes (ratio: 2.601397)
[WPA] Size of mmap'd section decls: 85628556 bytes
[WPA] Size of mmap'd section function_body: 13842928 bytes

[WPA] read 1720989 unshared trees
[WPA] read 1252217 mergeable SCCs of average size 1.858507
[WPA] 4048243 tree bodies read in total
[WPA] tree SCC table: size 524287, 226524 elements, collision ratio: 0.491759
[WPA] tree SCC max chain length 2 (size 1)
[WPA] Compared 1025693 SCCs, 196 collisions (0.000191)
[WPA] Merged 1025670 SCCs
[WPA] Merged 2063373 tree bodies
[WPA] Merged 633497 types
[WPA] 122299 types prevailed (155827 associated trees)
...
[WPA] Compression: 103428770 input bytes, 281151423 uncompressed bytes (ratio: 2.718310)
[WPA] Size of mmap'd section decls: 49390917 bytes
[WPA] Size of mmap'd section function_body: 13858258 bytes
...
[WPA] Size of mmap'd section odr_types: 29054816 bytes

So number of SCCs streamed drops to 38% and the number of unshared trees (that
are bit misnamed since it is mostly integer_cst) to 37%.

Things speeds up correspondingly, but I did not save time report from previous
build.

The enum values are still quite surprisingly large.  I may take a look into
ways getting it smaller incrementally, but it streams reasonably fast:

Time variable                                   usr           sys          wall               GGC
 phase opt and generate             :  25.20 ( 68%)  10.88 ( 72%)  36.13 ( 69%)  868060 kB ( 52%)
 phase stream in                    :   4.46 ( 12%)   0.90 (  6%)   5.38 ( 10%)  790724 kB ( 48%)
 phase stream out                   :   6.69 ( 18%)   3.32 ( 22%)  10.03 ( 19%)       8 kB (  0%)
 ipa lto gimple in                  :   0.79 (  2%)   1.86 ( 12%)   2.39 (  5%)  252612 kB ( 15%)
 ipa lto gimple out                 :   2.48 (  7%)   0.78 (  5%)   3.26 (  6%)       0 kB (  0%)
 ipa lto decl in                    :   1.71 (  5%)   0.46 (  3%)   2.34 (  4%)  417883 kB ( 25%)
 ipa lto decl out                   :   3.28 (  9%)   0.07 (  0%)   3.27 (  6%)       0 kB (  0%)
 whopr wpa I/O                      :   0.40 (  1%)   2.24 ( 15%)   2.77 (  5%)       8 kB (  0%)
 lto stream decompression           :   1.38 (  4%)   0.31 (  2%)   1.36 (  3%)       0 kB (  0%)
 ipa ODR types                      :   0.18 (  0%)   0.02 (  0%)   0.25 (  0%)       0 kB (  0%)
 ipa inlining heuristics            :  11.64 ( 31%)   1.45 ( 10%)  13.12 ( 25%)  453160 kB ( 27%)
 ipa pure const                     :   1.74 (  5%)   0.00 (  0%)   1.76 (  3%)       0 kB (  0%)
 ipa icf                            :   1.72 (  5%)   5.33 ( 35%)   7.06 ( 13%)   16593 kB (  1%)
 whopr partitioning                 :   2.22 (  6%)   0.01 (  0%)   2.23 (  4%)    5689 kB (  0%)
 TOTAL                              :  37.17         15.20         52.46        1660886 kB

LTO-bootstrapped/regtested x86_64-linux, will comit it shortly.

gcc/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* ipa-devirt.c: Include data-streamer.h, lto-streamer.h and
streamer-hooks.h.
(odr_enums): New static var.
(struct odr_enum_val): New struct.
(class odr_enum): New struct.
(odr_enum_map): New hashtable.
(odr_types_equivalent_p): Drop code testing TYPE_VALUES.
(add_type_duplicate): Likewise.
(free_odr_warning_data): Do not free TYPE_VALUES.
(register_odr_enum): New function.
(ipa_odr_summary_write): New function.
(ipa_odr_read_section): New function.
(ipa_odr_summary_read): New function.
(class pass_ipa_odr): New pass.
(make_pass_ipa_odr): New function.
* ipa-utils.h (register_odr_enum): Declare.
* lto-section-in.c: (lto_section_name): Add odr_types section.
* lto-streamer.h (enum lto_section_type): Add odr_types section.
* passes.def: Add odr_types pass.
* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
TYPE_VALUES.
(hash_tree): Likewise.
* tree-streamer-in.c (lto_input_ts_type_non_common_tree_pointers):
Likewise.
* tree-streamer-out.c (write_ts_type_non_common_tree_pointers):
Likewise.
* timevar.def (TV_IPA_ODR): New timervar.
* tree-pass.h (make_pass_ipa_odr): Declare.
* tree.c (free_lang_data_in_type): Regiser ODR types.

gcc/lto/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* lto-common.c (compare_tree_sccs_1): Do not compare TYPE_VALUES.

gcc/testsuite/ChangeLog:

2020-06-03  Jan Hubicka  <hubicka@ucw.cz>

* g++.dg/lto/pr84805_0.C: Update.

4 years agocoroutines: Allow parameter packs in co_await/yield expressions [PR95345]
Iain Sandoe [Wed, 3 Jun 2020 08:03:22 +0000 (09:03 +0100)]
coroutines: Allow parameter packs in co_await/yield expressions [PR95345]

This corrects a pasto, where I copied the constraint on bare
parameter packs from the co_return to co_yield/await without
properly reviewing it.

gcc/cp/ChangeLog:

PR c++/95345
* coroutines.cc (finish_co_await_expr): Revise to allow for
parameter packs.
(finish_co_yield_expr): Likewise.

gcc/testsuite/ChangeLog:

PR c++/95345
* g++.dg/coroutines/pr95345.C: New test.

4 years agoFix missing dependencies for selftests which occasionally causes failed builds.
Romain Naour [Wed, 3 Jun 2020 18:30:57 +0000 (12:30 -0600)]
Fix missing dependencies for selftests which occasionally causes failed builds.

gcc/

* Makefile.in (SELFTEST_DEPS): Move before including language makefile
fragments.

4 years agoc++: Fix VLA in template [PR95232]
Jason Merrill [Tue, 2 Jun 2020 20:23:02 +0000 (16:23 -0400)]
c++: Fix VLA in template [PR95232]

In a non-template, grokdeclarator notices when we build a pointer to a
variably-modified type, and inserts a TYPE_DECL to make sure that type gets
gimplified.  But in a template we can't always recognize a variably-modified
type, so we need to deal with it at instantiation time.

gcc/cp/ChangeLog:

PR c++/95232
* cp-tree.h (predeclare_vla): Declare.
* cp-gimplify.c (predeclare_vla): Handle getting a decl.
* pt.c (tsubst_expr) [DECL_EXPR]: Use it.

gcc/testsuite/ChangeLog:

PR c++/95232
* g++.dg/ubsan/vla-2.C: New test.

4 years agoSimple patch only add assumed-rank to the list of possible attributes.
José Rui Faustino de Sousa [Wed, 3 Jun 2020 17:33:11 +0000 (19:33 +0200)]
Simple patch only add assumed-rank to the list of possible attributes.

gcc/fortran/ChangeLog:

2020-06-03  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/95214
PR fortran/66833
PR fortran/67938
* trans-expr.c (gfc_maybe_dereference_var): Add assumed-rank to
character dummy arguments list of possible attributes.

gcc/testsuite/ChangeLog:

2020-06-03  José Rui Faustino de Sousa  <jrfsousa@gmail.com>

PR fortran/95214
PR fortran/66833
PR fortran/67938
* gfortran.dg/PR95214.f90: New test.

4 years agotree-optimization/95487 - use a truth type for scatter masks
Richard Biener [Wed, 3 Jun 2020 13:51:29 +0000 (15:51 +0200)]
tree-optimization/95487 - use a truth type for scatter masks

This makes sure to get a truth type for scatter masks even when they
are invariant.

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

PR tree-optimization/95487
* tree-vect-stmts.c (vectorizable_store): Use a truth type
for the scatter mask.

* g++.dg/vect/pr95487.cc: New testcase.

4 years agojit: implement BT_CONST_VOLATILE_PTR [PR 95306]
David Malcolm [Wed, 3 Jun 2020 12:59:23 +0000 (08:59 -0400)]
jit: implement BT_CONST_VOLATILE_PTR [PR 95306]

gcc/jit/ChangeLog:
PR jit/95306
* jit-builtins.c (builtins_manager::make_primitive_type):
Implement BT_CONST_VOLATILE_PTR.

gcc/testsuite/ChangeLog:
PR jit/95306
* jit.dg/test-pr95306-builtin-types.c (create_code): Add
test of getting __atomic_load.

4 years agotree-optimization/95495 - use SLP_TREE_REPRESENTATIVE in assertion
Richard Biener [Wed, 3 Jun 2020 12:06:20 +0000 (14:06 +0200)]
tree-optimization/95495 - use SLP_TREE_REPRESENTATIVE in assertion

This fixes a place where I missed to use SLP_TREE_REPRESENTATIVE
after its introduction.

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

PR tree-optimization/95495
* tree-vect-slp.c (vect_slp_analyze_node_operations): Use
SLP_TREE_REPRESENTATIVE in the shift assertion.

* gcc.dg/vect/pr95495.c: New testcase.

4 years agoPrefer simple case changes in spelling suggestions
Tom Tromey [Fri, 29 May 2020 16:46:57 +0000 (10:46 -0600)]
Prefer simple case changes in spelling suggestions

I got this error message when editing gcc and recompiling:

../../gcc/gcc/ada/gcc-interface/decl.c:7714:39: error: â€˜DWARF_GNAT_ENCODINGS_all’ was not declared in this scope; did you mean â€˜DWARF_GNAT_ENCODINGS_GDB’?
 7714 |     = debug_info && gnat_encodings == DWARF_GNAT_ENCODINGS_all;
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                       DWARF_GNAT_ENCODINGS_GDB

This suggestion could be improved -- what happened here is that I
failed to upper-case the word, and DWARF_GNAT_ENCODINGS_ALL was the
correct spelling.

This patch changes gcc's spell checker to prefer simple case changes
when possible.

I tested this using the self-tests.  A new self-test is also included.

gcc/ChangeLog:

* spellcheck.c (CASE_COST): New define.
(BASE_COST): New define.
(get_edit_distance): Recognize case changes.
(get_edit_distance_cutoff): Update.
(test_edit_distances): Update.
(get_old_cutoff): Update.
(test_find_closest_string): Add case sensitivity test.

4 years agosimplify visited flag unsetting in SLP scalar cost computation
Richard Biener [Wed, 3 Jun 2020 11:17:11 +0000 (13:17 +0200)]
simplify visited flag unsetting in SLP scalar cost computation

This changes the loop over all stmts to a loop over all costed stmts.

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

* tree-vect-slp.c (vect_bb_vectorization_profitable_p): Loop over
the cost vector to unset the visited flag on stmts.

4 years ago[OpenMP] Fix mapping of artificial variables (PR94874)
Tobias Burnus [Wed, 3 Jun 2020 10:28:25 +0000 (12:28 +0200)]
[OpenMP] Fix mapping of artificial variables (PR94874)

gcc/c-family/ChangeLog:

* c-common.h (c_omp_predetermined_mapping): Declare.
* c-omp.c (c_omp_predetermined_mapping): New.

gcc/c/ChangeLog:

* c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redefine.

gcc/cp/ChangeLog:

* cp-gimplify.c (cxx_omp_predetermined_mapping): New.
* cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
* cp-tree.h (cxx_omp_predetermined_mapping): Declare.

gcc/fortran/ChangeLog:

* f95-lang.c (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redefine.
* trans-openmp.c (gfc_omp_predetermined_mapping): New.
* trans.h (gfc_omp_predetermined_mapping): Declare.

gcc/ChangeLog:

* gimplify.c (omp_notice_variable): Use new hook.
* langhooks-def.h (lhd_omp_predetermined_mapping): Declare.
(LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Define
(LANG_HOOKS_DECLS): Add it.
* langhooks.c (lhd_omp_predetermined_sharing): Remove bogus unused attr.
(lhd_omp_predetermined_mapping): New.
* langhooks.h (struct lang_hooks_for_decls): Add new hook.

gcc/testsuite/ChangeLog
2020-06-03  Thomas Schwinge  <thomas@codesourcery.com>
    Tobias Burnus  <tobias@codesourcery.com>

PR middle-end/94874
* c-c++-common/gomp/pr94874.c: New.

4 years agoCleanup LTO tag streaming.
Jan Hubicka [Wed, 3 Jun 2020 10:03:40 +0000 (12:03 +0200)]
Cleanup LTO tag streaming.

this patch cleanups a bit the way LTO tags are assigned (so we do not use magic
numbers of 2) and reorders them approximately by their frequency so the stream
gets little bit smaller because of uleb coding.

From:

[WPA] Compression: 111213968 input bytes, 293801489 uncompressed bytes (ratio: 2.641768)
[WPA] Size of mmap'd section decls: 85983129 bytes
[WPA] Size of mmap'd section function_body: 14058627 bytes

to:

[WPA] Compression: 110593119 input bytes, 287696614 uncompressed bytes (ratio: 2.601397)
[WPA] Size of mmap'd section decls: 85628556 bytes
[WPA] Size of mmap'd section function_body: 13842928 bytes

lto-bootstrapped/regtested x86_64-linux, will commit it shortly.

* lto-streamer.h (LTO_tags): Reorder so frequent tags has small indexes;
add LTO_first_tree_tag and LTO_first_gimple_tag.
(lto_tag_is_tree_code_p): Update.
(lto_tag_is_gimple_code_p): Update.
(lto_gimple_code_to_tag): Update.
(lto_tag_to_gimple_code): Update.
(lto_tree_code_to_tag): Update.
(lto_tag_to_tree_code): Update.

4 years ago[Ada] Fix for missing calls to Adjust primitive with nested generics
Eric Botcazou [Fri, 17 Jan 2020 18:37:39 +0000 (19:37 +0100)]
[Ada] Fix for missing calls to Adjust primitive with nested generics

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

gcc/ada/

* sem_ch12.adb (Denotes_Previous_Actual): Delete.
(Check_Generic_Actuals): Do not special case array types whose
component type denotes a previous actual.  Do not special case
access types whose base type is private.
(Check_Private_View): Remove code dealing with secondary types.
Do not switch the views of an array because of its component.
(Copy_Generic_Node): Add special handling for a comparison
operator on array types.
(Instantiate_Type): Do not special case access types whose
designated type is private.
(Set_Global_Type): Do not special case array types whose
component type is private.

4 years ago[Ada] Spurious ineffective with clause warnings on use type clause
Justin Squirek [Fri, 17 Jan 2020 14:10:43 +0000 (09:10 -0500)]
[Ada] Spurious ineffective with clause warnings on use type clause

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

gcc/ada/

* sem_ch10.adb (Process_Body_Clauses): Add loop to interate
through all prefixes in a use_type clause so that all packages
in the expanded name get examined for effectiveness.

4 years ago[Ada] Small housekeeping work in Check_Private_View
Eric Botcazou [Thu, 16 Jan 2020 15:53:39 +0000 (16:53 +0100)]
[Ada] Small housekeeping work in Check_Private_View

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

gcc/ada/

* sem_ch12.adb (Check_Private_View): Clean up implementation of
second main case, when the generic sees the private declaration.

4 years ago[Ada] Add detection of uninitialized big reals
Arnaud Charlet [Tue, 14 Jan 2020 13:21:20 +0000 (08:21 -0500)]
[Ada] Add detection of uninitialized big reals

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

gcc/ada/

* libgnat/a-nbnbin.ads: Minor reformatting.
* libgnat/a-nbnbre.ads, libgnat/a-nbnbre.adb (Is_Valid): Add
convention Intrinsic. Add detection of uninitialized big reals.

4 years ago[Ada] Remove more cases of empty loops
Arnaud Charlet [Wed, 15 Jan 2020 10:05:52 +0000 (05:05 -0500)]
[Ada] Remove more cases of empty loops

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

gcc/ada/

* sem_util.ads, sem_util.adb (Side_Effect_Free_Statements,
Side_Effect_Free_Loop): New functions.
(Has_Non_Null_Statements): Consider N_Call_Marker as a null
statement.
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Call
Set_Is_Null_Loop even inside a generic instantiation.
(Analyze_Loop_Statement): Mark for removal loops with no side
effects.

4 years ago[Ada] Support pragma Allow_Integer_Address on 64-bit targets
Eric Botcazou [Wed, 15 Jan 2020 10:03:14 +0000 (11:03 +0100)]
[Ada] Support pragma Allow_Integer_Address on 64-bit targets

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

gcc/ada/

* opt.ads (Allow_Integer_Address): Fix typo in comment.
* stand.ads (Standard_Address): New entity.
* cstand.adb (Create_Standard): Create it.
* sem_ch4.adb (Operator_Check): Convert the operands of an
operation with addresses and integers to Standard_Address
if pragma Allow_Integer_Address is in effect.

4 years ago[Ada] Get rid of more references to Universal_Integer in expanded code
Eric Botcazou [Tue, 14 Jan 2020 20:56:28 +0000 (21:56 +0100)]
[Ada] Get rid of more references to Universal_Integer in expanded code

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

gcc/ada/

* libgnat/s-atopar.adb (Atomic_Fetch_And_Add): Make use of an
equivalent static expression.
(Atomic_Fetch_And_Subtract): Likewise.
(Is_Lock_Free): Likewise.
* libgnat/s-atopex.adb (Atomic_Exchange): Likewise.
(Atomic_Compare_And_Exchange): Likewise.
(Is_Lock_Free): Likewise.

4 years ago[Ada] Fix typos
Vadim Godunko [Sat, 11 Jan 2020 15:25:18 +0000 (18:25 +0300)]
[Ada] Fix typos

2020-06-03  Vadim Godunko  <godunko@adacore.com>

gcc/ada/

* libgnat/s-parame.ads, libgnat/s-parame__ae653.ads,
libgnat/s-parame__hpux.ads: Fix typos.

4 years ago[Ada] Avoid creating temporaries in Universal_Integer, continued
Eric Botcazou [Mon, 13 Jan 2020 20:17:48 +0000 (21:17 +0100)]
[Ada] Avoid creating temporaries in Universal_Integer, continued

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

gcc/ada/

* exp_util.adb (Remove_Side_Effects): For a type conversion, do
not remove the side effects of the expression only if it is of
universal integer type.

4 years ago[Ada] Update headers
Arnaud Charlet [Sat, 11 Jan 2020 10:33:27 +0000 (05:33 -0500)]
[Ada] Update headers

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

gcc/ada/

* libgnat/s-aotase.ads, libgnat/s-atoope.ads,
libgnat/s-atopar.ads, libgnat/s-atopex.ads: Update header.

4 years ago[Ada] Small improvement to Expand_N_Unchecked_Type_Conversion
Eric Botcazou [Fri, 10 Jan 2020 20:55:33 +0000 (21:55 +0100)]
[Ada] Small improvement to Expand_N_Unchecked_Type_Conversion

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

gcc/ada/

* exp_ch4.adb (Expand_N_Unchecked_Type_Conversion): Also fold the
conversion for literals of enumeration types.

4 years ago[Ada] Improve handling of SPARK_Mode in generic instances
Yannick Moy [Fri, 10 Jan 2020 13:46:25 +0000 (14:46 +0100)]
[Ada] Improve handling of SPARK_Mode in generic instances

2020-06-03  Yannick Moy  <moy@adacore.com>

gcc/ada/

* rtsfind.adb (Load_RTU): Correctly set/reset global variable to
ignore SPARK_Mode in instances around loading.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Accept Off
without prior On.
* sem_ch7.adb (Analyze_Package_Body_Helper): Likewise.
* sem_prag.adb (Analyze_Pragma): Always take into account
SPARK_Mode Off.

4 years ago[Ada] Initial infrastructure for adding a tree checker
Arnaud Charlet [Thu, 9 Jan 2020 16:04:35 +0000 (11:04 -0500)]
[Ada] Initial infrastructure for adding a tree checker

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

gcc/ada/

* frontend.adb (Frontend): Call (dummy for now) tree checker.
* debug.adb: Reserve -gnatd_V for the tree checker.
* vast.ads, vast.adb: New files.
* gcc-interface/Make-lang.in: Add vast.o.

4 years ago[Ada] Incorrect accessibility checking on aliased formals
Justin Squirek [Wed, 8 Jan 2020 03:57:19 +0000 (22:57 -0500)]
[Ada] Incorrect accessibility checking on aliased formals

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

gcc/ada/

* libgnat/a-cborse.adb, libgnat/a-cihase.adb,
libgnat/a-ciorse.adb, libgnat/a-coorse.adb: Modified to use
'Unrestricted_Access in certain cases where static accessibility
errors were triggered.
* exp_ch6.adb (Expand_Simple_Return_Statement): Add generation
of dynamic accessibility checks as determined by
Is_Special_Aliased_Formal_Access.
* sem_attr.adb (Resolve_Attribute): Add call to
Is_Special_Aliased_Formal_Access to avoid performing static
checks where dynamic ones are required.
* sem_ch6.adb (Check_Return_Obj_Accessibility): Handle renamed
objects within component associations requiring special
accessibility checks.
* sem_util.adb, sem_util.ads (Is_Special_Aliased_Formal_Access):
Created to detect the special case where an aliased formal is
being compared against the level of an anonymous access return
object.
(Object_Access_Level): Remove incorrect condition leading to
overly permissive accessibility levels being returned on
explicitly aliased parameters.

4 years ago[Ada] Improve 'Val implementation for some enumeration types
Eric Botcazou [Thu, 9 Jan 2020 15:25:39 +0000 (16:25 +0100)]
[Ada] Improve 'Val implementation for some enumeration types

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

gcc/ada/

* einfo.ads (Enum_Pos_To_Rep): Adjust description.
* exp_attr.adb (Expand_N_Attribute_Reference) <Pred>:
Reimplement in the case of an enumeration type with non-standard
but contiguous representation.
<Succ>: Likewise.
<Val>: Likewise.
* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Count the
literals in the first loop.  If the representation is
contiguous, just build the index type of the array type and set
Enum_Pos_To_Rep to it.

4 years ago[Ada] Unnesting problems with expansion of Loop_Entry attribute
Gary Dismukes [Wed, 8 Jan 2020 22:36:43 +0000 (17:36 -0500)]
[Ada] Unnesting problems with expansion of Loop_Entry attribute

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

gcc/ada/

* exp_attr.adb (Expand_Loop_Entry_Attribute): Revise loop that
resets the scopes of entities associated with Loop_Id to the
scope of the new function, so the resetting is not restricted to
itypes, but excludes loop parameters and the function entity
itself. However, this fix is believed to be incomplete and a ???
comment is added to indicate that.

4 years ago[Ada] Minor change to comment in System.Regexp spec
Bob Duff [Wed, 8 Jan 2020 15:55:33 +0000 (10:55 -0500)]
[Ada] Minor change to comment in System.Regexp spec

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

gcc/ada/

* libgnat/s-regexp.ads: Fix comment

4 years ago[Ada] Get rid of more references to Universal_Integer in expanded code
Eric Botcazou [Wed, 8 Jan 2020 23:04:34 +0000 (00:04 +0100)]
[Ada] Get rid of more references to Universal_Integer in expanded code

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

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference) <Enum_Rep>:
In the case of an enumeration type, do an intermediate
conversion to a small integer type.  Remove useless stuff.
<Finalization_Size>: Do not hardcode Universal_Integer and
fix a type mismatch in the assignment to the variable.
<Max_Size_In_Storage_Elements>: Likewise.
<From_Any>: Do not redefine the Ptyp local variable.
<To_Any>: Likewise.
<TypeCode>: Likewise.
<Pos>: Small tweaks.
<Val>: For an enumeration type with standard representation,
apply the range check to the expression of a convertion to
Universal_Integer, if any.  For an integer type, expand to
a mere conversion.

4 years ago[Ada] More efficient System.Random_Numbers.Random_Discrete for 32-bit types
Eric Botcazou [Tue, 7 Jan 2020 22:04:13 +0000 (23:04 +0100)]
[Ada] More efficient System.Random_Numbers.Random_Discrete for 32-bit types

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

gcc/ada/

* libgnat/s-rannum.adb (Random_Discrete): In the 32-bit case,
use the same linear implementation as in the 64-bit case when
the type has a contiguous representation.

4 years ago[Ada] Debug info not available on subp having a class-wide precondition
Gary Dismukes [Tue, 7 Jan 2020 22:28:16 +0000 (17:28 -0500)]
[Ada] Debug info not available on subp having a class-wide precondition

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

gcc/ada/

* sem_util.adb (Build_Class_Wide_Clone_Decl): Call
Set_Debug_Info_Needed to set the Needs_Debug_Info flag on
Clone_Id if the flag is set on Spec_Id.

4 years ago[Ada] Fix missing overflow checks in analysis of predefined unit
Yannick Moy [Tue, 7 Jan 2020 16:39:31 +0000 (17:39 +0100)]
[Ada] Fix missing overflow checks in analysis of predefined unit

2020-06-03  Yannick Moy  <moy@adacore.com>

gcc/ada/

* inline.adb (Expand_Inlined_Call): Do not suppress checks on
inlined code in GNATprove mode.

4 years ago[Ada] Fix typo in comment
Eric Botcazou [Tue, 7 Jan 2020 22:17:30 +0000 (23:17 +0100)]
[Ada] Fix typo in comment

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

gcc/ada/

* einfo.ads (Has_Contiguous_Rep): Fix typo in comment.

4 years ago[Ada] Iterate with procedural versions of Next_... routines where possible
Piotr Trojanek [Sun, 5 Jan 2020 22:53:42 +0000 (23:53 +0100)]
[Ada] Iterate with procedural versions of Next_... routines where possible

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

gcc/ada/

* checks.adb, einfo.adb, exp_aggr.adb, exp_ch4.adb, exp_ch6.adb,
exp_unst.adb, exp_util.adb, freeze.adb, inline.adb, repinfo.adb,
sem_aggr.adb, sem_attr.adb, sem_aux.adb, sem_ch13.adb,
sem_ch3.adb, sem_ch4.adb, sem_ch8.adb, sem_elab.adb,
sem_eval.adb, sem_prag.adb, sem_res.adb, sem_smem.adb,
sem_util.adb, treepr.adb: Replace uses of Next_ functions with
corresponding procedures.

4 years ago[Ada] Get rid of more references to Universal_Integer in expanded code
Eric Botcazou [Mon, 6 Jan 2020 12:14:58 +0000 (13:14 +0100)]
[Ada] Get rid of more references to Universal_Integer in expanded code

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

gcc/ada/

* exp_attr.adb (Attribute_Valid): Use Standard_Long_Long_Integer
in lieu of Universal_Integer as large integer type.
* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Likewise.

4 years ago[Ada] Add Address_Int declaration in s-auxdec.ads
Arnaud Charlet [Fri, 3 Jan 2020 16:18:18 +0000 (11:18 -0500)]
[Ada] Add Address_Int declaration in s-auxdec.ads

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

gcc/ada/

* libgnat/s-auxdec.ads (Address_Int): New.

4 years ago[Ada] Remove ASIS tree generation
Arnaud Charlet [Wed, 1 Jan 2020 20:19:05 +0000 (15:19 -0500)]
[Ada] Remove ASIS tree generation

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

gcc/ada/

* aspects.adb, aspects.ads, atree.adb, atree.ads, elists.adb,
elists.ads, fname.adb, fname.ads, gnat1drv.adb, lib.adb,
lib.ads, namet.adb, namet.ads, nlists.adb, nlists.ads, opt.adb,
opt.ads, osint-c.adb, osint-c.ads, repinfo.adb, repinfo.ads,
sem_aux.adb, sem_aux.ads, sinput.adb, sinput.ads, stand.ads,
stringt.adb, stringt.ads, switch-c.adb, table.adb, table.ads,
uintp.adb, uintp.ads, urealp.adb, urealp.ads (Tree_Read,
Tree_Write): Remove generation of ASIS trees.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Remove -gnatt and -gnatct documentation.
* gnat_ugn.texi: Regenerate.
* tree_in.ads, tree_in.adb, tree_io.ads, tree_io.adb,
tree_gen.ads, tree_gen.adb, stand.adb: Remove.
* gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Remove
references to tree_gen.o tree_in.o tree_io.o.

4 years ago[Ada] Put a couple of options in alphabetical order
Eric Botcazou [Mon, 6 Jan 2020 09:12:44 +0000 (10:12 +0100)]
[Ada] Put a couple of options in alphabetical order

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

gcc/ada/

* opt.ads (Disable_FE_Inline): Move around.
(Disable_FE_Inline_Always): Likewise.

4 years ago[Ada] Avoid creating temporaries in Universal_Integer for range checks
Eric Botcazou [Fri, 3 Jan 2020 14:31:08 +0000 (15:31 +0100)]
[Ada] Avoid creating temporaries in Universal_Integer for range checks

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

gcc/ada/

* checks.adb (Is_Single_Attribute_Reference): New predicate.
(Generate_Range_Check): Do not force the evaluation if the
node is a single attribute reference.
* exp_util.adb (Side_Effect_Free_Attribute): New predicate.
(Side_Effect_Free) <N_Attribute_Reference>: Call it.
(Remove_Side_Effects): Remove the side effects of the prefix
for an attribute reference whose prefix is not a name.

4 years ago[Ada] Remove -gnatt switch processing
Arnaud Charlet [Fri, 3 Jan 2020 10:58:37 +0000 (11:58 +0100)]
[Ada] Remove -gnatt switch processing

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

gcc/ada/

* switch-c.adb (Scan_Front_End_Switches): Remove processing of
-gnatt.
* usage.adb (Usage): Remove mention of -gnatt.

4 years ago[Ada] Minor tweaks in commentary
Eric Botcazou [Fri, 3 Jan 2020 07:55:57 +0000 (08:55 +0100)]
[Ada] Minor tweaks in commentary

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

gcc/ada/

* sinfo.ads: Minor tweaks in commentary.

4 years agogcov: Fix build on AIX
Martin Liska [Tue, 2 Jun 2020 14:57:35 +0000 (16:57 +0200)]
gcov: Fix build on AIX

We must guard used atomic builtins with GCOV_SUPPORTS_ATOMIC.
The patch is tested on AIX and I'm going to push it.

libgcc/ChangeLog:

PR gcov-profile/95480
* libgcov-profiler.c (GCOV_SUPPORTS_ATOMIC): Move to...
* libgcov.h (GCOV_SUPPORTS_ATOMIC): ...here.
(gcov_counter_add): Use GCOV_SUPPORTS_ATOMIC guard.
(gcov_counter_set_if_null): Likewise.

4 years agoDaily bump.
GCC Administrator [Wed, 3 Jun 2020 00:16:34 +0000 (00:16 +0000)]
Daily bump.

4 years agojit: fix __builtin_unreachable [PR 95426]
David Malcolm [Sun, 31 May 2020 17:28:41 +0000 (13:28 -0400)]
jit: fix __builtin_unreachable [PR 95426]

PR jit/95426 reports a crash deep inside "expand" when using
__builtin_unreachable via gcc_jit_context_get_builtin_function,
due to BLOCK_FOR_INSN being erroneously used on a barrier within
rtl_verify_bb_pointers.

The root cause turns out to be that I didn't implement
LANG_HOOKS_COMMON_ATTRIBUTE_TABLE and LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
for the jit "frontend".  When building a decl for the builtin, the
libgccjit frontend generates a chain of attributes names, but when
this is passed to decl_attributes and the attributes are looked up by
namespace and name within lookup_scoped_attribute_spec, attributes_table
is empty.  Hence no attributes were being associated with the fndecl,
and so ECF_NORETURN was not set on the gimple_call (along with various
other flags missing on the decl, etc), and so the call is treated as
not terminating its BB, and so the CFG rapidly diverges from the
equivalent created by the C frontend.

This patch fixes things by implementing these langhooks, copying the
minimal attribute-handling code from LTO.  I stepped through the
creation of the fndecl and verified that with this fix it has the same
attributes as the equivalent created by the C frontend.

gcc/jit/ChangeLog:
PR jit/95426
* dummy-frontend.c: Include "options.h", "stringpool.h", and
"attribs.h".
(ATTR_EXCL): New, copied from lto/lto-lang.c.
(attr_noreturn_exclusions): Likewise.
(attr_returns_twice_exclusions): Likewise.
(attr_const_pure_exclusions): Likewise.
(jit_attribute_table): Likewise, copied from lto_attribute_table.
(jit_format_attribute_table): Likewise, copied from
lto_format_attribute_table.
(handle_noreturn_attribute): New, copied from lto/lto-lang.c.
(handle_leaf_attribute): Likewise.
(handle_const_attribute): Likewise.
(handle_malloc_attribute): Likewise.
(handle_pure_attribute): Likewise.
(handle_novops_attribute): Likewise.
(get_nonnull_operand): Likewise.
(handle_nonnull_attribute): Likewise.
(handle_nothrow_attribute): Likewise.
(handle_sentinel_attribute): Likewise.
(handle_type_generic_attribute): Likewise.
(handle_transaction_pure_attribute): Likewise.
(handle_returns_twice_attribute): Likewise.
(handle_patchable_function_entry_attribute): Likewise.
(ignore_attribute): Likewise.
(handle_format_attribute): Likewise.
(handle_format_arg_attribute): Likewise.
(handle_fnspec_attribute): Likewise.
(LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Define.
(LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Define.

gcc/testsuite/ChangeLog:
PR jit/95426
* jit.dg/all-non-failing-tests.h: Add note about...
* jit.dg/test-builtin-unreachable.c: New test.

4 years agoc++: *this capture in const member fn [PR95193].
Jason Merrill [Mon, 1 Jun 2020 21:58:57 +0000 (17:58 -0400)]
c++: *this capture in const member fn [PR95193].

Here, the capture proxy for *this is const, but its DECL_VALUE_EXPR is not.
Don't ICE on this; it's a reasonable difference, since in C++ an rvalue of
scalar type does not have cv-qualifiers.

gcc/cp/ChangeLog:

PR c++/95193
* pt.c (tsubst_decl): Relax assert.

gcc/testsuite/ChangeLog:

PR c++/95193
* g++.dg/cpp1z/lambda-this7.C: New test.

4 years agoRISC-V: Make __divdi3 handle div by zero same as hardware.
Jim Wilson [Tue, 2 Jun 2020 18:19:39 +0000 (11:19 -0700)]
RISC-V: Make __divdi3 handle div by zero same as hardware.

The ISA manual specifies that divide by zero always returns -1 as the result.
We were failing to do that when the dividend was negative.

Original patch from Virginie Moser.

libgcc/
* config/riscv/div.S (__divdi3): For negative arguments, change bgez
to bgtz.

4 years ago[Ada] remove last traces of -auxbase
Alexandre Oliva [Tue, 2 Jun 2020 18:36:49 +0000 (15:36 -0300)]
[Ada] remove last traces of -auxbase

Remove occurrences of auxbase that remained in comments.

for  gcc/ada/ChangeLog

* lib.ads (Compilation_Switches): Remove -auxbase from
comments.
* switch.ads (Is_Internal_GCC_Switch): Likewise.

4 years agocoroutines: Wrap co_await in a target expr where needed [PR95050]
Iain Sandoe [Tue, 2 Jun 2020 15:47:54 +0000 (16:47 +0100)]
coroutines: Wrap co_await in a target expr where needed [PR95050]

Since the co_await expression is mostly opaque to the existing
machinery, we were hiding the details of the await_resume return
value.  If that needs to be wrapped in a target expression, then
emulate this with the whole co_await.  Similarly, if the await
expression we build in response to co_await p.yield_value (e)
is wrapped in a target expression, then we need to transfer that
wrapper to the resultant CO_YIELD_EXPR (which is, itself, just
a proxy for the underlying co_await).

gcc/cp/ChangeLog:

PR c++/95050
* coroutines.cc (build_co_await): Wrap the co_await expression
in a TARGET_EXPR, where needed.
(finish_co_yield_expr): Likewise.

gcc/testsuite/ChangeLog:

PR c++/95050
* g++.dg/coroutines/pr95050.C: New test.

4 years agospell ldscript correctly in outputs.exp et al
Alexandre Oliva [Tue, 2 Jun 2020 17:33:38 +0000 (14:33 -0300)]
spell ldscript correctly in outputs.exp et al

In my recent changes to outputs.exp and gcc-defs.exp, I misreferenced
dejagnu board property ldscript, singular, as ldscripts, plural.

This probably didn't have much impact on gcc-defs.exp: the code there
would just prefix with -Wl, any options that amounted to file names,
and linker scripts probably wouldn't be named without a -T or even an
-Wl,-T, prefix.

The visible effects were in outputs.exp, that also intended to add the
ldscript, if present, to the set of options to be passed to the
compiler driver for linking.  Using the wrong option name, that
wouldn't work.

for  gcc/testsuite/ChangeLog

* gcc.misc-tests/outputs.exp: Spell ldscript correctly.
* lib/gcc-defs.exp (gcc_adjust_linker_flags): Likewise.

4 years agoaarch64: Fix an ICE in aarch64_short_vector_p [PR95459]
Fei Yang [Tue, 2 Jun 2020 17:17:34 +0000 (18:17 +0100)]
aarch64: Fix an ICE in aarch64_short_vector_p [PR95459]

In aarch64_short_vector_p, we are simply checking whether a type (and a mode)
is a 64/128-bit short vector or not.  This should not be affected by the value
of TARGET_SVE.  Simply leave later code to report an error if SVE is disabled.

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

gcc/
PR target/95459
* config/aarch64/aarch64.c (aarch64_short_vector_p):
Leave later code to report an error if SVE is disabled.

gcc/testsuite/
PR target/95459
* gcc.target/aarch64/mgeneral-regs_6.c: New test.