1. 13 Jul, 2020 20 commits
    • libgcc: fix the handling of return address mangling [PR94891] · c24e8063
      Mangling, currently only used on AArch64 for return address signing,
      is an internal representation that should not be exposed via
      
        __builtin_return_address return value,
        __builtin_eh_return handler argument,
        _Unwind_DebugHook handler argument.
      
      Note that a mangled address might not even fit into a void *, e.g.
      with AArch64 ilp32 ABI the return address is stored as 64bit, so
      the mangled return address cannot be accessed via _Unwind_GetPtr.
      
      This patch changes the unwinder hooks as follows:
      
      MD_POST_EXTRACT_ROOT_ADDR is removed: root address comes from
      __builtin_return_address which is not mangled.
      
      MD_POST_EXTRACT_FRAME_ADDR is renamed to MD_DEMANGLE_RETURN_ADDR,
      it now operates on _Unwind_Word instead of void *, so the hook
      should work when return address signing is enabled on AArch64 ilp32.
      (But for that __builtin_aarch64_autia1716 should be fixed to operate
      on 64bit input instead of a void *.)
      
      MD_POST_FROB_EH_HANDLER_ADDR is removed: it is the responsibility of
      __builtin_eh_return to do the mangling if necessary.
      
      2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>
      
      libgcc/ChangeLog:
      
      	PR target/94891
      	* config/aarch64/aarch64-unwind.h (MD_POST_EXTRACT_ROOT_ADDR): Remove.
      	(MD_POST_FROB_EH_HANDLER_ADDR): Remove.
      	(MD_POST_EXTRACT_FRAME_ADDR): Rename to ...
      	(MD_DEMANGLE_RETURN_ADDR): This.
      	(aarch64_post_extract_frame_addr): Rename to ...
      	(aarch64_demangle_return_addr): This.
      	(aarch64_post_frob_eh_handler_addr): Remove.
      	* unwind-dw2.c (uw_update_context): Demangle return address.
      	(uw_frob_return_addr): Remove.
      
      (cherry picked from commit b097c7a27fb0796b2653a1d003cbf6b7a69d8961)
      Szabolcs Nagy committed
    • aarch64: fix __builtin_eh_return with pac-ret [PR94891] · eb41624d
      Currently __builtin_eh_return takes a signed return address, which can
      cause ABI and API issues: 1) pointer representation problems if the
      address is passed around before eh return, 2) the source code needs
      pac-ret specific changes and needs to know if pac-ret is used in the
      current frame, 3) signed address may not be representible as void *
      (with ilp32 abi).
      
      Using address signing to protect eh return is ineffective because the
      instruction sequence in the unwinder that starts from the address
      signing and ends with a ret can be used as a return to anywhere gadget.
      Using indirect branch istead of ret with bti j landing pads at the
      target can reduce the potential of such gadget, which also implies
      that __builtin_eh_return should not take a signed address.
      
      This is a big hammer fix to the ABI and API issues: it turns pac-ret
      off for the caller completely (not just on the eh return path).  To
      harden the caller against ROP attacks, it should use indirect branch
      instead of ret, this is not attempted so the patch remains small and
      backportable.
      
      2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>
      
      gcc/ChangeLog:
      
      	PR target/94891
      	* config/aarch64/aarch64.c (aarch64_return_address_signing_enabled):
      	Disable return address signing if __builtin_eh_return is used.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/94891
      	* gcc.target/aarch64/return_address_sign_1.c: Update test.
      	* gcc.target/aarch64/return_address_sign_b_1.c: Likewise.
      
      (cherry picked from commit 2bc95be3bb8c8138e2e87c1c11c84bfede989d61)
      Szabolcs Nagy committed
    • aarch64: fix return address access with pac [PR94891][PR94791] · e14149f6
      This is a big hammer fix for __builtin_return_address (PR target/94891)
      returning signed addresses (sometimes, depending on wether lr happens
      to be signed or not at the time of call which depends on optimizations),
      and similarly -pg may pass signed return address to _mcount
      (PR target/94791).
      
      At the time of return address expansion we don't know if it's signed or
      not so it is done unconditionally.
      
      2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>
      
      gcc/ChangeLog:
      
      	PR target/94891
      	PR target/94791
      	* config/aarch64/aarch64-protos.h (aarch64_return_addr_rtx): Declare.
      	* config/aarch64/aarch64.c (aarch64_return_addr_rtx): New.
      	(aarch64_return_addr): Use aarch64_return_addr_rtx.
      	* config/aarch64/aarch64.h (PROFILE_HOOK): Likewise.
      
      (cherry picked from commit 463a54e5d4956143f81c1f23b91cbd2d93855741)
      Szabolcs Nagy committed
    • aarch64: Fix BTI support in libitm · 59a74e7e
      sjlj.S did not have the GNU property note markup and the BTI c
      instructions that are necessary when it is built with branch
      protection.
      
      The notes are only added when libitm is built with branch
      protection, because old linkers mishandle the note (merge
      them incorrectly or emit warnings), the BTI instructions
      are added unconditionally.
      
      2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>
      
      libitm/ChangeLog:
      
      	* config/aarch64/sjlj.S: Add BTI marking and related definitions,
      	and add BTI c to function entries.
      
      (cherry picked from commit 319078dad62eba942d33c8975bdcbb09d1c68ba6)
      Szabolcs Nagy committed
    • aarch64: Fix BTI support in libgcc [PR96001] · 8475641c
      lse.S did not have the GNU property note markup and the BTI c
      instructions that are necessary when it is built with branch
      protection.
      
      The notes are only added when libgcc is built with branch
      protection, because old linkers mishandle the note (merge
      them incorrectly or emit warnings), the BTI instructions
      are added unconditionally.
      
      Note: BTI c is only necessary at function entry if the function
      may be called indirectly, currently lse functions are not called
      indirectly, but BTI is added for ABI reasons e.g. to allow
      linkers later to emit stub code with indirect jump.
      
      2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>
      
      libgcc/ChangeLog:
      
      	PR target/96001
      	* config/aarch64/lse.S: Add BTI marking and related definitions,
      	and add BTI c to function entries.
      
      (cherry picked from commit f0f62fa0320762119446893c67cb52934bc5a05e)
      Szabolcs Nagy committed
    • aarch64: Fix noexecstack note in libgcc · 62e8c4b4
      lse.S did not have GNU stack note, this may cause missing
      PT_GNU_STACK in binaries on Linux and FreeBSD.
      
      2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>
      
      libgcc/ChangeLog:
      
      	* config/aarch64/lse.S: Add stack note.
      
      (cherry picked from commit e73ec755489afc9fcc75dfac6f06ac73e243e72a)
      Szabolcs Nagy committed
    • aarch64: Fix noexecstack note in libitm · f57bc8a6
      sjlj.S only had the note on Linux, but it is supposed
      to have it on FreeBSD too.
      
      2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>
      
      libitm/ChangeLog:
      
      	* config/aarch64/sjlj.S: Add stack note if __FreeBSD__ is defined.
      
      (cherry picked from commit 463ba375f7b857995068403a4c63690d03162c00)
      Szabolcs Nagy committed
    • aarch64: Add missing ACLE support for BTI · 4e8b45f2
      Define the __ARM_FEATURE_BTI_DEFAULT feature test
      macro when BTI branch protection is enabled.
      
      2020-07-09  Szabolcs Nagy  <szabolcs.nagy@arm.com>
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Add
      	__ARM_FEATURE_BTI_DEFAULT support.
      
      (cherry picked from commit 63b6808e69699ba576492efa29d92b626cc26eba)
      Szabolcs Nagy committed
    • openacc: Don't strip TO_PSET/POINTER for enter/exit data · fdf78749
      OpenACC 2.6 specifies that the array descriptor (when present) must be
      copied to the target before attaching pointers in Fortran. This patch
      reverses the stripping of GOMP_MAP_TO_PSET and GOMP_MAP_POINTER that
      was introduced by the "OpenACC reference count overhaul" patch.
      
      2020-07-10  Julian Brown  <julian@codesourcery.com>
      	    Thomas Schwinge  <thomas@codesourcery.com>
      
      gcc/
      	* gimplify.c (gimplify_scan_omp_clauses): Do not strip
      	GOMP_MAP_TO_PSET/GOMP_MAP_POINTER for OpenACC enter/exit data
      	directives (see also PR92929).
      
      gcc/testsuite/
      	* gfortran.dg/goacc/finalize-1.f: Update expected dump output.
      
      libgomp/
      	* testsuite/libgomp.oacc-fortran/dynamic-pointer-1.f90: New test.
      
      Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
      (cherry picked from commit b20097c65d2e74b1901fba1c55c77f0407e542d2)
      Julian Brown committed
    • openacc: Adjust dynamic reference count semantics · b8be66d1
      This patch adjusts how dynamic reference counts work so that they match
      the semantics of the source program more closely, instead of representing
      "excess" reference counts beyond those that represent pointers in the
      internal libgomp splay-tree data structure. This allows some corner
      cases to be handled more gracefully.
      
      2020-07-10  Julian Brown  <julian@codesourcery.com>
      	    Thomas Schwinge  <thomas@codesourcery.com>
      
      	libgomp/
      	* libgomp.h (struct splay_tree_key_s): Change virtual_refcount to
      	dynamic_refcount.
      	(struct gomp_device_descr): Remove GOMP_MAP_VARS_OPENACC_ENTER_DATA.
      	* oacc-mem.c (acc_map_data): Substitute virtual_refcount for
      	dynamic_refcount.
      	(acc_unmap_data): Update comment.
      	(goacc_map_var_existing, goacc_enter_datum): Adjust for
      	dynamic_refcount semantics.
      	(goacc_exit_datum_1, goacc_exit_datum): Re-add some error checking.
      	Adjust for dynamic_refcount semantics.
      	(goacc_enter_data_internal): Implement "present" case of dynamic
      	memory-map handling here.  Update "non-present" case for
      	dynamic_refcount semantics.
      	(goacc_exit_data_internal): Use goacc_exit_datum_1.
      	* target.c (gomp_map_vars_internal): Remove
      	GOMP_MAP_VARS_OPENACC_ENTER_DATA handling.  Update for dynamic_refcount
      	handling.
      	(gomp_unmap_vars_internal): Remove virtual_refcount handling.
      	(gomp_load_image_to_device): Substitute dynamic_refcount for
      	virtual_refcount.
      	* testsuite/libgomp.oacc-c-c++-common/pr92843-1.c: Remove XFAILs.
      	* testsuite/libgomp.oacc-c-c++-common/refcounting-1.c: New test.
      	* testsuite/libgomp.oacc-c-c++-common/refcounting-2.c: New test.
      	* testsuite/libgomp.oacc-c-c++-common/struct-3-1-1.c: New test.
      	* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: Remove XFAILs and
      	trace output.
      	* testsuite/libgomp.oacc-fortran/deep-copy-6-no_finalize.F90: Remove
      	trace output.
      	* testsuite/libgomp.oacc-fortran/dynamic-incr-structural-1.f90: New
      	test.
      	* testsuite/libgomp.oacc-c-c++-common/structured-dynamic-lifetimes-4.c:
      	Remove stale comment.
      	* testsuite/libgomp.oacc-fortran/mdc-refcount-1-1-1.f90: Remove XFAILs.
      	* 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-4-1.f90: Adjust XFAIL.
      
      Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
      (cherry picked from commit 6f5b4b64d25a36f085ab90efc3d54c025a7fff49)
      Julian Brown committed
    • openacc: Helper functions for enter/exit data using single mapping · bafecb52
      This patch factors out the parts of goacc_enter_datum and
      goacc_exit_datum that can be shared with goacc_enter_data_internal
      and goacc_exit_data_internal respectively (in the next patch),
      without overloading function return values or complicating code paths
      unnecessarily.
      
      2020-07-10  Julian Brown  <julian@codesourcery.com>
      	    Thomas Schwinge  <thomas@codesourcery.com>
      
      libgomp/
      	* oacc-mem.c (goacc_map_var_existing): New function.
      	(goacc_enter_datum): Use above function.
      	(goacc_exit_datum_1): New function.
      	(goacc_exit_datum): Use above function.
      
      Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
      (cherry picked from commit cb7effde6f36b43d50c8cd7f86eaa05937da7205)
      Julian Brown committed
    • openacc: Set bias to zero for explicit attach/detach clauses in C and C++ · 2974e1ee
      This is a fix for the pointer (or array) size inadvertently being used
      for the bias with attach and detach mapping kinds, for both C and C++.
      
      2020-07-09  Julian Brown  <julian@codesourcery.com>
      	    Thomas Schwinge  <thomas@codesourcery.com>
      
      gcc/c/
      	PR middle-end/95270
      	* c-typeck.c (c_finish_omp_clauses): Set OMP_CLAUSE_SIZE (bias) to zero
      	for standalone attach/detach clauses.
      
      gcc/cp/
      	PR middle-end/95270
      	* semantics.c (finish_omp_clauses): Likewise.
      
      include/
      	PR middle-end/95270
      	* gomp-constants.h (gomp_map_kind): Expand comment for attach/detach
      	mapping kinds.
      
      gcc/testsuite/
      	PR middle-end/95270
      	* c-c++-common/goacc/mdc-1.c: Update expected dump output for zero
      	bias.
      
      libgomp/
      	PR middle-end/95270
      	* testsuite/libgomp.oacc-c-c++-common/pr95270-1.c: New test.
      	* testsuite/libgomp.oacc-c-c++-common/pr95270-2.c: New test.
      
      (cherry picked from commit 0d00fe404c162ad0cf922ca8455aa23a74042b63)
      Julian Brown committed
    • openacc: GOMP_MAP_ATTACH handling in find_group_last · 91e25d6a
      Arrange for GOMP_MAP_ATTACH to be grouped together with a preceding
      GOMP_MAP_TO_PSET or other "to" data movement clause, except in cases
      where an explicit "attach" clause is used.
      
      2020-07-09  Julian Brown  <julian@codesourcery.com>
      
      include/
      	* gomp-constants.h (gomp_map_kind): Update comment for GOMP_MAP_TO_PSET.
      
      libgomp/
      	* oacc-mem.c (find_group_last): Group data-movement clauses
      	(GOMP_MAP_TO_PSET, GOMP_MAP_TO, etc.) together with a subsequent
      	GOMP_MAP_ATTACH.  Allow standalone GOMP_MAP_ATTACH also.
      
      (cherry picked from commit 8d2e5026d22b3f30e7df7adfd4ebf4ebc1e77e2d)
      Julian Brown committed
    • openacc: Fortran derived-type mapping fix · ea219a53
      Fix a bug with mapping Fortran components which themselves have derived
      types in the OpenACC 2.5+ manual deep-copy support.
      
      2020-07-09  Julian Brown  <julian@codesourcery.com>
      
      gcc/fortran/
      	* trans-openmp.c (gfc_trans_omp_clauses): Use 'inner' not 'decl' for
      	derived type members which themselves have derived types.
      
      gcc/testsuite/
      	* gfortran.dg/goacc/mapping-tests-3.f90: New test.
      	* gfortran.dg/goacc/mapping-tests-4.f90: New test.
      
      (cherry picked from commit ac8996edb14eef0a15cd0ce850fde2be5e227e69)
      Julian Brown committed
    • ipa-fnsummary: Fix ICE with switch predicates [PR96130] · 0d03c0ee
      The following testcase ICEs since r10-3199.
      There is a switch with default label, where the controlling expression has
      range just 0..7 and there are case labels for all those 8 values, but
      nothing has yet optimized away the default.
      Since r10-3199, set_switch_stmt_execution_predicate sets the switch to
      default label's edge's predicate to a false predicate and then
      compute_bb_predicates propagates the predicates through the cfg, but false
      predicates aren't really added.  The caller of compute_bb_predicates
      in one place handles NULL bb->aux as false predicate:
            if (fbi.info)
      	{
      	  if (bb->aux)
      	    bb_predicate = *(predicate *) bb->aux;
      	  else
      	    bb_predicate = false;
      	}
            else
      	bb_predicate = true;
      but then in two further spots that the patch below is changing
      it assumes bb->aux must be non-NULL.  Those two spots are guarded by a
      condition that is only true if fbi.info is non-NULL, so I think the right
      fix is to treat NULL aux as false predicate in those spots too.
      
      2020-07-13  Jakub Jelinek  <jakub@redhat.com>
      
      	PR ipa/96130
      	* ipa-fnsummary.c (analyze_function_body): Treat NULL bb->aux
      	as false predicate.
      
      	* gcc.dg/torture/pr96130.c: New test.
      
      (cherry picked from commit 776e48e0931db69f158f40e5cb8e15463d879a42)
      Jakub Jelinek committed
    • Avoid printing informational notes when -Wmismatched-tags is suppressed in… · 5e4c9ebb
      Avoid printing informational notes when -Wmismatched-tags is suppressed in system headers (PR c++/96063)
      
      Related:
      PR c++/96063 - mismatched-tags warnings in stdlib headers
      
      gcc/cp/ChangeLog:
      
      	PR c++/96063
      	* parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
      	if warning_at returns nonzero.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/96063
      	* g++.dg/warn/Wmismatched-tags-7.C: New test.
      	* g++.dg/warn/Wmismatched-tags-8.C: New test.
      Martin Sebor committed
    • c++: Fix tentative parsing of enum-specifier [PR96077] · 30529e2f
      Here's an interesting issue: in this code a ) is missing:
      
        enum { E = (2 } e;
      
      but we compile the code anyway, and E is set to 0 in build_enumerator,
      which is sneaky.
      
      The problem is that cp_parser_enum_specifier parses tentatively, because
      when we see the enum keyword, we don't know yet if we'll find an
      enum-specifier, opaque-enum-declaration, or elaborated-enum-specifier.
      
      In this test when we call cp_parser_enumerator_list we're still parsing
      tentatively, and as a consequence, parens.require_close (parser) in
      cp_parser_primary_expression doesn't report any errors.  But we only go
      on to parse the enumerator-list after we've seen a {, at which point we
      might as well commit -- we know we're dealing with an enum-specifier.
      
      gcc/cp/ChangeLog:
      
      	PR c++/96077
      	* parser.c (cp_parser_enum_specifier): Commit to tentative parse
      	after we've seen an opening brace.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/96077
      	* g++.dg/parse/enum14.C: New test.
      
      (cherry picked from commit 4fd124a23664c712f1bb1a7e91fa23fe83d72c0b)
      Marek Polacek committed
    • fix global variable alignment for testcase gcc.dg/torture/pr96133.c · 60a26b15
      The testcase was errorneously accessing the global variable via a
      type that might require bigger alignment than provided.  Fix that
      via an appropriate attribute.
      
      2020-07-13  Richard Biener  <rguenther@suse.de>
      
      	PR testsuite/96180
      	* gcc.dg/torture/pr96133.c: Align global variable.
      
      (cherry picked from commit 7a4770f0394751860ee54520b23007938907ac33)
      Richard Biener committed
    • PR94600: fix volatile access to the whole of a compound object. · 6f49c66e
      The store to the whole of each volatile object was picked apart
      like there had been an individual assignment to each of the
      fields.  Reads were added as part of that; see PR for details.
      The reads from volatile memory were a clear bug; individual
      stores questionable.  A separate patch clarifies the docs.
      
      gcc:
      
      2020-07-09  Richard Biener  <rguenther@suse.de>
      
      	PR middle-end/94600
      	* expr.c (expand_constructor): Make a temporary also if we're
      	storing to volatile memory.
      
      gcc/testsuite:
      
      2020-07-09  Hans-Peter Nilsson  <hp@axis.com>
      
      	PR middle-end/94600
      	* gcc.dg/pr94600-1.c, gcc.dg/pr94600-2.c, gcc.dg/pr94600-3.c,
      	gcc.dg/pr94600-4.c, gcc.dg/pr94600-5.c, gcc.dg/pr94600-6.c,
      	gcc.dg/pr94600-7.c, gcc.dg/pr94600-8.c: New tests.
      
      (cherry picked from commit a4aca1edaf37d43b2b7e9111825837a7a317b1b0)
      Hans-Peter Nilsson committed
    • Daily bump. · afe0d1fa
      GCC Administrator committed
  2. 12 Jul, 2020 2 commits
    • tree-cfg: Fix ICE with switch stmt to unreachable opt and forced labels [PR95857] · 1ba192b5
      The following testcase ICEs, because during the cfg cleanup, we see:
        switch (i$e_11) <default: <L12> [33.33%], case -3: <lab2> [33.33%], case 0: <L10> [33.33%], case 2: <lab2> [33.33%]>
      ...
      lab2:
        __builtin_unreachable ();
      where lab2 is FORCED_LABEL.  The way it works, we go through the case labels
      and when we reach the first one that points to gimple_seq_unreachable*
      basic block, we remove the edge (if any) from the switch bb to the bb
      containing the label and bbs reachable only through that edge we've just
      removed.  Once we do that, we must throw away all other cases that use
      the same label (or some other labels from the same bb we've removed the edge
      to and the bb).  To avoid quadratic behavior, this is not done by walking
      all remaining cases immediately before removing, but only when processing
      them later.
      For normal labels this works, fine, if the label is in a deleted bb, it will
      have NULL label_to_block and we handle that case, or, if the unreachable bb
      has some other edge to it, only the edge will be removed and not the bb,
      and again, find_edge will not find the edge and we only remove the case.
      And if a label would be to some other block, that other block wouldn't have
      been removed earlier because there would be still an edge from the switch
      block.
      Now, FORCED_LABEL (and I think DECL_NONLOCAL too) break this, because
      those labels aren't removed, but instead moved to some surrounding basic
      block.  So, when we later process those, when their gimple_seq_unreachable*
      basic block is removed, label_to_block will return some unrelated block
      (in the testcase the switch bb), so we decide to keep the case which doesn't
      seem to be unreachable, but we don't really have an edge from the switch
      block to the block the label got moved to.
      
      I thought first about punting in gimple_seq_unreachable* on
      FORCED_LABEL/DECL_NONLOCAL labels, but that might penalize even code that
      doesn't care, so this instead just makes sure that for
      FORCED_LABEL/DECL_NONLOCAL labels that are being removed (and thus moved
      randomly) we remember in a hash_set the fact that those labels should be
      treated as removed for the purpose of the optimization, and later on
      handle those labels that way.
      
      2020-07-02  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/95857
      	* tree-cfg.c (group_case_labels_stmt): When removing an unreachable
      	base_bb, remember all forced and non-local labels on it and later
      	treat those as if they have NULL label_to_block.  Formatting fix.
      	Fix a comment typo.
      
      	* gcc.dg/pr95857.c: New test.
      
      (cherry picked from commit 00f24f56732861d09a9716fa5b6b8a96c2289143)
      Jakub Jelinek committed
    • Daily bump. · 3d4ab896
      GCC Administrator committed
  3. 11 Jul, 2020 1 commit
  4. 10 Jul, 2020 12 commits
    • rs6000: Fix __builtin_altivec_mask_for_load to use correct type · 21d3be21
      gcc/ChangeLog:
      
      	PR target/95581
      	* config/rs6000/rs6000-call.c: Add new type v16qi_ftype_pcvoid.
      	(altivec_init_builtins) Change __builtin_altivec_mask_for_load to use
      	v16qi_ftype_pcvoid with correct number of parameters.
      
      (cherry picked from commit c6b7ba5de624f2a17d799bac5ff017cd065ce035)
      Bill Seurer committed
    • rs6000: Add execution tests for mma builtins [v4] · 45e8c984
      This patch adds execution tests that use the MMA builtins and
      check for the right answer, and new tests that checks whether
      __builtin_cpu_supports and __builtin_cpu_is return sane
      answers for power10.
      
      2020-06-30  Rajalakshmi Srinivasaraghavan  <rajis@linux.vnet.ibm.com>
      	    Aaron Sawdey  <acsawdey@linux.ibm.com>
      
      gcc/testsuite/
      	* gcc.target/powerpc/p10-identify.c: New file.
      	* gcc.target/powerpc/p10-arch31.c: New file.
      	* gcc.target/powerpc/mma-single-test.c: New file.
      	* gcc.target/powerpc/mma-double-test.c: New file.
      
      (cherry picked from commit ed1d3639e42dccc9372f11c6231c3ffe0589fd1c)
      Aaron Sawdey committed
    • Aarch64: Change costs for TX2 to expose more vectorization opportunities · 53116900
      Make the costs such that they do not exaclty reflect
      the actual instructions costs from the manual but make
      the codegen emit the code we want it to.
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64.c (thunderx2t99_regmove_cost,
      	thunderx2t99_vector_cost): Likewise.
      Anton Youdkevitch committed
    • rs6000: fix power10_hw test · 870fe50e
      The code snippet for this test was returning 1 if power10
      instructions executed correctly. It should return 0 if the
      test passes.
      
      	2020-07-07  Aaron Sawdey  <acsawdey@linux.ibm.com>
      
      gcc/testsuite/
      	* lib/target-supports.exp (check_power10_hw_available):
      	Return 0 for passing test.
      
      (cherry picked from commit 7126583af5d29235584b51b3b05eeaba2adef024)
      Aaron Sawdey committed
    • rs6000: Allow MMA built-in initialization regardless of compiler options · 45b7f80f
      Built-in initialization occurs only once and fairly early, when the
      command line options are in force.  If the -mcpu=<CPU> is pre-power10,
      then we fail to initialize the MMA built-ins, so they are not
      available to call in a #pragma target/attribute target function.
      The fix is to basically always (on server type cpus) initialize the MMA
      built-ins so we can use them in #pragma target/attribute target functions.
      
      2020-07-09  Peter Bergner  <bergner@linux.ibm.com>
      
      gcc/
      	PR target/96125
      	* config/rs6000/rs6000-call.c (rs6000_init_builtins): Define the MMA
      	specific types __vector_quad and __vector_pair, and initialize the
      	MMA built-ins if TARGET_EXTRA_BUILTINS is set.
      	(mma_init_builtins): Don't test for mask set in rs6000_builtin_mask.
      	Remove now unneeded mask variable.
      	* config/rs6000/rs6000.c (rs6000_option_override_internal): Add the
      	OPTION_MASK_MMA flag for power10 if not already set.
      
      gcc/testsuite/
      	PR target/96125
      	* gcc.target/powerpc/pr96125.c: New test.
      
      (cherry picked from commit fd263be4b523ff1b7f7dda49d856cc57221e8d21)
      Peter Bergner committed
    • [PATCH, rs6000]Add support to enable vmsumudm behind vec_msum builtin. · f83d1f7e
      gcc/ChangeLog:
      
      2020-07-08  Will Schmidt  <will_schmidt@vnet.ibm.com>
      
      	* config/rs6000/altivec.h (vec_vmsumudm): New define.
      	* config/rs6000/altivec.md (UNSPEC_VMSUMUDM): New unspec.
      	  (altivec_vmsumudm): New define_insn.
      	* config/rs6000/rs6000-builtin.def (altivec_vmsumudm): New BU_ALTIVEC_3
      	  entry. (vmsumudm): New BU_ALTIVEC_OVERLOAD_3 entry.
      	* config/rs6000/rs6000-call.c (altivec_overloaded_builtins): Add entries for
      	  ALTIVEC_BUILTIN_VMSUMUDM variants of vec_msum.
      	* doc/extend.texi: Add document for vmsumudm behind vmsum.
      
      gcc/testsuite/ChangeLog:
      
      2020-07-08  Will Schmidt  <will_schmidt@vnet.ibm.com>
      
      	* gcc.target/powerpc/builtins-msum-runnable.c: New test.
      	* gcc.target/powerpc/vsx-builtin-msum.c: New test.
      
      (cherry picked from commit c1a57681a64150d2fc336ba8e055c5f82e3737e8)
      Will Schmidt committed
    • c++: [[no_unique_address]] fixes. [PR96105] · 3bb33002
      We were wrongly checking is_empty_class on the result of strip_array_types
      rather than the actual field type.  We weren't considering the alignment of
      the data member.  We needed to handle unions the same way as
      layout_nonempty_base_or_field.
      
      gcc/cp/ChangeLog:
      
      	PR c++/96105
      	PR c++/96052
      	PR c++/95976
      	* class.c (check_field_decls): An array of empty classes is not an
      	empty data member.
      	(layout_empty_base_or_field): Handle explicit alignment.
      	Fix union handling.
      
      gcc/testsuite/ChangeLog:
      
      	PR c++/96105
      	PR c++/96052
      	PR c++/95976
      	* g++.dg/cpp2a/no_unique_address4.C: New test.
      	* g++.dg/cpp2a/no_unique_address5.C: New test.
      	* g++.dg/cpp2a/no_unique_address6.C: New test.
      Jason Merrill committed
    • fix constant folding from array CTORs · 8614106f
      This fixes the case where we try to fold a read from an
      array initalizer and happen to cross the boundary of
      multiple CTORs which isn't really supported.  For the
      interesting cases like the testcase we actually handle
      the folding by encoding the whole initializer.
      
      2020-07-10  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/96133
      	* gimple-fold.c (fold_array_ctor_reference): Do not
      	recurse to folding a CTOR that does not fully cover the
      	asked for object.
      
      	* gcc.dg/torture/pr96133.c: New testcase.
      
      (cherry picked from commit 6e41c27bf549d957eb399d39d7d0c213f8733351)
      Richard Biener committed
    • Schedule reduction partition in the last. · c7247272
      If reduction partition's SCC is broken by runtime alias checks, force
      a negative post order to it so that it will be scheduled in the last.
      
      2020-07-09  Bin Cheng  <bin.cheng@linux.alibaba.com>
      
      gcc/
      	PR tree-optimization/95804
      	* tree-loop-distribution.c (break_alias_scc_partitions): Force
      	negative post order to reduction partition.
      
      gcc/testsuite/
      	PR tree-optimization/95804
      	* gcc.dg/tree-ssa/pr95804.c: New test.
      
      (cherry picked from commit dd21b03900085c4d60bf03207ad28bcbfbc86a4b)
      Bin Cheng committed
    • Record and restore postorder information in breaking alias sccs. · f737ca45
      gcc/
      	PR tree-optimization/95638
      	* tree-loop-distribution.c (pg_edge_callback_data): New field.
      	(loop_distribution::break_alias_scc_partitions): Record and restore
      	postorder information.  Fix memory leak.
      
      gcc/testsuite/
      	PR tree-optimization/95638
      	* g++.dg/tree-ssa/pr95638.C: New test.
      
      (cherry picked from commit 2c0069fafb53ccb7a45a6815025dfcbd2882a36e)
      Bin Cheng committed
    • Daily bump. · e1d26d11
      GCC Administrator committed
  5. 09 Jul, 2020 5 commits
    • libstdc++: Implement operator<< for std::unique_ptr (LWG 2948) · 86e99e8e
      libstdc++-v3/ChangeLog:
      
      	* include/bits/unique_ptr.h (operator<<): Define for C++20.
      	* testsuite/20_util/unique_ptr/io/lwg2948.cc: New test.
      	* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error
      	line number.
      	* testsuite/20_util/default_delete/void_neg.cc: Likewise.
      
      (cherry picked from commit 187da2ce31f13b2f75d5bb780e30ee364ead9d1d)
      Jonathan Wakely committed
    • libstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322) · 38250e57
      The bug report is that transform_view's sentinel<false> cannot be
      compared to its iterator<true>.  The comparison is supposed to use
      operator==(iterator<Const>, sentinel<Const>) after converting
      sentinel<false> to sentinel<true>. However, the operator== is a hidden
      friend so is not a candidate when comparing iterator<true> with
      sentinel<false>. The required conversion would only happen if we'd found
      the operator, but we can't find the operator until after the conversion
      happens.
      
      A new LWG issue has been reported, but not yet assigned a number.  The
      solution suggested by Casey Carter is to make the hidden friends of the
      sentinel types work with iterators of any const-ness, so that no
      conversions are required.
      
      Patrick Palka observed that join_view has a similar problem and a
      similar fix is used for its sentinel.
      
      	PR libstdc++/95322
      	* include/std/ranges (transform_view::_Sentinel): Allow hidden
      	friends to work with _Iterator<true> and _Iterator<false>.
      	(join_view::_Sentinel): Likewise.
      	* testsuite/std/ranges/adaptors/95322.cc: New test.
      
      (cherry picked from commit 6c2582c0406250c66e2eb3651f8e8638796b7f53)
      Jonathan Wakely committed
    • libstdc++: Make pmr::synchronized_pool_resource work without libpthread (PR 94936) · 6b196400
      I implicitly assumed that programs using pmr::synchronized_pool_resource
      would also be using multiple threads, and so the weak symbols in
      gthr-posix.h would be resolved by linking to libpthread. If that isn't
      true then it crashes when trying to use pthread_key_create.
      
      This commit makes the pool resource check __gthread_active_p() before
      using thread-specific data, and just use a single set of memory pools
      when there's only a single thread.
      
      	PR libstdc++/94936
      	* src/c++17/memory_resource.cc (synchronized_pool_resource::_TPools):
      	Add comment about single-threaded behaviour.
      	(synchronized_pool_resource::_TPools::move_nonempty_chunks()): Hoist
      	class member access out of loop.
      	(synchronized_pool_resource::synchronized_pool_resource())
      	(synchronized_pool_resource::~synchronized_pool_resource())
      	(synchronized_pool_resource::release()): Check __gthread_active_p
      	before creating and/or deleting the thread-specific data key.
      	(synchronized_pool_resource::_M_thread_specific_pools()): Adjust
      	assertions.
      	(synchronized_pool_resource::do_allocate(size_t, size_t)): Add fast
      	path for single-threaded case.
      	(synchronized_pool_resource::do_deallocate(void*, size_t, size_t)):
      	Likewise. Return if unable to find a pool that owns the allocation.
      	* testsuite/20_util/synchronized_pool_resource/allocate_single.cc:
      	New test.
      	* testsuite/20_util/synchronized_pool_resource/cons_single.cc: New
      	test.
      	* testsuite/20_util/synchronized_pool_resource/release_single.cc: New
      	test.
      
      (cherry picked from commit ec40967f1323069da3a5a45286f71fa4f80926df)
      Jonathan Wakely committed
    • libstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087) · bbf9d358
      It's not difficult for multiple threads to drain the entropy available
      to the RDSEED instruction, at which point we throw an exception. This
      change will try to use RDRAND after RDSEED fails repeatedly, and only
      throw if RDRAND also fails repeatedly. This doesn't guarantee a random
      value can always be read, but reduces the likelihood of failure when
      using the RDSEED instruction.
      
      	PR libstdc++/94087
      	* src/c++11/random.cc (__x86_rdseed): Allow fallback function to be
      	passed in.
      	(__x86_rdseed_rdrand): New function that uses rdseed with rdrand
      	fallback.
      	(random_device::_M_init): Use __x86_rdseed_rdrand when both
      	instructions are available.
      	* testsuite/26_numerics/random/random_device/94087.cc: New test.
      
      (cherry picked from commit a2d196e75cef95c2b70734ad02e94f9da0e769fe)
      Jonathan Wakely committed
    • RISC-V: Disable remove unneeded save-restore call optimization if there are any arguments on stack. · e506371e
       - This optimization will adjust stack, but it not check/update other
         stack pointer use-site, the example is when the arguments put on
         stack, the offset become wrong after optimization.
      
       - However adjust stack frame usage after register allocation could be
         error prone, so we decide to turn off this optimization for such case.
      
       - Ye-Ting Kuo report this issue on github:
         https://github.com/riscv/riscv-gcc/pull/192
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-sr.c (riscv_remove_unneeded_save_restore_calls):
      	Abort if any arguments on stack.
      
      gcc/testsuite/ChangeLog
      
      	* gcc.target/riscv/save-restore-9.c: New.
      
      (cherry picked from commit 4c0d1322033ce979532425d336530b217f6b5fd3)
      Kito Cheng committed