platform/upstream/gcc.git
4 years ago[Ada] Simplify iteration over components
Piotr Trojanek [Thu, 16 Jan 2020 17:50:05 +0000 (18:50 +0100)]
[Ada] Simplify iteration over components

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

gcc/ada/

* einfo.adb: Minor reformatting.
* sem_util.adb (Has_Full_Default_Initialization,
Is_Partially_Initialized_Type, Caller_Known_Size_Record,
Large_Max_Size_Mutable): Iterate with
First_Component/Next_Component; rename Ent to Comp.

4 years ago[Ada] Fix incorrect initialization for array of non-standard enumeration type
Eric Botcazou [Tue, 4 Feb 2020 23:13:00 +0000 (00:13 +0100)]
[Ada] Fix incorrect initialization for array of non-standard enumeration type

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

gcc/ada/

* exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Use
Expr_Rep_Value instead of Expr_Value to obtain the equivalent
integer value.
* sem_eval.ads (Expr_Value): Document more supported cases.
* sem_eval.adb (Expr_Rep_Value): Copy missing cases from
Exp_Value.

4 years ago[Ada] Put_Image attribute: Rtsfind cleanups
Bob Duff [Tue, 4 Feb 2020 16:08:32 +0000 (11:08 -0500)]
[Ada] Put_Image attribute: Rtsfind cleanups

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

gcc/ada/

* rtsfind.adb, rtsfind.ads: Move subtypes of RTU_Id into package
body, because they are not needed by clients. Change "Child_" to
"Descendant", because grandchildren and great grandchildren are
involved.  Replace all the repetitive comments with a single
concise one.  Change the parent subtypes to be more consistent;
use the most specific parent.

4 years ago[Ada] Move routine for detecting special Text_IO packages from GNATprove
Piotr Trojanek [Mon, 3 Feb 2020 16:44:41 +0000 (17:44 +0100)]
[Ada] Move routine for detecting special Text_IO packages from GNATprove

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

gcc/ada/

* rtsfind.ads, rtsfind.adb (Is_Text_IO_Special_Package): Moved
from the GNATprove backend to the frontend.

4 years ago[Ada] Add comment about function only used in CodePeer
Yannick Moy [Mon, 3 Feb 2020 15:30:34 +0000 (16:30 +0100)]
[Ada] Add comment about function only used in CodePeer

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

gcc/ada/

* sem_util.ads: Add comment about function only used in
CodePeer.

4 years ago[Ada] Spurious error on address clause in task body
Ed Schonberg [Fri, 31 Jan 2020 17:28:21 +0000 (12:28 -0500)]
[Ada] Spurious error on address clause in task body

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

gcc/ada/

* sem_ch9.adb, (Analyze_Task_Body): After analying the task
body, indicate that all local variables have no delayed aspects.
This prevents improper later calls to
Check_Aspect_At_End_Of_Declarations, that would happen when the
constructed task_procedure body (generated during expansion) is
analyzed. The legality of aspect specifications that may appear
on local declarations has already been established, and it is in
general not possible to recheck them properly during expansion,
when visibility may not be fully established.

4 years ago[Ada] Add missing Global contract to Ada.Containers.Functional_Vectors
Piotr Trojanek [Fri, 31 Jan 2020 20:13:31 +0000 (21:13 +0100)]
[Ada] Add missing Global contract to Ada.Containers.Functional_Vectors

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

gcc/ada/

* libgnat/a-cofuve.ads (First): Add Global contract.

4 years ago[Ada] AI12-0207 Convention of anonymous access types
Arnaud Charlet [Fri, 31 Jan 2020 20:53:42 +0000 (15:53 -0500)]
[Ada] AI12-0207 Convention of anonymous access types

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

gcc/ada/

* sem_prag.adb (Set_Convention_From_Pragma): Set the convention
of anonymous access array components.

4 years ago[Ada] AI12-0336 Meaning of Time_Offset
Arnaud Charlet [Fri, 31 Jan 2020 14:18:37 +0000 (09:18 -0500)]
[Ada] AI12-0336 Meaning of Time_Offset

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

gcc/ada/

* libgnat/a-calfor.ads, libgnat/a-catizo.ads,
libgnat/a-catizo.adb (Local_Time_Offset, Local_Image): New.
(UTC_Time_Offset): Now a renaming of Local_Time_Offset.

4 years ago[Ada] Fix assertion failure on double rederivation of private type
Eric Botcazou [Fri, 31 Jan 2020 10:56:30 +0000 (11:56 +0100)]
[Ada] Fix assertion failure on double rederivation of private type

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

gcc/ada/

* sem_ch3.adb (Available_Full_View): New function returning
either the full or the underlying full view.
(Build_Full_Derivation): Add guard for the full view.
(Copy_And_Build): Retrieve the underlying full view, if any,
also if deriving a completion.
(Build_Derived_Private_Type): Use Available_Full_View throughout
to decide whether a full derivation must be done.

4 years ago[Ada] Put_Image attribute
Bob Duff [Fri, 31 Jan 2020 13:28:45 +0000 (08:28 -0500)]
[Ada] Put_Image attribute

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

gcc/ada/

* exp_attr.adb, exp_ch11.adb, exp_imgv.adb, exp_tss.ads,
par-ch4.adb, sem_attr.adb, sem_util.ads: Misc cleanup.

4 years ago[Ada] AI12-0144 Make Discrete_Random more flexible
Arnaud Charlet [Fri, 31 Jan 2020 10:47:01 +0000 (05:47 -0500)]
[Ada] AI12-0144 Make Discrete_Random more flexible

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

gcc/ada/

* libgnat/a-nudira.ads, libgnat/a-nudira.adb (Random): New
function.

4 years ago[Ada] AI12-0237 Getting the representation of an enumeration value
Arnaud Charlet [Fri, 31 Jan 2020 12:52:25 +0000 (07:52 -0500)]
[Ada] AI12-0237 Getting the representation of an enumeration value

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

gcc/ada/

* sem_attr.ads (Attribute_Impl_Def): Remove Enum_Rep/Val.
* sem_attr.adb (Attribute_20): New, move Enum_Rep/Val here.
(Analyze_Attribute): Take Attribute_20 into account.

4 years ago[Ada] AI12-0318 No_IO should apply to Ada.Directories
Arnaud Charlet [Fri, 31 Jan 2020 11:22:26 +0000 (06:22 -0500)]
[Ada] AI12-0318 No_IO should apply to Ada.Directories

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

gcc/ada/

* restrict.ads (Unit_Array): Add a-direct.

4 years ago[Ada] AI12-0235 System.Storage_Pools should be pure
Arnaud Charlet [Fri, 31 Jan 2020 11:05:01 +0000 (06:05 -0500)]
[Ada] AI12-0235 System.Storage_Pools should be pure

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

gcc/ada/

* libgnat/s-stopoo.ads: Mark package Pure and leave room for
Nonblocking once this aspect is supported.

4 years ago[Ada] Add No_Truncation flag on view conversion for GNAT-LLVM
Eric Botcazou [Thu, 30 Jan 2020 20:48:27 +0000 (21:48 +0100)]
[Ada] Add No_Truncation flag on view conversion for GNAT-LLVM

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

gcc/ada/

* exp_attr.adb (Expand_N_Attribute_Reference) <Valid_Scalars>:
Set the No_Truncation flag on the unchecked conversion built for
scalar types.

4 years ago[Ada] Assertion_Policy (Ignore) ignores invariants
Bob Duff [Thu, 30 Jan 2020 19:45:19 +0000 (14:45 -0500)]
[Ada] Assertion_Policy (Ignore) ignores invariants

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

gcc/ada/

* einfo.adb, einfo.ads, exp_util.adb: Remove Invariants_Ignored
flag.
* sem_prag.adb (Invariant): Instead of setting a flag to be
checked elsewhere, remove the pragma as soon as it is analyzed
and checked for legality.

4 years ago[Ada] Rename parameter of routines in Checks
Eric Botcazou [Thu, 30 Jan 2020 12:23:31 +0000 (13:23 +0100)]
[Ada] Rename parameter of routines in Checks

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

gcc/ada/

* checks.ads (Apply_Length_Check): Rename Ck_Node parameter to
Expr.
(Apply_Range_Check): Likewise.
(Get_Range_Checks): Likewise.
* checks.adb (Apply_Float_Conversion_Check): Likewise.
(Apply_Selected_Length_Checks): Likewise.
(Apply_Selected_Range_Checks): Likewise.
(Guard_Access): Likewise.
(Selected_Length_Checks): Likewise.  Also avoid shadowing in
child procedures.
(Selected_Range_Checks): Likewise.

4 years ago[Ada] Minor wording changes wrt Ada 202x
Arnaud Charlet [Thu, 30 Jan 2020 08:09:19 +0000 (03:09 -0500)]
[Ada] Minor wording changes wrt Ada 202x

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

gcc/ada/

* par-ch3.adb, par-ch4.adb, scng.adb, sem_aggr.adb,
sem_ch10.adb, sem_ch12.adb, sem_prag.adb: Update wording: change
Ada_2020 to Ada 2020 in comments and mention -gnat2020 instead
of -gnatX switch.

4 years agod: Merge upstream dmd 6d5bffa54
Iain Buclaw [Fri, 5 Jun 2020 09:37:47 +0000 (11:37 +0200)]
d: Merge upstream dmd 6d5bffa54

Removes an unused parameter from Condition::include(), all callers have
been updated in the front-end.

Reviewed-on: https://github.com/dlang/dmd/pull/11229

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 6d5bffa54.
* d-builtins.cc (maybe_set_builtin_1): Update call to
Condition::include().
* decl.cc (DeclVisitor::visit(AttribDeclaration *)): Likewise.
* types.cc (layout_aggregate_members): Likewise.

4 years agotree-optimization/95539 - fix SLP_TREE_REPRESENTATIVE vs. dr_info
Richard Biener [Fri, 5 Jun 2020 08:13:27 +0000 (10:13 +0200)]
tree-optimization/95539 - fix SLP_TREE_REPRESENTATIVE vs. dr_info

This fixes a disconnect between the stmt_info used for dr_info
analysis and the one in SLP_TREE_REPRESENTATIVE with a temporary
workaround.

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

PR tree-optimization/95539
* tree-vect-data-refs.c
(vect_slp_analyze_and_verify_instance_alignment): Use
SLP_TREE_REPRESENTATIVE for the data-ref check.
* tree-vect-stmts.c (vectorizable_load): Reset stmt_info
back to the first scalar stmt rather than the
SLP_TREE_REPRESENTATIVE to match previous behavior.

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

4 years agoexpand: Simplify removing subregs when expanding a copy [PR95254]
Fei Yang [Fri, 5 Jun 2020 09:34:59 +0000 (10:34 +0100)]
expand: Simplify removing subregs when expanding a copy [PR95254]

In rtl expand, if we have a copy that matches one of the following patterns:
  (set (subreg:M1 (reg:M2 ...)) (subreg:M1 (reg:M2 ...)))
  (set (subreg:M1 (reg:M2 ...)) (mem:M1 ADDR))
  (set (mem:M1 ADDR) (subreg:M1 (reg:M2 ...)))
  (set (subreg:M1 (reg:M2 ...)) (constant C))
where mode M1 is equal in size to M2, try to detect whether the mode change
involves an implicit round trip through memory.  If so, see if we can avoid
that by removing the subregs and doing the move in mode M2 instead.

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

gcc/
PR target/95254
* expr.c (emit_move_insn): Check src and dest of the copy to see
if one or both of them are subregs, try to remove the subregs when
innermode and outermode are equal in size and the mode change involves
an implicit round trip through memory.

gcc/testsuite/
PR target/95254
* gcc.target/aarch64/pr95254.c: New test.
* gcc.target/i386/pr67609.c: Check "movq\t%xmm0" instead of "movdqa".

4 years agoix86: Improve __builtin_c[lt]z followed by extension [PR95535]
Jakub Jelinek [Fri, 5 Jun 2020 08:44:23 +0000 (10:44 +0200)]
ix86: Improve __builtin_c[lt]z followed by extension [PR95535]

In January I've added patterns to optimize SImode -> DImode sign or zero
extension of __builtin_popcount, this patch does the same for
__builtin_c[lt]z.  Like most other instructions, the [tl]zcntl instructions
clear the upper 32 bits of the destination register and as the instructions
only result in values 0 to 32 inclusive, both sign and zero extensions
behave the same.

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

PR target/95535
* config/i386/i386.md (*ctzsi2_zext, *clzsi2_lzcnt_zext): New
define_insn_and_split patterns.
(*ctzsi2_zext_falsedep, *clzsi2_lzcnt_zext_falsedep): New
define_insn patterns.

* gcc.target/i386/pr95535-1.c: New test.
* gcc.target/i386/pr95535-2.c: New test.

4 years agoAdd new/delete to struct occurence
Jonathan Wakely [Fri, 22 May 2020 06:22:50 +0000 (07:22 +0100)]
Add new/delete to struct occurence

This adds an example how to use new/delete operators to pool
allocated objects.

2020-06-04  Jonathan Wakely  <jwakely@redhat.com>

* alloc-pool.h (object_allocator::remove_raw): New.
* tree-ssa-math-opts.c (struct occurrence): Use NSMDI.
(occurrence::occurrence): Add.
(occurrence::~occurrence): Likewise.
(occurrence::new): Likewise.
(occurrence::delete): Likewise.
(occ_new): Remove.
(insert_bb): Use new occurence (...) instead of occ_new.
(register_division_in): Likewise.
(free_bb): Use delete occ instead of manually removing
from the pool.

4 years agomiddle-end/95493 - bogus MEM_ATTRS for variable array access
Richard Biener [Thu, 4 Jun 2020 11:44:58 +0000 (13:44 +0200)]
middle-end/95493 - bogus MEM_ATTRS for variable array access

The following patch avoids keeping the inherited MEM_ATTRS when
set_mem_attributes_minus_bitpos is called with a variable ARRAY_REF.
The inherited ones may not reflect the correct offset and neither
does the updated alias-set match the inherited MEM_EXPR.  This all
ends up confusing path-based alias-analysis, causing wrong-code.

The fix is to stop not adopting a MEM_EXPR for certain kinds of
expressions and instead handle everything we can.  There's still
the constant kind trees case which I'm too lazy to look into right
now.  I did refrain from adding SSA_NAME there and instead avoided
calling set_mem_attributes_minus_bitpos when debug expression
expansion ended up expanding a SSA definition RHS which should
already have taken care of setting the appropriate MEM_ATTRS.

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

PR middle-end/95493
* cfgexpand.c (expand_debug_expr): Avoid calling
set_mem_attributes_minus_bitpos when we were expanding
an SSA name.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Remove
ARRAY_REF special-casing, add CONSTRUCTOR to the set of
special-cases we do not want MEM_EXPRs for.  Assert
we end up with reasonable MEM_EXPRs.

* g++.dg/torture/pr95493.C: New testcase.

4 years agoFix bitmask conflict between PTA_AVX512VP2INTERSECT and PTA_WAITPKG in gcc/config...
Cui,Lili [Thu, 4 Jun 2020 07:01:43 +0000 (15:01 +0800)]
Fix bitmask conflict between PTA_AVX512VP2INTERSECT and PTA_WAITPKG in gcc/config/i386/i386.h

2020-06-05  Lili Cui  <lili.cui@intel.com>

gcc/ChangeLog:
PR target/95525
* config/i386/i386.h (PTA_WAITPKG): Change bitmask value.

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

4 years agolibstdc++: Remove workarounds for constrained nested class templates
Jonathan Wakely [Thu, 4 Jun 2020 22:20:49 +0000 (23:20 +0100)]
libstdc++: Remove workarounds for constrained nested class templates

With PR c++/92078 and PR c++/92103 both fixed, nested class templates
can now be constrained. That means a number of namespace-scope helpers
can be moved to the class scope, so they're only visible where they're
needed.

* include/bits/iterator_concepts.h (__detail::__ptr, __detail::__ref)
(__detail::__cat, __detail::__diff): Move to class scope in the
relevant __iterator_traits specializations.
(__iterator_traits<>): Use nested class templates instead of ones from
namespace __detail.
* include/bits/stl_iterator.h (__detail::__common_iter_ptr): Move to
class scope in iterator_traits<common_iterator<I, S>>.
(iterator_traits<common_iterator<I, S>>): Use nested class template
instead of __detail::__common_iter_ptr.

4 years agoImplement a solution for PR middle-end/10138 and PR middle-end/95136.
Martin Sebor [Thu, 4 Jun 2020 22:06:10 +0000 (16:06 -0600)]
Implement a solution for PR middle-end/10138 and PR middle-end/95136.

PR middle-end/10138 - warn for uninitialized arrays passed as const arguments
PR middle-end/95136 - missing -Wuninitialized on an array access with a variable offset

gcc/c-family/ChangeLog:

PR middle-end/10138
PR middle-end/95136
* c-attribs.c (append_access_attrs): Handle attr_access::none.
(handle_access_attribute): Same.

gcc/ChangeLog:

PR middle-end/10138
PR middle-end/95136
* attribs.c (init_attr_rdwr_indices): Move function here.
* attribs.h (rdwr_access_hash, rdwr_map): Define.
(attr_access): Add 'none'.
(init_attr_rdwr_indices): Declared function.
* builtins.c (warn_for_access)): New function.
(check_access): Call it.
* builtins.h (checK-access): Add an optional argument.
* calls.c (rdwr_access_hash, rdwr_map): Move to attribs.h.
(init_attr_rdwr_indices): Declare extern.
(append_attrname): Handle attr_access::none.
(maybe_warn_rdwr_sizes): Same.
(initialize_argument_information): Update comments.
* doc/extend.texi (attribute access): Document 'none'.
* tree-ssa-uninit.c (struct wlimits): New.
(maybe_warn_operand): New function.
(maybe_warn_pass_by_reference): Same.
(warn_uninitialized_vars): Refactor code into maybe_warn_operand.
Also call for function calls.
(pass_late_warn_uninitialized::execute): Adjust comments.
(execute_early_warn_uninitialized): Same.

gcc/testsuite/ChangeLog:

PR middle-end/10138
PR middle-end/95136
* c-c++-common/Wsizeof-pointer-memaccess1.c: Prune out valid
Wuninitialized.
* c-c++-common/uninit-pr51010.c: Adjust expected warning format.
* c-c++-common/goacc/uninit-dim-clause.c: Same.
* c-c++-common/goacc/uninit-firstprivate-clause.c: Same.
* c-c++-common/goacc/uninit-if-clause.c: Same.
* c-c++-common/gomp/pr70550-1.c: Same.
* c-c++-common/gomp/pr70550-2.c: Adjust.
* g++.dg/20090107-1.C: Same.
* g++.dg/20090121-1.C: Same.
* g++.dg/ext/attr-access.C: Avoid -Wuninitialized.
* gcc.dg/tree-ssa/forwprop-6.c: Prune out -Wuninitialized.
* gcc.dg/Warray-bounds-52.c: Prune out valid -Wuninitialized.
* gcc.dg/Warray-bounds-53.c: Same.
* gcc.dg/Warray-bounds-54.c: Same.
* gcc.dg/Wstringop-overflow-33.c: New test.
* gcc.dg/attr-access-none.c: New test.
* gcc.dg/attr-access-read-only.c: Adjust.
* gcc.dg/attr-access-read-write.c: Same.
* gcc.dg/attr-access-write-only.c: Same.
* gcc.dg/pr71581.c: Adjust text of expected warning.
* gcc.dg/uninit-15.c: Same.
* gcc.dg/uninit-32.c: New test.
* gcc.dg/uninit-33.c: New test.
* gcc.dg/uninit-34.c: New test.
* gcc.dg/uninit-36.c: New test.
* gcc.dg/uninit-B-O0.c: Adjust text of expected warning.
* gcc.dg/uninit-I-O0.c: Same.
* gcc.dg/uninit-pr19430-O0.c: Same.
* gcc.dg/uninit-pr19430.c: Same.
* gcc.dg/uninit-pr95136.c: New test.
* gfortran.dg/assignment_4.f90: Expect -Wuninitialized.
* gfortran.dg/goacc/uninit-dim-clause.f95: Adjust text of expected
warning.
* gfortran.dg/goacc/uninit-firstprivate-clause.f95
* gfortran.dg/goacc/uninit-if-clause.f95
* gfortran.dg/pr66545_2.f90

4 years agod: Merge upstream dmd 48d704f08
Iain Buclaw [Thu, 4 Jun 2020 20:36:26 +0000 (22:36 +0200)]
d: Merge upstream dmd 48d704f08

Updates the Array interface in dmd/root/array.h to use a DArray<TYPE>
internally.  Splits out BitArray into a separate header.

Reviewed-on: https://github.com/dlang/dmd/pull/11219

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 48d704f08.
* d-attribs.cc (build_attributes): Use new field name.
* d-builtins.cc (build_frontend_type): Likewise.
(maybe_set_builtin_1): Likewise.
(d_maybe_set_builtin): Likewise.
* d-codegen.cc (build_interface_binfo): Likewise.
(identity_compare_p): Likewise.
(lower_struct_comparison): Likewise.
(build_struct_comparison): Likewise.
(d_build_call): Likewise.
(build_frame_type): Likewise.
(build_closure): Likewise.
* d-compiler.cc (Compiler::paintAsType): Likewise.
(Compiler::loadModule): Likewise.
* d-incpath.cc (add_globalpaths): Likewise.
(add_filepaths): Likewise.
(add_import_paths): Likewise.
* d-lang.cc (deps_write): Likewise.
(d_parse_file): Likewise.
* decl.cc (gcc_attribute_p): Likewise.
(base_vtable_offset): Likewise.
(get_vtable_decl): Likewise.
(build_class_instance): Likewise.
* expr.cc (class ExprVisitor): Likewise.
* modules.cc (layout_moduleinfo_fields): Likewise.
(layout_moduleinfo): Likewise.
(build_module_tree): Likewise.
* toir.cc (class IRVisitor): Likewise.
* typeinfo.cc (class TypeInfoVisitor): Likewise.
(layout_classinfo_interfaces): Likewise.
* types.cc (layout_aggregate_members): Likewise.
(layout_aggregate_type): Likewise.

4 years agolibstdc++: Specialize copy/copy_n for istreambuf_iterator and deque iterators
François Dumont [Wed, 22 Jan 2020 17:21:28 +0000 (18:21 +0100)]
libstdc++: Specialize copy/copy_n for istreambuf_iterator and deque iterators

Add __copy_n_a overloads for std::deque iterators to replace with C memmove
when possible. Expose std::copy_n implementation details in pre-C++11 modes
and use it for std::copy overloads.

libstdc++-v3/ChangeLog

* include/bits/stl_algo.h (__copy_n_a): Move to ...
* include/bits/stl_algobase.h (__copy_n_a): ...here. Add __strict
parameter.
(__copy_n_a(istreambuf_iterator<>, _Size, _Deque_iterator<>, bool)):
Declare.
(__niter_base(const _Safe_iterator<_Ite, _Seq,
random_access_iterator_tag>&)): Declare.
(__copy_move_a2(istreambuf_iterator<>, istreambuf_iterator<>,
_Deque_iterator<>)): Declare.
* include/bits/deque.tcc
(__copy_move_a2(istreambuf_iterator<>, istreambuf_iterator<>,
_Deque_iterator<>)): New.
(__copy_n_a(istreambuf_iterator<>, _Size, _Deque_iterator<>, bool)):
New.
* include/bits/streambuf_iterator.h
(__copy_n_a(istreambuf_iterator<>, _Size, _CharT*, bool)): Adapt.
* include/debug/safe_iterator.tcc (__niter_base): New.
* testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc
(test03): New.
* testsuite/25_algorithms/copy/streambuf_iterators/char/debug/deque_neg.cc:
New test.
* testsuite/25_algorithms/copy_n/debug/istreambuf_ite_deque_neg.cc:
New test.
* testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc: New test.
* testsuite/25_algorithms/copy_n/istreambuf_iterator/deque.cc:
New test.

4 years agod: Merge upstream dmd 47ed0330f
Iain Buclaw [Thu, 4 Jun 2020 20:05:49 +0000 (22:05 +0200)]
d: Merge upstream dmd 47ed0330f

Updates the copyright years of the front-end sources.

Reviewed-on: https://github.com/dlang/dmd/pull/11221

gcc/d/ChangeLog:

* dmd/MERGE: Merge upstream dmd 47ed0330f.

4 years agoc++: Fix complex constexpr virtual cases [PR93310].
Jason Merrill [Thu, 4 Jun 2020 03:50:50 +0000 (23:50 -0400)]
c++: Fix complex constexpr virtual cases [PR93310].

The code in constexpr for looking up the actual type of the object and then
getting the virtual function from there broke for both of these tests: for
16, it assumed incorrectly that the DECL_VINDEX would apply to the most
derived type's vtable; for 17, it failed to consider that during
construction the base subobject is treated as being of the base type.

Fixed by just doing constant evaluation of the expression that looks up the
function in the vtable.  This means that a virtual call will involve loading
the vptr, so we will reject some calls through non-constexpr variables that
we previously accepted, but this seems appropriate to me.  None of our
testcases were affected.

gcc/cp/ChangeLog:

PR c++/93310
* constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
Evaluate OBJ_TYPE_REF_EXPR.

gcc/testsuite/ChangeLog:

PR c++/93310
* g++.dg/cpp2a/constexpr-virtual16.C: New test.
* g++.dg/cpp2a/constexpr-virtual17.C: New test.
* g++.dg/cpp2a/constexpr-new12.C: Adjust diagnostic.

4 years agoc++: Fix FE devirt with diamond inheritance [PR95158]
Jason Merrill [Thu, 4 Jun 2020 03:50:06 +0000 (23:50 -0400)]
c++: Fix FE devirt with diamond inheritance [PR95158]

This started breaking in GCC 8 because of the fix for PR15272; after that
change, we (correctly) remember the lookup from template parsing time that
found Base::foo through the non-dependent MiddleB base, and so we overlook
the overrider in MiddleA.  But given that, the devirtualization condition
from the fix for PR59031 is insufficient; we know that d has to be a
Derived, and we found Base::foo in Base, but forcing a non-virtual call
gets the wrong function.

Fixed by removing the PR59031 code that the PR67184 patch moved to
build_over_call, and instead looking up the overrider in BINFO_VIRTUALS.

gcc/cp/ChangeLog:

PR c++/95158
* class.c (lookup_vfn_in_binfo): New.
* call.c (build_over_call): Use it.
* cp-tree.h (resolves_to_fixed_type_p): Add default argument.
(lookup_vfn_in_binfo): Declare.

gcc/testsuite/ChangeLog:

PR c++/95158
* g++.dg/template/virtual5.C: New test.

4 years agoPR fortran/95500 - Segfault compiling extra interface on intrinsic
Harald Anlauf [Thu, 4 Jun 2020 19:00:33 +0000 (21:00 +0200)]
PR fortran/95500 - Segfault compiling extra interface on intrinsic

Converting an expression so that it can be passed by reference could
result in a NULL pointer dereference.

2020-06-04  Steven G. Kargl  <kargl@gcc.gnu.org>
    Harald Anlauf  <anlauf@gmx.de>

gcc/fortran/
PR fortran/95500
* trans-expr.c (gfc_conv_expr_reference): Do not dereference NULL
pointer.

gcc/testsuite/
PR fortran/95500
* gfortran.dg/pr95500.f90: New test.

4 years agocoroutines: Fix missed ramp function return copy elision [PR95346].
Iain Sandoe [Thu, 4 Jun 2020 16:14:37 +0000 (17:14 +0100)]
coroutines: Fix missed ramp function return copy elision [PR95346].

Confusingly, "get_return_object ()" can do two things:
- Firstly it can provide the return object for the ramp function (as
  the name suggests).
- Secondly if the type of the ramp function is different from that
  of the get_return_object call, this is used as a single parameter
  to a CTOR for the ramp's return type.

In the first case we can rely on finish_return_stmt () to do the
necessary processing for copy elision.
In the second case, we should have passed a prvalue to the CTOR as
per the standard comment, but I had omitted the rvalue () call.  Fixed
thus.

gcc/cp/ChangeLog:

PR c++/95346
* coroutines.cc (morph_fn_to_coro): Ensure that the get-
return-object is constructed correctly; When it is not the
final return value, pass it to the CTOR of the return type
as an rvalue, per the standard comment.

gcc/testsuite/ChangeLog:

PR c++/95346
* g++.dg/coroutines/pr95346.C: New test.

4 years agoAdd test for PR95464.c.
Vladimir N. Makarov [Thu, 4 Jun 2020 17:32:24 +0000 (13:32 -0400)]
Add test for PR95464.c.

2020-06-04  Vladimir Makarov  <vmakarov@redhat.com>

PR middle-end/95464
* gcc.target/i386/pr95464.c: New.

4 years ago[OpenACC 'exit data'] Evaluate 'copyfrom' individually for 'GOMP_MAP_STRUCT' entries
Thomas Schwinge [Thu, 4 Jun 2020 14:13:35 +0000 (16:13 +0200)]
[OpenACC 'exit data'] Evaluate 'copyfrom' individually for 'GOMP_MAP_STRUCT' entries

Currently, we don't at all evaluate 'copyfrom' for 'GOMP_MAP_STRUCT' entries.
Fix this by copying/adapting the corresponding non-'GOMP_MAP_STRUCT' code.

libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>:
Evaluate 'copyfrom' individually for each entry.
* testsuite/libgomp.oacc-c-c++-common/struct-1.c: Update.

4 years ago[OpenACC 'exit data'] Evaluate 'finalize' individually for 'GOMP_MAP_STRUCT' entries
Thomas Schwinge [Thu, 4 Jun 2020 14:01:07 +0000 (16:01 +0200)]
[OpenACC 'exit data'] Evaluate 'finalize' individually for 'GOMP_MAP_STRUCT' entries

Currently, we don't at all evaluate 'finalize' for 'GOMP_MAP_STRUCT' entries.
Fix this by copying/adapting the corresponding non-'GOMP_MAP_STRUCT' code.

libgomp/
* oacc-mem.c (goacc_exit_data_internal) <GOMP_MAP_STRUCT>:
Evaluate 'finalize' individually for each entry.
* testsuite/libgomp.oacc-c-c++-common/struct-1.c: New file.
* testsuite/libgomp.oacc-c-c++-common/struct-refcount-1.c: Remove
file.

4 years agoFix 'sizeof' usage in 'libgomp.oacc-c-c++-common/deep-copy-{7,8}.c'
Thomas Schwinge [Tue, 19 May 2020 20:35:15 +0000 (22:35 +0200)]
Fix 'sizeof' usage in 'libgomp.oacc-c-c++-common/deep-copy-{7,8}.c'

libgomp/
* testsuite/libgomp.oacc-c-c++-common/deep-copy-7.c: Fix 'sizeof'
usage.
* testsuite/libgomp.oacc-c-c++-common/deep-copy-8.c: Likewise.

4 years ago[OpenACC] Repair/restore 'is_tgt_unmapped' checking
Thomas Schwinge [Fri, 29 May 2020 13:22:42 +0000 (15:22 +0200)]
[OpenACC] Repair/restore 'is_tgt_unmapped' checking

libgomp/
* oacc-mem.c (goacc_exit_datum): Repair 'is_tgt_unmapped'
checking.
(acc_unmap_data, goacc_exit_data_internal): Restore
'is_tgt_unmapped' checking.
* testsuite/libgomp.oacc-c-c++-common/struct-refcount-1.c: New
file.
* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: Adjust.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90: Likewise.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
4 years ago[OpenACC] Don't open-code 'gomp_remove_var' in 'acc_unmap_data'
Thomas Schwinge [Fri, 29 May 2020 12:21:03 +0000 (14:21 +0200)]
[OpenACC] Don't open-code 'gomp_remove_var' in 'acc_unmap_data'

libgomp/
* oacc-mem.c (acc_unmap_data): Don't open-code 'gomp_remove_var'.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
4 years ago[OpenACC] Remove 'tgt' reference counting from 'acc_unmap_data' [PR92854]
Thomas Schwinge [Fri, 29 May 2020 12:12:16 +0000 (14:12 +0200)]
[OpenACC] Remove 'tgt' reference counting from 'acc_unmap_data' [PR92854]

libgomp/
PR libgomp/92854
* oacc-mem.c (acc_unmap_data): Remove 'tgt' reference counting.

4 years agoExtend 'libgomp.oacc-c-c++-common/pr92854-1.c' some more [PR92854]
Thomas Schwinge [Fri, 29 May 2020 12:11:27 +0000 (14:11 +0200)]
Extend 'libgomp.oacc-c-c++-common/pr92854-1.c' some more [PR92854]

libgomp/
PR libgomp/92854
* testsuite/libgomp.oacc-c-c++-common/pr92854-1.c: Extend some
more.

4 years ago[OpenACC] Use 'tgt' returned from 'gomp_map_vars'
Thomas Schwinge [Thu, 14 May 2020 13:49:52 +0000 (15:49 +0200)]
[OpenACC] Use 'tgt' returned from 'gomp_map_vars'

libgomp/
* oacc-mem.c (goacc_enter_datum): Use 'tgt' returned from
'gomp_map_vars'.
 (acc_map_data): Clean up accordingly.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
4 years ago[OpenACC] XFAIL behavior of over-eager 'finalize' clause
Thomas Schwinge [Fri, 29 May 2020 19:36:27 +0000 (21:36 +0200)]
[OpenACC] XFAIL behavior of over-eager 'finalize' clause

libgomp/
* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: XFAIL behavior
of over-eager 'finalize' clause.
* testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90: New
file.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-2.F90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-2-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-3-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/mdc-refcount-1-4-2.f90: Likewise.

4 years ago[OpenACC] Missing unlocking on error paths in attach/detach code, part II
Thomas Schwinge [Sat, 23 May 2020 15:20:30 +0000 (17:20 +0200)]
[OpenACC] Missing unlocking on error paths in attach/detach code, part II

libgomp/
* oacc-mem.c (goacc_exit_data_internal): Unlock on error path.

4 years ago[OpenACC] Missing unlocking on error paths in attach/detach code
Julian Brown [Fri, 22 May 2020 22:16:04 +0000 (15:16 -0700)]
[OpenACC] Missing unlocking on error paths in attach/detach code

libgomp/
* oacc-mem.c (acc_attach_async): Add missing gomp_mutex_unlock on
error path.
(goacc_detach_internal): Likewise.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
4 years ago'libgomp.oacc-fortran/{error_,}stop-{1,2,3}.f': initialize before the checkpoint
Thomas Schwinge [Wed, 6 May 2020 08:05:49 +0000 (10:05 +0200)]
'libgomp.oacc-fortran/{error_,}stop-{1,2,3}.f': initialize before the checkpoint

If, for example, GCC is configured such that 'libgomp-plugin-nvptx.so.1'
dynamically links against 'libcuda.so.1', but testing is run on a system where
there is no 'libcuda.so.1', this produces output such as:

    PASS: libgomp.oacc-fortran/error_stop-1.f -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable  -O0  (test for excess errors)
    PASS: libgomp.oacc-fortran/error_stop-1.f -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable  -O0  execution test
    FAIL: libgomp.oacc-fortran/error_stop-1.f -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -foffload=disable  -O0  output pattern test, is  CheCKpOInT

    libgomp: while loading libgomp-plugin-nvptx.so.1: libcuda.so.1: cannot open shared object file: No such file or directory
    ERROR STOP

    Error termination. Backtrace: [...]
    , should match CheCKpOInT(
    |
    |^M)+ERROR STOP (
    |
    |^M)+Error termination.*

..., where after 'CheCKpOInT' we got 'libgomp: while loading [...]' injected
before the expected 'ERROR STOP'.

libgomp/
* testsuite/libgomp.oacc-fortran/error_stop-1.f: Initialize before
the checkpoint.
* testsuite/libgomp.oacc-fortran/error_stop-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/error_stop-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/stop-3.f: Likewise.

4 years agod: Split up d-frontend.cc into multiple parts.
Iain Buclaw [Tue, 2 Jun 2020 14:29:26 +0000 (16:29 +0200)]
d: Split up d-frontend.cc into multiple parts.

gcc/d/ChangeLog:

* Make-lang.in (D_OBJS): Add d-compiler.o, d-ctfloat.o, d-port.o.
* d-frontend.cc (Port::memicmp): Move to d-port.cc.
(Port::strupr): Likewise.
(Port::isFloat32LiteralOutOfRange): Likewise.
(Port::isFloat64LiteralOutOfRange): Likewise.
(Port::readwordLE): Likewise.
(Port::readwordBE): Likewise.
(Port::readlongLE): Likewise.
(Port::readlongBE): Likewise.
(Port::valcpy): Likewise.
(CTFloat::fabs): Move to d-ctfloat.cc.
(CTFloat::ldexp): Likewise.
(CTFloat::isIdentical): Likewise.
(CTFloat::isNaN): Likewise.
(CTFloat::isSNaN): Likewise.
(CTFloat::isInfinity): Likewise.
(CTFloat::parse): Likewise.
(CTFloat::sprint): Likewise.
(CTFloat::hash): Likewise.
(Compiler::genCmain): Move to d-compiler.cc.
(Compiler::paintAsType): Likewise.
(Compiler::loadModule): Likewise.
* d-compiler.cc: New file.
* d-ctfloat.cc: New file.
* d-port.cc: New file.

4 years agoAdd processing STRICT_LOW_PART for matched reloads.
Vladimir N. Makarov [Thu, 4 Jun 2020 16:04:48 +0000 (12:04 -0400)]
Add processing STRICT_LOW_PART for matched reloads.

2020-06-04  Vladimir Makarov  <vmakarov@redhat.com>

PR middle-end/95464
* lra.c (lra_emit_move): Add processing STRICT_LOW_PART.
* lra-constraints.c (match_reload): Use STRICT_LOW_PART in output
reload if the original insn has it too.

4 years agoaarch64: PR target/95526: Fix gimplification of varargs
Richard Biener [Thu, 4 Jun 2020 15:26:36 +0000 (16:26 +0100)]
aarch64: PR target/95526: Fix gimplification of varargs

This patch fixes a latent bug exposed by
eb72dc663e9070b281be83a80f6f838a3a878822 in the aarch64 backend that was
causing wrong codegen and several testsuite failures. See the discussion
on the bug for details.

Bootstrapped and regtested on aarch64-linux-gnu. Cleaned up several
failing tests and no new fails introduced.

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

gcc/:

* config/aarch64/aarch64.c (aarch64_gimplify_va_arg_expr):
Ensure that tmp_ha is marked TREE_ADDRESSABLE.

4 years agoipa-sra: Do not remove statements necessary because of non-call EH (PR 95113)
Martin Jambor [Thu, 4 Jun 2020 15:03:27 +0000 (17:03 +0200)]
ipa-sra: Do not remove statements necessary because of non-call EH (PR 95113)

PR 95113 revealed that when reasoning about which parameters are dead,
IPA-SRA does not perform the same check related to non-call exceptions
as tree DCE.  It most certainly should and so this patch moves the
condition used in tree-ssa-dce.c into a separate predicate (in
tree-eh.c) and uses it from both places.

gcc/ChangeLog:

2020-05-27  Martin Jambor  <mjambor@suse.cz>

PR ipa/95113
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Move non-call
exceptions check to...
* tree-eh.c (stmt_unremovable_because_of_non_call_eh_p): ...this
new function.
* tree-eh.h (stmt_unremovable_because_of_non_call_eh_p): Declare it.
* ipa-sra.c (isra_track_scalar_value_uses): Use it.  New parameter
fun.

gcc/testsuite/ChangeLog:

2020-05-27  Martin Jambor  <mjambor@suse.cz>

PR ipa/95113
* gcc.dg/ipa/pr95113.c: New test.

4 years ago[ARM]: Correct the grouping of operands in MVE vector scatter store intrinsics (PR94735).
Srinath Parvathaneni [Thu, 4 Jun 2020 14:41:29 +0000 (15:41 +0100)]
[ARM]: Correct the grouping of operands in MVE vector scatter store intrinsics (PR94735).

The operands in RTL patterns of MVE vector scatter store intrinsics are wrongly grouped,
because of which few vector loads and stores instructions are wrongly getting optimized
out with -O2.

A new predicate "mve_scatter_memory" is defined in this patch, this predicate returns TRUE on
matching: (mem(reg)) for MVE scatter store intrinsics.
This patch fixes the issue by adding define_expand pattern with "mve_scatter_memory" predicate
and calls the corresponding define_insn by passing register_operand as first argument.
This register_operand is extracted from the operand with "mve_scatter_memory" predicate in
define_expand pattern.

gcc/ChangeLog:

2020-06-01  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/94735
* config/arm/predicates.md (mve_scatter_memory): Define to
match (mem (reg)) for scatter store memory.
* config/arm/mve.md (mve_vstrbq_scatter_offset_<supf><mode>): Modify
define_insn to define_expand.
(mve_vstrbq_scatter_offset_p_<supf><mode>): Likewise.
(mve_vstrhq_scatter_offset_<supf><mode>): Likewise.
(mve_vstrhq_scatter_shifted_offset_p_<supf><mode>): Likewise.
(mve_vstrhq_scatter_shifted_offset_<supf><mode>): Likewise.
(mve_vstrdq_scatter_offset_p_<supf>v2di): Likewise.
(mve_vstrdq_scatter_offset_<supf>v2di): Likewise.
(mve_vstrdq_scatter_shifted_offset_p_<supf>v2di): Likewise.
(mve_vstrdq_scatter_shifted_offset_<supf>v2di): Likewise.
(mve_vstrhq_scatter_offset_fv8hf): Likewise.
(mve_vstrhq_scatter_offset_p_fv8hf): Likewise.
(mve_vstrhq_scatter_shifted_offset_fv8hf): Likewise.
(mve_vstrhq_scatter_shifted_offset_p_fv8hf): Likewise.
(mve_vstrwq_scatter_offset_fv4sf): Likewise.
(mve_vstrwq_scatter_offset_p_fv4sf): Likewise.
(mve_vstrwq_scatter_offset_p_<supf>v4si): Likewise.
(mve_vstrwq_scatter_offset_<supf>v4si): Likewise.
(mve_vstrwq_scatter_shifted_offset_fv4sf): Likewise.
(mve_vstrwq_scatter_shifted_offset_p_fv4sf): Likewise.
(mve_vstrwq_scatter_shifted_offset_p_<supf>v4si): Likewise.
(mve_vstrwq_scatter_shifted_offset_<supf>v4si): Likewise.
(mve_vstrbq_scatter_offset_<supf><mode>_insn): Define insn for scatter
stores.
(mve_vstrbq_scatter_offset_p_<supf><mode>_insn): Likewise.
(mve_vstrhq_scatter_offset_<supf><mode>_insn): Likewise.
(mve_vstrhq_scatter_shifted_offset_p_<supf><mode>_insn): Likewise.
(mve_vstrhq_scatter_shifted_offset_<supf><mode>_insn): Likewise.
(mve_vstrdq_scatter_offset_p_<supf>v2di_insn): Likewise.
(mve_vstrdq_scatter_offset_<supf>v2di_insn): Likewise.
(mve_vstrdq_scatter_shifted_offset_p_<supf>v2di_insn): Likewise.
(mve_vstrdq_scatter_shifted_offset_<supf>v2di_insn): Likewise.
(mve_vstrhq_scatter_offset_fv8hf_insn): Likewise.
(mve_vstrhq_scatter_offset_p_fv8hf_insn): Likewise.
(mve_vstrhq_scatter_shifted_offset_fv8hf_insn): Likewise.
(mve_vstrhq_scatter_shifted_offset_p_fv8hf_insn): Likewise.
(mve_vstrwq_scatter_offset_fv4sf_insn): Likewise.
(mve_vstrwq_scatter_offset_p_fv4sf_insn): Likewise.
(mve_vstrwq_scatter_offset_p_<supf>v4si_insn): Likewise.
(mve_vstrwq_scatter_offset_<supf>v4si_insn): Likewise.
(mve_vstrwq_scatter_shifted_offset_fv4sf_insn): Likewise.
(mve_vstrwq_scatter_shifted_offset_p_fv4sf_insn): Likewise.
(mve_vstrwq_scatter_shifted_offset_p_<supf>v4si_insn): Likewise.
(mve_vstrwq_scatter_shifted_offset_<supf>v4si_insn): Likewise.

gcc/testsuite/ChangeLog:

2020-06-01  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

PR target/94735
* gcc.target/arm/mve/intrinsics/mve_vstore_scatter_base.c: New test.
* gcc.target/arm/mve/intrinsics/mve_vstore_scatter_base_p.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_vstore_scatter_offset.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_vstore_scatter_offset_p.c: Likewise.
* gcc.target/arm/mve/intrinsics/mve_vstore_scatter_shifted_offset.c:
Likewise.
* gcc.target/arm/mve/intrinsics/mve_vstore_scatter_shifted_offset_p.c:
Likewise.

4 years ago[PATCH][GCC] arm: Fix the MVE ACLE vbicq intrinsics.
Srinath Parvathaneni [Thu, 4 Jun 2020 14:29:18 +0000 (15:29 +0100)]
[PATCH][GCC] arm: Fix the MVE ACLE vbicq intrinsics.

Following MVE intrinsic testcases are failing in GCC testsuite.

Directory: gcc.target/arm/mve/intrinsics/
Testcases: vbicq_f16.c, vbicq_f32.c, vbicq_s16.c, vbicq_s32.c, vbicq_s8.c
,vbicq_u16.c, vbicq_u32.c and vbicq_u8.c.

This patch fixes the vbicq intrinsics by modifying the intrinsic parameters
and polymorphic variants in "arm_mve.h" header file.

Thanks,
Srinath.

gcc/ChangeLog:

2020-05-20  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

* config/arm/arm_mve.h (__arm_vbicq_n_u16): Correct the intrinsic
arguments.
(__arm_vbicq_n_s16): Likewise.
(__arm_vbicq_n_u32): Likewise.
(__arm_vbicq_n_s32): Likewise.
(__arm_vbicq): Modify polymorphic variant.

gcc/testsuite/ChangeLog:

2020-05-20  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

* gcc.target/arm/mve/intrinsics/vbicq_f16.c: Modify.
* gcc.target/arm/mve/intrinsics/vbicq_f32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_n_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_n_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_n_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_n_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_s16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_s32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_s8.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_u16.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_u32.c: Likewise.
* gcc.target/arm/mve/intrinsics/vbicq_u8.c: Likewise.

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.