platform/upstream/gcc.git
4 years agocgraphclones.c (localize_profile): New function.
Jan Hubicka [Thu, 5 Dec 2019 18:12:51 +0000 (19:12 +0100)]
cgraphclones.c (localize_profile): New function.

* cgraphclones.c (localize_profile): New function.
(cgraph_node::create_clone): Use it for partial profiles.
* common.opt (fprofile-partial-training): New flag.
* doc/invoke.texi (-fprofile-partial-training): Document.
* ipa-cp.c (update_profiling_info): For partial profiles do not
set function profile to zero.
* profile.c (compute_branch_probabilities): With partial profile
watch if edge count is zero and turn all probabilities to guessed.
(compute_branch_probabilities): For partial profiles do not apply
profile when entry count is zero.
* tree-profile.c (tree_profiling): Only do value_profile_transformations
when profile is read.

From-SVN: r279013

4 years ago[Patch, GCC] Fix a condition post r278611
Sudakshina Das [Thu, 5 Dec 2019 18:03:01 +0000 (18:03 +0000)]
[Patch, GCC] Fix a condition post r278611

gcc/ChangeLog

2019-12-05  Sudakshina Das  <sudi.das@arm.com>

* tree-vect-loop.c (vect_model_reduction_cost): Remove reduction_type
check from if condition.

From-SVN: r279012

4 years agore PR go/92820 (libgo.so.15 has executable stack)
Ian Lance Taylor [Thu, 5 Dec 2019 17:51:10 +0000 (17:51 +0000)]
re PR go/92820 (libgo.so.15 has executable stack)

PR go/92820
    runtime: always mark assembly file as non-executable stack

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

From-SVN: r279010

4 years agoOpenMP] Fix use_device_… with absent optional arg
Tobias Burnus [Thu, 5 Dec 2019 15:18:39 +0000 (15:18 +0000)]
OpenMP] Fix use_device_… with absent optional arg

        gcc/fortran/
        * trans-openmp.c (gfc_omp_is_optional_argument,
        gfc_omp_check_optional_argument): Handle type(c_ptr),value which uses a
        hidden argument for the is-present check.

        gcc/
        * omp-low.c (lower_omp_target): For use_device_ptr/use_derice_addr
        and Fortran's optional arguments, unconditionally add the is-present
        condition before the libgomp call.

        libgomp/
        * testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: Add
        'type(c_ptr), value' test case. Conditionally map the per-value
        passed arguments.

From-SVN: r279004

4 years ago* cp-gimplify.c: Include memmodel.h.
David Edelsohn [Thu, 5 Dec 2019 14:40:11 +0000 (14:40 +0000)]
* cp-gimplify.c: Include memmodel.h.

From-SVN: r279003

4 years agoCheck for bitwise identity when encoding VECTOR_CSTs (PR 92768)
Richard Sandiford [Thu, 5 Dec 2019 14:20:38 +0000 (14:20 +0000)]
Check for bitwise identity when encoding VECTOR_CSTs (PR 92768)

This PR shows that we weren't checking for bitwise-identical values
when trying to encode a VECTOR_CST, so -0.0 was treated the same as
0.0 for -fno-signed-zeros.  The patch adds a new OEP flag to select
that behaviour.

2019-12-05  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR middle-end/92768
* tree-core.h (OEP_BITWISE): New flag.
* fold-const.c (operand_compare::operand_equal_p): Handle it.
* tree-vector-builder.h (tree_vector_builder::equal_p): Pass it.

gcc/testsuite/
PR middle-end/92768
* gcc.dg/pr92768.c: New test.

From-SVN: r279002

4 years agolibstdc++: Fix bug in std::span test
Jonathan Wakely [Thu, 5 Dec 2019 13:50:08 +0000 (13:50 +0000)]
libstdc++: Fix bug in std::span test

The previous commit fixed the std::span constructors from const arrays,
revealing a bug in this test.

* testsuite/23_containers/span/lwg3255.cc: Fix test. Constructing a
span of non-const elements should not be possible from a const array
or an array of const elements.

From-SVN: r279001

4 years agolibstdc++: Implement P1872R0 and P1394R0 for std::span
JeanHeyd "ThePhD" Meneide [Thu, 5 Dec 2019 13:50:01 +0000 (13:50 +0000)]
libstdc++: Implement P1872R0 and P1394R0 for std::span

This also fixes a bug in the implementation of LWG 3255, which causes:
FAIL: 23_containers/span/lwg3255.cc (test for excess errors)
That's because the test was wrong and verified the buggy behaviour. That
will be fixed in the following commit.

2019-12-05  JeanHeyd "ThePhD" Meneide  <phdofthehouse@gmail.com>

Implement P1872R0 and P1394R0 for std::span
* include/bits/range_access.h (__adl_begin, __adl_end): Remove.
(sentinel_t, range_value_t, range_reference_t)
(range_rvalue_reference_t, __forwarding_range, disable_sized_range)
(output_range, input_range, forward_range, bidirectional_range)
(random_access_range, contiguous_range, common_range): Move here from
<ranges>, to make this the "ranges lite" internal header.
* include/std/ranges: Move basic aliases and concepts to
<bits/range_access.h>.
* include/std/span: Use concepts and ranges:: calls instead of
enable_if and friends.
* include/std/type_traits: Add __is_array_convertible trait.

From-SVN: r279000

4 years agore PR tree-optimization/92818 (Typo in vec_perm -> bit_insert pattern)
Richard Biener [Thu, 5 Dec 2019 13:02:57 +0000 (13:02 +0000)]
re PR tree-optimization/92818 (Typo in vec_perm -> bit_insert pattern)

2019-12-05  Richard Biener  <rguenther@suse.de>

PR middle-end/92818
* tree-ssa-forwprop.c (simplify_vector_constructor): Improve
heuristics on what don't care element to choose.
* match.pd (VEC_PERM_EXPR -> BIT_INSERT_EXPR): Fix typo.

* gcc.target/i386/pr92818.c: New testcase.

From-SVN: r278998

4 years agolibstdc++: Define std::lexicographical_compare_three_way for C++20
Jonathan Wakely [Thu, 5 Dec 2019 12:46:50 +0000 (12:46 +0000)]
libstdc++: Define std::lexicographical_compare_three_way for C++20

* include/bits/stl_algobase.h (lexicographical_compare_three_way):
Define for C++20.
* testsuite/25_algorithms/lexicographical_compare_three_way/1.cc: New
test.
* testsuite/25_algorithms/lexicographical_compare_three_way/
constexpr.cc: New test.

From-SVN: r278996

4 years agoFix __gcov_exit fn prototype.
Martin Liska [Thu, 5 Dec 2019 12:35:26 +0000 (13:35 +0100)]
Fix __gcov_exit fn prototype.

2019-12-05  Martin Liska  <mliska@suse.cz>

PR gcov-profile/92817
* coverage.c (build_gcov_exit_decl): Remove superfluous
void_type_node.

From-SVN: r278995

4 years agoMSP430: Fix postinc addressing mode being used for dst op of CMP insns
Jozef Lawrynowicz [Thu, 5 Dec 2019 10:56:02 +0000 (10:56 +0000)]
MSP430: Fix postinc addressing mode being used for dst op of CMP insns

2019-12-05  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* config/msp430/msp430.md (cbranch<mode>4): Use
msp430_general_dst_nonv_operand instead of nonimmediate_operand for
dest operand of CMP instruction.
(cbranchpsi4_real): Likewise.
(cbranchqi4_real): Likewise.
(cbranchhi4_real): Likewise.
(cbranchpsi4_reversed): Likewise.
(cbranchqi4_reversed): Likewise.
(cbranchhi4_reversed): Likewise.

From-SVN: r278994

4 years agoSkip test gcc/testsuite/gcc.dg/asm-4.c for amdgcn target
Frederik Harwath [Thu, 5 Dec 2019 10:26:56 +0000 (10:26 +0000)]
Skip test gcc/testsuite/gcc.dg/asm-4.c for amdgcn target

2019-12-05  Frederik Harwath  <frederik@codesourcery.com>

gcc/testsuite/
* gcc.dg/asm-4.c: Skip on target amdgcn-*-*.

From-SVN: r278993

4 years agore PR target/92055 ([avr] Support 64-bit double)
Georg-Johann Lay [Thu, 5 Dec 2019 09:47:35 +0000 (09:47 +0000)]
re PR target/92055 ([avr] Support 64-bit double)

PR target/92055
* config/avr/t-avrlibc (MULTISUBDIR): Search for double, not double64.

From-SVN: r278992

4 years agore PR tree-optimization/92803 (error: type mismatch in 'vec_perm_expr' since r278764)
Richard Biener [Thu, 5 Dec 2019 09:45:46 +0000 (09:45 +0000)]
re PR tree-optimization/92803 (error: type mismatch in 'vec_perm_expr' since r278764)

2019-12-05  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92803
* tree-ssa-forwprop.c (simplify_vector_constructor): Fix
invariant vector construction.

* gcc.target/i386/pr92803.c: New testcase.

From-SVN: r278991

4 years agoFix profile name files without -fprofile-dir.
Martin Liska [Thu, 5 Dec 2019 09:08:44 +0000 (10:08 +0100)]
Fix profile name files without -fprofile-dir.

2019-12-05  Martin Liska  <mliska@suse.cz>

PR gcov-profile/91971
* coverage.c (coverage_init): Mangle full path
only when -fprofile-dir is used.

From-SVN: r278990

4 years agore PR target/92791 (ICE in extract_insn, at recog.c:2311 since r278645)
Jakub Jelinek [Thu, 5 Dec 2019 09:04:24 +0000 (10:04 +0100)]
re PR target/92791 (ICE in extract_insn, at recog.c:2311 since r278645)

PR target/92791
* config/i386/i386.md (movstrict<mode>): Move test for
TARGET_PARTIAL_REG_STALL and not optimizing for size from
expander's condition to the body - FAIL; in that case.

From-SVN: r278989

4 years agore PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065)
Jakub Jelinek [Thu, 5 Dec 2019 09:03:34 +0000 (10:03 +0100)]
re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065)

PR fortran/92781
* trans-decl.c (gfc_get_symbol_decl): If sym->backend_decl is
current_function_decl, add length to current rather than parent
function and expect DECL_CONTEXT (length) to be current_function_decl.

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

From-SVN: r278988

4 years agotypeck2.c (build_functional_cast): Add location_t parameter and use it.
Paolo Carlini [Thu, 5 Dec 2019 08:59:24 +0000 (08:59 +0000)]
typeck2.c (build_functional_cast): Add location_t parameter and use it.

/gcc/cp
2019-12-05  Paolo Carlini  <paolo.carlini@oracle.com>

* typeck2.c (build_functional_cast): Add location_t parameter
and use it.
* cp-tree.h: Update declaration.
* parser.c (cp_parser_functional_cast): Adjust call.
* call.c (build_op_delete_call): Likewise.
(build_new_method_call_1): Likewise.
* decl.c (check_initializer): Likewise.
* pt.c (tsubst_copy_and_build): Likewise.
* semantics.c (finish_compound_literal): Likewise.

/libcc1
2019-12-05  Paolo Carlini  <paolo.carlini@oracle.com>

* libcp1plugin.cc (plugin_build_expression_list_expr): Adjust
build_functional_cast call.

/testsuite
2019-12-05  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/diagnostic/functional-cast-to-array-type-1.C: New.
* g++.dg/cpp0x/auto25.C: Check location(s) too.
* g++.dg/cpp0x/auto28.C: Likewise.
* g++.dg/init/reference2.C: Likewise.
* g++.dg/parse/template2.C: Likewise.
* g++.dg/template/error8.C: Likewise.
* g++.old-deja/g++.ns/crash3.C: Likewise.
* g++.old-deja/g++.ns/template7.C: Likewise.
* g++.old-deja/g++.pt/crash8.C: Likewise.

From-SVN: r278987

4 years agotestsuite/libgomp.oacc-fortran: Update dg-output to fix GCN
Tobias Burnus [Thu, 5 Dec 2019 08:38:53 +0000 (08:38 +0000)]
testsuite/libgomp.oacc-fortran:  Update dg-output to fix GCN

        * testsuite/libgomp.oacc-fortran/error_stop-1.f: Also don't
        expect dg-output of 'Error termination.' for GCN.
        * testsuite/libgomp.oacc-fortran/error_stop-2.f: Likewise.
        * testsuite/libgomp.oacc-fortran/error_stop-3.f: Likewise.

Plus: Fix date of a previous commit in:
        * gcc/fortran/ChangeLog
        * gcc/testsuite/ChangeLog

From-SVN: r278986

4 years ago* edtest.c (test1): Add noclone attribute.
Ian Lance Taylor [Thu, 5 Dec 2019 03:56:40 +0000 (03:56 +0000)]
* edtest.c (test1): Add noclone attribute.

From-SVN: r278985

4 years agolibbacktrace: simplify DWARF section handling
Ian Lance Taylor [Thu, 5 Dec 2019 02:20:11 +0000 (02:20 +0000)]
libbacktrace: simplify DWARF section handling

This is in preparation for adding DWARF 5 support.

* internal.h (enum dwarf_section): Define.
(struct dwarf_sections): Define.
(backtrace_dwarf_add): Update declaration to replace specific
section parameters with dwarf_sections parameter.
* dwarf.c (struct dwarf_data): Replace specific section fields
with dwarf_sections field.
(read_attribute): Use dwarf_sections with altlink.
(build_address_map): Replace specific section parameters with
dwarf_sections parameter.  Change all callers.
(read_line_info): Use dwarf_sections with ddata.
(read_referenced_name): Likewise.
(add_function_ranges): Likewise.
(read_function_entry): Likewise.
(read_function_info): Likewise.
(build_dwarf_data): Replace specific section parameters with
dwarf_sections parameter.  Change all callers.
(backtrace_dwarf_add): Likewise.
* elf.c (enum debug_section): Remove.
(dwarf_section_names): Remove .zdebug names.
(elf_add): Track zsections separately.  Build dwarf_sections.
* pecoff.c (enum debug_section): Remove.
(struct debug_section_info): Remove data field.
(coff_add): Build dwarf_sections.
* xcoff.c (enum dwarf_section): Remove.  Replace DWSECT_xxx
references with DEBUG_xxx references.
(xcoff_add): Build dwarf_sections.

From-SVN: r278984

4 years agoPR middle-end/91582 - missing heap overflow detection for strcpy
Martin Sebor [Thu, 5 Dec 2019 01:28:11 +0000 (01:28 +0000)]
PR middle-end/91582 - missing heap overflow detection for strcpy

gcc/ChangeLog:

PR middle-end/91582
* builtins.c (gimple_call_alloc_size): New function.
(compute_objsize): Add argument.  Call gimple_call_alloc_size.
Handle variable offsets and indices.
* builtins.h (gimple_call_alloc_size): Declare.
(compute_objsize): Add argument.
* gcc/gimple-ssa-warn-restrict.c: Remove assertions.
* tree-ssa-strlen.c (handle_store): Handle calls to allocated objects.

gcc/testsuite/ChangeLog:

PR middle-end/91582
* c-c++-common/Wstringop-truncation.c: Remove xfails.
* g++.dg/warn/Wstringop-overflow-4.C: New test.
* g++.dg/ext/attr-alloc_size.C: Suppress -Warray-bounds.
* gcc.dg/Warray-bounds-56.c: New test.
* gcc.dg/Wstringop-overflow-22.c: New test.
* gcc.dg/attr-alloc_size.c: Suppress -Warray-bounds.
* gcc.dg/attr-copy-2.c: Same.
* gcc.dg/builtin-stringop-chk-5.c: Remove xfails.
* gcc.dg/builtin-stringop-chk-8.c: Same.  Correct the text of expected
warnings.
* gcc.target/i386/pr82002-2a.c: Prune expected warning.
* gcc.target/i386/pr82002-2b.c: Same.

From-SVN: r278983

4 years agolibstdc++: Define pretty printer for comparison categories
Jonathan Wakely [Thu, 5 Dec 2019 00:42:11 +0000 (00:42 +0000)]
libstdc++: Define pretty printer for comparison categories

* python/libstdcxx/v6/printers.py (StdCmpCatPrinter): New printer.
* testsuite/libstdc++-prettyprinters/cxx20.cc: New test.

From-SVN: r278982

4 years agolibstdc++: Implement spaceship for std::array (P1614R2)
Jonathan Wakely [Thu, 5 Dec 2019 00:42:06 +0000 (00:42 +0000)]
libstdc++: Implement spaceship for std::array (P1614R2)

As done for std::pair, this defines operator<=> as a non-member function
template and does not alter operator==, as expected to be proposed as
the resolution to an unpublished LWG issue.

Instead of calling std::lexicographical_compare_three_way the <=>
overload is implemented by hand to take advantage of the fact the
element types and array sizes are known to be the same.

* include/bits/cpp_type_traits.h (__is_byte<char8_t>): Add
specialization.
* include/std/array (operator<=>): Likewise.
* testsuite/23_containers/array/comparison_operators/constexpr.cc:
Test three-way comparisons and arrays of unsigned char.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust
dg-error line numbers.

From-SVN: r278981

4 years agoDaily bump.
GCC Administrator [Thu, 5 Dec 2019 00:16:38 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278980

4 years agoFix C handling of use of lvalues of incomplete types (PR c/36941, PR c/88827).
Joseph Myers [Wed, 4 Dec 2019 23:26:10 +0000 (23:26 +0000)]
Fix C handling of use of lvalues of incomplete types (PR c/36941, PR c/88827).

Bug 88827 points out that GCC should not be rejecting C code that
dereferences a pointer to an incomplete type in the case that uses &*
to take the address of the resulting lvalue, because no constraint is
violated in that case (other than for C90 when the incomplete type is
unqualified void, which we already handle correctly) and as the lvalue
never gets converted to an rvalue there is no undefined behavior
either.

This means that the diagnostic for such a dereference is bogus and
should be removed; if the lvalue gets converted to an rvalue, there
should be an appropriate error later for the use of the incomplete
type.  In most cases, there is, but bug 36941 points out the lack of a
diagnostic when the incomplete (non-void) type gets cast to void
(where a diagnostic seems appropriate for this undefined behavior as a
matter of quality of implementation).

This patch removes the bogus diagnostic (and C_TYPE_ERROR_REPORTED
which was only used in the code that is removed - only that one, bogus
diagnostic had this duplicate suppression, not any of the other, more
legitimate diagnostics for use of incomplete types) and makes
convert_lvalue_to_rvalue call require_complete_type for arguments not
of void types, so that all relevant code paths (possibly except some
for ObjC) get incomplete types diagnosed.  It's possible that this
makes some other checks for incomplete types obsolete, but no attempt
is made to remove any such checks.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

PR c/36941
PR c/88827
gcc/c:
* c-typeck.c (convert_lvalue_to_rvalue): Call
require_complete_type for arguments not of void types.
(build_indirect_ref): Do not diagnose dereferencing pointers to
incomplete types.
* c-tree.h (C_TYPE_ERROR_REPORTED): Remove.

gcc/testsuite:
* gcc.dg/lvalue-9.c, gcc.dg/lvalue-10.c: New tests.
* gcc.dg/array-8.c, gcc.dg/enum-incomplete-1.c,
gcc.dg/enum-incomplete-3.c, gcc.dg/noncompile/incomplete-3.c,
gcc.dg/pr48552-1.c, gcc.dg/pr48552-2.c, gcc.dg/pr63543.c,
gcc.dg/pr69796.c: Update expected diagnostics.

From-SVN: r278976

4 years ago* cp-gimplify.c: Include tm_p.h.
David Edelsohn [Wed, 4 Dec 2019 20:04:10 +0000 (20:04 +0000)]
* cp-gimplify.c: Include tm_p.h.

From-SVN: r278975

4 years agoUse fixed registers for queue ptr sgpr pair
Julian Brown [Wed, 4 Dec 2019 20:00:48 +0000 (20:00 +0000)]
Use fixed registers for queue ptr sgpr pair

gcc/
* config/gcn/gcn.h (FIXED_REGISTERS): Make s6/s7 fixed registers.

From-SVN: r278974

4 years agoDo not define builtins that overload disabled builtins.
Peter Bergner [Wed, 4 Dec 2019 19:53:26 +0000 (19:53 +0000)]
Do not define builtins that overload disabled builtins.

PR bootstrap/92661
* config/rs6000/rs6000-c.c (struct altivec_builtin_types): Move to
rs6000.h.
(altivec_overloaded_builtins): Move to rs6000-call.c.
* config/rs6000/rs6000.h (struct altivec_builtin_types): Moved from
rs6000-c.c.
* config/rs6000/rs6000-call.c (rs6000_builtin_info): Make static.
(altivec_overloaded_builtins): Moved from rs6000-c.c.
(rs6000_common_init_builtins): Do no define builtins that overload
builtins that have been disabled.

From-SVN: r278973

4 years ago[ARM] Improve max_cond_insns setting for Cortex cores
Wilco Dijkstra [Wed, 4 Dec 2019 15:40:41 +0000 (15:40 +0000)]
[ARM] Improve max_cond_insns setting for Cortex cores

To enable cores to use the correct max_cond_insns setting, use the core-specific
tuning when a CPU/tune is selected unless -mrestrict-it is explicitly set.

On Cortex-A57 this gives 1.1% performance gain on SPECINT2006 as well as a
0.4% codesize reduction.

    gcc/
* config/arm/arm.c (arm_option_override_internal):
Use max_cond_insns from CPU tuning unless -mrestrict-it is used.

From-SVN: r278968

4 years agoRemove stray comma in primary_constraint_error.
Marek Polacek [Wed, 4 Dec 2019 14:52:12 +0000 (14:52 +0000)]
Remove stray comma in primary_constraint_error.

* parser.c (enum primary_constraint_error): Remove stray comma.

From-SVN: r278967

4 years ago[AArch64] Add support for fused compare and branch
Wilco Dijkstra [Wed, 4 Dec 2019 14:45:59 +0000 (14:45 +0000)]
[AArch64] Add support for fused compare and branch

Add support for fused compare with branch.  Rename the existing
AARCH64_FUSE_CMP_BRANCH to ALU_BRANCH, and AARCH64_FUSE_ALU_BRANCH
to ALU_CBZ to make it clear what is being fused.

    gcc/
* config/aarch64/aarch64.c
(thunderxt88_tunings): Use AARCH64_FUSE_ALU_BRANCH.
(thunderx_tunings): Likewise.
(tsv110_tunings): Use AARCH64_FUSE_ALU_BRANCH and AARCH64_FUSE_ALU_CBZ.
(thunderx2t99_tunings): Likewise.
(aarch_macro_fusion_pair_p): Add support for AARCH64_FUSE_CMP_BRANCH.
* config/aarch64/aarch64-fusion-pairs.def: Add ALU_CBZ fusion.

From-SVN: r278966

4 years agotree-ssa-sccvn.c (vn_reference_lookup_3): Properly guard empty CTOR and memset partia...
Richard Biener [Wed, 4 Dec 2019 13:21:39 +0000 (13:21 +0000)]
tree-ssa-sccvn.c (vn_reference_lookup_3): Properly guard empty CTOR and memset partial-def registering.

2019-12-04  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (vn_reference_lookup_3): Properly guard
empty CTOR and memset partial-def registering.  Take advantage
of fancy offset analysis in memset handling.

From-SVN: r278965

4 years agoFix VIEW_CONVERT_EXPRs for VECTOR_BOOLEAN_TYPE_Ps
Richard Sandiford [Wed, 4 Dec 2019 13:14:20 +0000 (13:14 +0000)]
Fix VIEW_CONVERT_EXPRs for VECTOR_BOOLEAN_TYPE_Ps

In r278410 I added code to handle VIEW_CONVERT_EXPRs between
variable-length vectors.  This included support for decoding
a VECTOR_BOOLEAN_TYPE_P with subbyte elements.

However, it turns out that we were already mishandling such bool vectors
for fixed-length vectors: we treated each element as a stand-alone byte
instead of putting multiple elements into the same byte.  I think in
principle this could have been an issue for AVX512 as well.

This patch adds encoding support for boolean vectors and reuses
a version of the new decode support for fixed-length vectors.

2019-12-04  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* fold-const.c (native_encode_vector_part): Handle
VECTOR_BOOLEAN_TYPE_Ps that have subbyte precision.
(native_decode_vector_tree): Delete, moving the bulk of the code to...
(native_interpret_vector_part): ...this new function.  Use a pointer
and length instead of a vec<> and start index.
(native_interpret_vector): Use native_interpret_vector_part.
(fold_view_convert_vector_encoding): Likewise.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/whilelt_5.c: New test.

From-SVN: r278964

4 years agotree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Handle non-constant defs in...
Richard Biener [Wed, 4 Dec 2019 12:23:58 +0000 (12:23 +0000)]
tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Handle non-constant defs in the most trivial way.

2019-12-04  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Handle
non-constant defs in the most trivial way.
(vn_reference_lookup_3): Also push down SSA partial defs.

* gcc.dg/tree-ssa/ssa-fre-84.c: New testcase.

From-SVN: r278963

4 years agoFortran] PR92754 - fix an issue with resolving intrinsic functions
Tobias Burnus [Wed, 4 Dec 2019 12:19:55 +0000 (12:19 +0000)]
Fortran] PR92754 - fix an issue with resolving intrinsic functions

        gcc/fortran/
        PR fortran/92754
        * intrinsic.c (gfc_intrinsic_func_interface): Set
        sym's flavor, intrinsic and function attribute if
        unset.

        gcc/testsuite/
        PR fortran/92754
        gfortran.dg/intrinsic_9.f90: New.

From-SVN: r278961

4 years agoInitialize a BB count in switch lowering.
Martin Liska [Wed, 4 Dec 2019 10:13:49 +0000 (11:13 +0100)]
Initialize a BB count in switch lowering.

2019-12-04  Martin Liska  <mliska@suse.cz>

* tree-switch-conversion.c (switch_decision_tree::try_switch_expansion):
Initialize count of newly created BB.

From-SVN: r278959

4 years agore PR tree-optimization/92734 (Missing match.pd simplification done by fold_binary_lo...
Jakub Jelinek [Wed, 4 Dec 2019 09:38:48 +0000 (10:38 +0100)]
re PR tree-optimization/92734 (Missing match.pd simplification done by fold_binary_loc on generic)

PR tree-optimization/92734
* match.pd ((A +- B) - A -> +- B, (A +- B) -+ B -> A,
A - (A +- B) -> -+ B, A +- (B -+ A) -> +- B): Handle nop_convert.

* gcc.dg/tree-ssa/pr92734-2.c: New test.

From-SVN: r278958

4 years ago[C++] Opt out of GNU vector extensions for built-in SVE types
Richard Sandiford [Wed, 4 Dec 2019 09:18:13 +0000 (09:18 +0000)]
[C++] Opt out of GNU vector extensions for built-in SVE types

This is the C++ equivalent of r277950.  The changes are very similar
to there.  Perhaps the only noteworthy thing (that I know of) is that
the patch continues to treat !gnu_vector_type_p vector types as literal
types/potential constexprs.  Disabling the GNU vector extensions
shouldn't in itself stop the types from being literal types, since
whatever the target provides instead might be constexpr material.

2019-12-04  Richard Sandiford  <richard.sandiford@arm.com>

gcc/cp/
* cp-tree.h (CP_AGGREGATE_TYPE_P): Check for gnu_vector_type_p
instead of VECTOR_TYPE.
* call.c (build_conditional_expr_1): Restrict vector handling
to vectors that satisfy gnu_vector_type_p.
* cvt.c (ocp_convert): Only allow vectors to be converted
to bool if they satisfy gnu_vector_type_p.
(build_expr_type_conversion): Only allow conversions from
vectors if they satisfy gnu_vector_type_p.
* typeck.c (cp_build_binary_op): Only allow binary operators to be
applied to vectors if they satisfy gnu_vector_type_p.
(cp_build_unary_op): Likewise unary operators.
(build_reinterpret_cast_1):

gcc/testsuite/
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C: New test.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C: New test.

From-SVN: r278957

4 years agore PR fortran/92756 (ICE in lower_omp, at omp-low.c:12988)
Jakub Jelinek [Wed, 4 Dec 2019 08:47:13 +0000 (09:47 +0100)]
re PR fortran/92756 (ICE in lower_omp, at omp-low.c:12988)

PR fortran/92756
* trans-openmp.c (gfc_trans_omp_teams): Wrap OMP_TEAMS body into a
BIND_EXPR with a forced BLOCK.

* gfortran.dg/gomp/teams1.f90: New test.

* testsuite/libgomp.fortran/teams1.f90: New test.
* testsuite/libgomp.fortran/teams2.f90: New test.

From-SVN: r278956

4 years ago[rs6000] Fix PR92760 by checking VECTOR_MEM_NONE_P instead
Kewen Lin [Wed, 4 Dec 2019 05:10:46 +0000 (05:10 +0000)]
[rs6000] Fix PR92760 by checking VECTOR_MEM_NONE_P instead

PR92760 exposed one issue that VECTOR_UNIT_NONE_P (V2DImode) is true on Power7
then we won't return it as preferred_simd_mode but ISA 2.06 (Power7) does
introduce partial support on vector doubleword (very limitted) and more basic
support origins from ISA 2.07 (Power8) though.  To make vectorizer still
leverage those few but available V2DImode related instructions, we need to
claim it's available on VSX (Power7 and up).

gcc/ChangeLog

    PR target/92760
    * gcc/config/rs6000/rs6000.c (rs6000_preferred_simd_mode): Use
    VECTOR_MEM_NONE_P instead of VECTOR_UNIT_NONE_P.

From-SVN: r278955

4 years agoDaily bump.
GCC Administrator [Wed, 4 Dec 2019 00:16:41 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278954

4 years agolibstdc++: Implement spaceship for std::pair (P1614R2)
Jonathan Wakely [Tue, 3 Dec 2019 23:57:46 +0000 (23:57 +0000)]
libstdc++: Implement spaceship for std::pair (P1614R2)

This defines operator<=> as a non-member function template and does not
alter operator==. This contradicts the changes made by P1614R2, which
specify both as hidden friends, but that specification of operator<=> is
broken and the subject of a soon-to-be-published LWG issue.

* include/bits/stl_pair.h [__cpp_lib_three_way_comparison]
(operator<=>): Define for C++20.
* libsupc++/compare (__cmp2way_res_t): Rename to __cmp3way_res_t,
move into __detail namespace. Do not turn argument types into lvalues.
(__cmp3way_helper): Rename to __cmp3way_res_impl, move into __detail
namespace. Constrain with concepts instead of using void_t.
(compare_three_way_result): Adjust name of base class.
(compare_three_way_result_t): Use __cmp3way_res_impl directly.
(__detail::__3way_cmp_with): Add workaround for PR 91073.
(compare_three_way): Use workaround.
(__detail::__synth3way, __detail::__synth3way_t): Define new helpers
implementing synth-three-way and synth-three-way-result semantics.
* testsuite/20_util/pair/comparison_operators/constexpr_c++20.cc: New
test.

From-SVN: r278951

4 years agolibstdc++: Fix Doxygen markup error
Jonathan Wakely [Tue, 3 Dec 2019 23:57:28 +0000 (23:57 +0000)]
libstdc++: Fix Doxygen markup error

* include/bits/stl_pair.h (pair): Remove stray Doxygen closing marker.

From-SVN: r278950

4 years agocp-tree.h (enum cp_tree_index): Add CPTI_SOURCE_LOCATION_IMPL.
Jakub Jelinek [Tue, 3 Dec 2019 23:32:15 +0000 (00:32 +0100)]
cp-tree.h (enum cp_tree_index): Add CPTI_SOURCE_LOCATION_IMPL.

* cp-tree.h (enum cp_tree_index): Add CPTI_SOURCE_LOCATION_IMPL.
(source_location_impl): Define.
(enum cp_built_in_function): Add CP_BUILT_IN_SOURCE_LOCATION.
(fold_builtin_source_location): Declare.
* cp-gimplify.c: Include output.h, file-prefix-map.h and cgraph.h.
(cp_gimplify_expr, cp_fold): Handle CP_BUILT_IN_SOURCE_LOCATION.
Formatting fix.
(get_source_location_impl_type): New function.
(struct source_location_table_entry,
struct source_location_table_entry_hash): New types.
(source_location_table, source_location_id): New variables.
(fold_builtin_source_location): New function.
* constexpr.c (cxx_eval_builtin_function_call): Handle
CP_BUILT_IN_SOURCE_LOCATION.
* tree.c (builtin_valid_in_constant_expr_p): Likewise.  Formatting
fix.
* decl.c (cxx_init_decl_processing): Register
__builtin_source_location.
* name-lookup.c (get_std_name_hint): Add source_location entry.

* g++.dg/cpp2a/srcloc1.C: New test.
* g++.dg/cpp2a/srcloc2.C: New test.
* g++.dg/cpp2a/srcloc3.C: New test.
* g++.dg/cpp2a/srcloc4.C: New test.
* g++.dg/cpp2a/srcloc5.C: New test.
* g++.dg/cpp2a/srcloc6.C: New test.
* g++.dg/cpp2a/srcloc7.C: New test.
* g++.dg/cpp2a/srcloc8.C: New test.
* g++.dg/cpp2a/srcloc9.C: New test.
* g++.dg/cpp2a/srcloc10.C: New test.
* g++.dg/cpp2a/srcloc11.C: New test.
* g++.dg/cpp2a/srcloc12.C: New test.
* g++.dg/cpp2a/srcloc13.C: New test.
* g++.dg/cpp2a/srcloc14.C: New test.

From-SVN: r278949

4 years agore PR bootstrap/92783 (SEGV in field_byte_offset)
Eric Botcazou [Tue, 3 Dec 2019 23:10:46 +0000 (23:10 +0000)]
re PR bootstrap/92783 (SEGV in field_byte_offset)

PR bootstrap/92783
* gcc-interface/utils.c (rest_of_record_type_compilation): Move down
the guard for the position of fields in the descriptive type.

From-SVN: r278948

4 years agotypeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc location in a few...
Paolo Carlini [Tue, 3 Dec 2019 20:46:32 +0000 (20:46 +0000)]
typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc location in a few additional diagnostics; tidy.

/cp
2019-12-03  Paolo Carlini  <paolo.carlini@oracle.com>

* typeck.c (cp_build_addr_expr_1): Use the cp_expr_loc_or_input_loc
location in a few additional diagnostics; tidy.
(check_return_expr): Likewise.

* typeck.c (cp_build_addr_expr_1): Use tree_strip_any_location_wrapper
for the address of main pedwarn.

/testsuite
2019-12-03  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/diagnostic/inconsistent-deduction-1.C: New.
* g++.dg/diagnostic/returning-a-value-1.C: Likewise.
* g++.dg/cpp0x/decltype3.C: Check location(s) too.
* g++.dg/cpp0x/decltype4.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-deduce-ext-neg.C: Likewise.
* g++.dg/cpp2a/consteval13.C: Likewise.
* g++.dg/expr/pmf-1.C: Likewise.
* g++.dg/other/ptrmem2.C: Likewise.
* g++.dg/template/ptrmem17.C: Likewise.
* g++.old-deja/g++.bugs/900213_03.C: Likewise.
* g++.old-deja/g++.other/pmf7.C: Likewise.
* g++.old-deja/g++.other/ptrmem7.C: Likewise.

* g++.dg/diagnostic/main2.C: New.

From-SVN: r278947

4 years agoipa-fnsummary.c: Include tree-into-ssa.h.
Jan Hubicka [Tue, 3 Dec 2019 20:29:35 +0000 (21:29 +0100)]
ipa-fnsummary.c: Include tree-into-ssa.h.

* ipa-fnsummary.c: Include tree-into-ssa.h.
(compute_fn_summary): Call update_ssa.

From-SVN: r278946

4 years agore PR c++/91369 (Implement P0784R7: constexpr new)
Jakub Jelinek [Tue, 3 Dec 2019 19:27:47 +0000 (20:27 +0100)]
re PR c++/91369 (Implement P0784R7: constexpr new)

PR c++/91369
* constexpr.c (struct constexpr_global_ctx): Add cleanups member,
initialize it in the ctor.
(cxx_eval_constant_expression) <case TARGET_EXPR>: If TARGET_EXPR_SLOT
is already in the values hash_map, don't evaluate it again.  Put
TARGET_EXPR_SLOT into hash_map even if not lval, and push it into
save_exprs too.  If there is TARGET_EXPR_CLEANUP and not
CLEANUP_EH_ONLY, push the cleanup to cleanups vector.
<case CLEANUP_POINT_EXPR>: Save outer cleanups, set cleanups to
local auto_vec, after evaluating the body evaluate cleanups and
restore previous cleanups.
<case TRY_CATCH_EXPR>: Don't crash if the first operand is NULL_TREE.
(cxx_eval_outermost_constant_expr): Set cleanups to local auto_vec,
after evaluating the expression evaluate cleanups.

* g++.dg/cpp2a/constexpr-new8.C: New test.

From-SVN: r278945

4 years agoClear calls_comdat_local when comdat group is dissolved
Jan Hubicka [Tue, 3 Dec 2019 18:24:00 +0000 (19:24 +0100)]
Clear calls_comdat_local when comdat group is dissolved

while looking into Firefox inlining dumps I noticed that we often do not
inline because we think function calls comdat local while the comdat group
itself has been dissolved.

* cgraph.c (cgraph_node::verify_node): Check that calls_comdat_local
is set only for symbol in comdat group.
* symtab.c (symtab_node::dissolve_same_comdat_group_1): Clear it.

From-SVN: r278944

4 years agoDo not update SSA in lto-stremaer-in
Jan Hubicka [Tue, 3 Dec 2019 18:15:53 +0000 (19:15 +0100)]
Do not update SSA in lto-stremaer-in

* cgraph.c: Include tree-into-ssa.h
(cgraph_node::get_body): Call update_ssa.
* cgraphunit.c (cgraph_node::expand): Likewise.
* lto-streamer-in.c (input_function): Do not call update_ssa.

From-SVN: r278943

4 years agoDon't install unnecessary ARRAY_REF element sizes
Richard Sandiford [Tue, 3 Dec 2019 18:06:40 +0000 (18:06 +0000)]
Don't install unnecessary ARRAY_REF element sizes

Even EXACT_DIV_EXPR doesn't distribute across addition for wrapping
types, so in general we can't fold EXACT_DIV_EXPRs of POLY_INT_CSTs
at compile time.  This was causing an ICE when trying to gimplify the
element size field in an ARRAY_REF.

If the result of that EXACT_DIV_EXPR is an invariant, we don't bother
recording it in the ARRAY_REF and simply read the element size from the
element type.  This avoids the overhead of doing:

      /* ??? tree_ssa_useless_type_conversion will eliminate casts to
 sizetype from another type of the same width and signedness.  */
      if (TREE_TYPE (aligned_size) != sizetype)
aligned_size = fold_convert_loc (loc, sizetype, aligned_size);
      return size_binop_loc (loc, MULT_EXPR, aligned_size,
     size_int (TYPE_ALIGN_UNIT (elmt_type)));

each time array_ref_element_size is called.

So rather than read array_ref_element_size, do some arithmetic on it,
and only then check whether the result is an invariant, we might as
well check whether the element size is an invariant to start with.
We're then directly testing whether array_ref_element_size gives
a reusable value.

For consistency, the patch makes the same change for the offset field
in a COMPONENT_REF, although I don't think that can trigger yet.

2019-12-03  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* gimplify.c (gimplify_compound_lval): Don't gimplify and install
an array element size if array_element_size is already an invariant.
Similarly don't gimplify and install a field offset if
component_ref_field_offset is already an invariant.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general-c/struct_1.c: New test.

From-SVN: r278942

4 years agoMark constant-sized objects as addressable if they have poly-int accesses
Richard Sandiford [Tue, 3 Dec 2019 18:06:24 +0000 (18:06 +0000)]
Mark constant-sized objects as addressable if they have poly-int accesses

If SVE code is written for a specific vector length, it might load from
or store to fixed-sized objects.  This needs to work even without
-msve-vector-bits=N (which should never be needed for correctness).

There's no way of handling a direct poly-int sized reference to a
fixed-size register; it would have to go via memory.  And in that
case it's more efficient to mark the fixed-size object as
addressable from the outset, like we do for array references
with non-constant indices.

2019-12-03  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* cfgexpand.c (discover_nonconstant_array_refs_r): If an access
with POLY_INT_CST size is made to a fixed-size object, force the
object to live in memory.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/deref_1.c: New test.

From-SVN: r278941

4 years agoAdd missing amdgcn vcondu patterns
Andrew Stubbs [Tue, 3 Dec 2019 16:20:29 +0000 (16:20 +0000)]
Add missing amdgcn vcondu patterns

2019-12-03  Andrew Stubbs  <ams@codesourcery.com>

gcc/
* config/gcn/gcn-valu.md: Change "vcondu" patterns to use VEC_1REG_MODE
for the data mode.

From-SVN: r278940

4 years agoPR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
Marek Polacek [Tue, 3 Dec 2019 15:59:40 +0000 (15:59 +0000)]
PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.

This patch implements C++20 P0960R3: Parenthesized initialization of aggregates
(<wg21.link/p0960>; see R0 for more background info).  Essentially, if you have
an aggregate, you can now initialize it by (x, y), similarly to {x, y}.  E.g.

  struct A {
    int x, y;
    // no A(int, int) ctor (see paren-init14.C for = delete; case)
  };
  A a(1, 2);

The difference between ()-init and {}-init is that narrowing conversions are
permitted, designators are not permitted, a temporary object bound to
a reference does not have its lifetime extended, and there is no brace elision.
Further, things like

  int a[](1, 2, 3); // will deduce the array size
  const A& r(1, 2.3, 3); // narrowing is OK
  int (&&rr)[](1, 2, 3);
  int b[3](1, 2); // b[2] will be value-initialized

now work as expected.  Note that

  char f[]("fluff");

has always worked and this patch keeps it that way.  Also note that A a((1, 2))
is not the same as A a{{1,2}}; the inner (1, 2) remains a COMPOUND_EXPR.

The approach I took was to handle (1, 2) similarly to {1, 2} -- conjure up
a CONSTRUCTOR, and introduce LOOKUP_AGGREGATE_PAREN_INIT to distinguish
between the two.  This kind of initialization is only supported in C++20;
I've made no attempt to support it in earlier standards, like we don't
support CTAD pre-C++17, for instance.

* c-cppbuiltin.c (c_cpp_builtins): Predefine
__cpp_aggregate_paren_init=201902 for -std=c++2a.

* call.c (build_new_method_call_1): Handle parenthesized initialization
of aggregates by building up a CONSTRUCTOR.
(extend_ref_init_temps): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
* cp-tree.h (CONSTRUCTOR_IS_PAREN_INIT, LOOKUP_AGGREGATE_PAREN_INIT):
Define.
* decl.c (grok_reference_init): Handle aggregate initialization from
a parenthesized list of values.
(reshape_init): Do nothing for CONSTRUCTOR_IS_PAREN_INIT.
(check_initializer): Handle initialization of an array from a
parenthesized list of values.  Use NULL_TREE instead of NULL.
* tree.c (build_cplus_new): Handle BRACE_ENCLOSED_INITIALIZER_P.
* typeck2.c (digest_init_r): Set LOOKUP_AGGREGATE_PAREN_INIT if it
receives a CONSTRUCTOR with CONSTRUCTOR_IS_PAREN_INIT set.  Allow
narrowing when LOOKUP_AGGREGATE_PAREN_INIT.
(massage_init_elt): Don't lose LOOKUP_AGGREGATE_PAREN_INIT when passing
flags to digest_init_r.

* g++.dg/cpp0x/constexpr-99.C: Only expect an error in C++17 and
lesser.
* g++.dg/cpp0x/explicit7.C: Likewise.
* g++.dg/cpp0x/initlist12.C: Adjust dg-error.
* g++.dg/cpp0x/pr31437.C: Likewise.
* g++.dg/cpp2a/feat-cxx2a.C: Add __cpp_aggregate_paren_init test.
* g++.dg/cpp2a/paren-init1.C: New test.
* g++.dg/cpp2a/paren-init10.C: New test.
* g++.dg/cpp2a/paren-init11.C: New test.
* g++.dg/cpp2a/paren-init12.C: New test.
* g++.dg/cpp2a/paren-init13.C: New test.
* g++.dg/cpp2a/paren-init14.C: New test.
* g++.dg/cpp2a/paren-init15.C: New test.
* g++.dg/cpp2a/paren-init16.C: New test.
* g++.dg/cpp2a/paren-init17.C: New test.
* g++.dg/cpp2a/paren-init18.C: New test.
* g++.dg/cpp2a/paren-init19.C: New test.
* g++.dg/cpp2a/paren-init2.C: New test.
* g++.dg/cpp2a/paren-init3.C: New test.
* g++.dg/cpp2a/paren-init4.C: New test.
* g++.dg/cpp2a/paren-init5.C: New test.
* g++.dg/cpp2a/paren-init6.C: New test.
* g++.dg/cpp2a/paren-init7.C: New test.
* g++.dg/cpp2a/paren-init8.C: New test.
* g++.dg/cpp2a/paren-init9.C: New test.
* g++.dg/ext/desig10.C: Adjust dg-error.
* g++.dg/template/crash107.C: Likewise.
* g++.dg/template/crash95.C: Likewise.
* g++.old-deja/g++.jason/crash3.C: Likewise.
* g++.old-deja/g++.law/ctors11.C: Likewise.
* g++.old-deja/g++.law/ctors9.C: Likewise.
* g++.old-deja/g++.mike/net22.C: Likewise.
* g++.old-deja/g++.niklas/t128.C: Likewise.

From-SVN: r278939

4 years agore PR target/92758 (r278833 breaks gcc.target/powerpc/fold-vec-splat-floatdouble.c)
Richard Biener [Tue, 3 Dec 2019 14:47:24 +0000 (14:47 +0000)]
re PR target/92758 (r278833 breaks gcc.target/powerpc/fold-vec-splat-floatdouble.c)

2019-12-03  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92758
* tree-ssa-forwprop.c (simplify_vector_constructor): Restore
operation on uniform vectors.

From-SVN: r278938

4 years agoValidate acc_device_t uses
Frederik Harwath [Tue, 3 Dec 2019 14:38:54 +0000 (14:38 +0000)]
Validate acc_device_t uses

Check that function arguments of type acc_device_t
are valid enumeration values in all publicly visible
functions from oacc-init.c.

2019-12-03  Frederik Harwath  <frederik@codesourcery.com>

libgomp/
* oacc-init.c (acc_known_device_type): Add function.
(unknown_device_type_error): Add function.
  (name_of_acc_device_t): Change to call unknown_device_type_error
on unknown type.
(resolve_device): Use acc_known_device_type.
  (acc_init): Fail if acc_device_t argument is not valid.
  (acc_shutdown): Likewise.
  (acc_get_num_devices): Likewise.
  (acc_set_device_type): Likewise.
(acc_get_device_num): Likewise.
(acc_set_device_num): Likewise.
  (acc_on_device): Add comment that argument validity is not checked.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
From-SVN: r278937

4 years agoEnable OpenACC GCN testing.
Andrew Stubbs [Tue, 3 Dec 2019 12:53:53 +0000 (12:53 +0000)]
Enable OpenACC GCN testing.

2019-12-03  Andrew Stubbs  <ams@codesourcery.com>

libgomp/
* testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type):
Recognize amdgcn.
(check_effective_target_openacc_amdgcn_accel_present): New proc.
(check_effective_target_openacc_amdgcn_accel_selected): New proc.
* testsuite/libgomp.oacc-c++/c++.exp: Add support for amdgcn.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

From-SVN: r278935

4 years agore PR tree-optimization/92645 (Hand written vector code is 450 times slower when...
Richard Biener [Tue, 3 Dec 2019 11:59:13 +0000 (11:59 +0000)]
re PR tree-optimization/92645 (Hand written vector code is 450 times slower when compiled with GCC compared to Clang)

2019-12-03  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92645
* gimple-fold.c (gimple_fold_builtin_memory_op): Fold memcpy
from or to a properly aligned register variable.

* gcc.target/i386/pr92645-5.c: New testcase.

From-SVN: r278934

4 years agoMakefile.in (SOURCES): Add doc/lto-dump.1.
Matthias Klose [Tue, 3 Dec 2019 11:30:34 +0000 (11:30 +0000)]
Makefile.in (SOURCES): Add doc/lto-dump.1.

2019-12-03  Matthias Klose  <doko@ubuntu.com>

        * Makefile.in (SOURCES): Add doc/lto-dump.1.
        (install-man): Add $(LTO_DUMP_INSTALL_NAME)$(man1ext).
        ($(LTO_DUMP_INSTALL_NAME)$(man1ext): New.

From-SVN: r278933

4 years agomusl: Fix invalid tls model in libgomp and libitm PR91938
Szabolcs Nagy [Tue, 3 Dec 2019 11:13:38 +0000 (11:13 +0000)]
musl: Fix invalid tls model in libgomp and libitm PR91938

Musl does not support initial-exec tls in dynamically loaded shared
libraries.

libgomp/ChangeLog:

2019-12-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>

PR libgomp/91938
* configure.tgt: Avoid IE tls on *-*-musl*.

libitm/ChangeLog:

2019-12-03  Szabolcs Nagy  <szabolcs.nagy@arm.com>

PR libgomp/91938
* configure.tgt: Avoid IE tls on *-*-musl*.

From-SVN: r278932

4 years agore PR tree-optimization/92751 (VN partial def support confused about clobbers)
Richard Biener [Tue, 3 Dec 2019 10:46:52 +0000 (10:46 +0000)]
re PR tree-optimization/92751 (VN partial def support confused about clobbers)

2019-12-03  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92751
* tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): Fail
when a clobber ends up in the partial-def vector.
(vn_reference_lookup_3): Let clobbers be handled by the
assignment from CTOR handling.

* g++.dg/tree-ssa/pr92751.C: New testcase.

From-SVN: r278931

4 years agoutils.c (potential_alignment_gap): Delete.
Eric Botcazou [Tue, 3 Dec 2019 10:23:06 +0000 (10:23 +0000)]
utils.c (potential_alignment_gap): Delete.

* gcc-interface/utils.c (potential_alignment_gap): Delete.
(rest_of_record_type_compilation): Do not call above function.  Use
the alignment of the field instead of that of its type, if need be.
When the original field has variable size, always lower the alignment
of the pointer type.  Reset the bit-field status of the new field if
it does not encode a bit-field.

From-SVN: r278930

4 years agoutils.c (fold_convert_size): New function.
Eric Botcazou [Tue, 3 Dec 2019 10:12:17 +0000 (10:12 +0000)]
utils.c (fold_convert_size): New function.

* gcc-interface/utils.c (fold_convert_size): New function.
(fold_bit_position): Invoke it to do further folding.

From-SVN: r278929

4 years agoXFAIL loop_versioning_6.f90 for ! lp64
Richard Sandiford [Tue, 3 Dec 2019 10:11:58 +0000 (10:11 +0000)]
XFAIL loop_versioning_6.f90 for ! lp64

2019-12-03  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
* gfortran.dg/loop_versioning_6.f90: XFAIL the scans for ! lp64.

From-SVN: r278928

4 years agodecl.c (gnat_to_gnu_subprog_type): With the Copy-In/ Copy-Out mechanism...
Eric Botcazou [Tue, 3 Dec 2019 10:06:15 +0000 (10:06 +0000)]
decl.c (gnat_to_gnu_subprog_type): With the Copy-In/ Copy-Out mechanism...

* gcc-interface/decl.c (gnat_to_gnu_subprog_type): With the Copy-In/
Copy-Out mechanism, do not promote the mode of the return type to an
integral mode if it contains a field on a non-integral type and even
demote it for 64-bit targets.

From-SVN: r278927

4 years agolibstdc++: Fix copyright date on new test header
Jonathan Wakely [Tue, 3 Dec 2019 09:51:49 +0000 (09:51 +0000)]
libstdc++: Fix copyright date on new test header

The slow_clock type was introduced to the testsuite in 2018 in the
testsuite/30_threads/condition_variable/members/2.cc test, so the new
header should have that date.

* testsuite/util/slow_clock.h: Fix copyright date.

From-SVN: r278926

4 years agore PR tree-optimization/92734 (Missing match.pd simplification done by fold_binary_lo...
Jakub Jelinek [Tue, 3 Dec 2019 09:20:43 +0000 (10:20 +0100)]
re PR tree-optimization/92734 (Missing match.pd simplification done by fold_binary_loc on generic)

PR tree-optimization/92734
* match.pd ((CST1 - A) +- CST2 -> CST3 - A,
CST1 - (CST2 - A) -> CST3 + A): Handle nop casts around
inner subtraction.

* gcc.dg/tree-ssa/pr92734.c: New test.

From-SVN: r278925

4 years agore PR target/92744 (error: insn does not satisfy its constraints since r278439)
Uros Bizjak [Tue, 3 Dec 2019 08:23:06 +0000 (09:23 +0100)]
re PR target/92744 (error: insn does not satisfy its constraints since r278439)

PR target/92744
* config/i386/i386.md (peephole2 for *swap<mode>): Use
general_reg_operand predicates instead of register_operand.

* g++.dg/dfp/pr92744.C: New test.

From-SVN: r278924

4 years agore PR c++/92732 (Bit-field of scoped enumeration type cannot be initialized)
Jakub Jelinek [Tue, 3 Dec 2019 08:21:29 +0000 (09:21 +0100)]
re PR c++/92732 (Bit-field of scoped enumeration type cannot be initialized)

PR c++/92732
* typeck2.c (digest_nsdmi_init): For bitfields, use
DECL_BIT_FIELD_TYPE instead of TREE_TYPE.

* g++.dg/cpp2a/bitfield3.C: Don't expect narrowing conversion
warnings.
* g++.dg/cpp2a/bitfield4.C: New test.

From-SVN: r278923

4 years agore PR c++/92705 (ICE: Segmentation fault (in build_new_op_1))
Jason Merrill [Tue, 3 Dec 2019 08:20:18 +0000 (09:20 +0100)]
re PR c++/92705 (ICE: Segmentation fault (in build_new_op_1))

PR c++/92705
* call.c (strip_standard_conversion): New function.
(build_new_op_1): Use it for user_conv_p.
(compare_ics): Likewise.
(source_type): Likewise.

* g++.dg/conversion/ambig4.C: New test.

From-SVN: r278922

4 years agore PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)
Jakub Jelinek [Tue, 3 Dec 2019 08:19:04 +0000 (09:19 +0100)]
re PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)

PR c++/92695
* constexpr.c (cxx_bind_parameters_in_call): For virtual calls,
adjust the first argument to point to the derived object rather
than its base.

* g++.dg/cpp2a/constexpr-virtual14.C: New test.

From-SVN: r278921

4 years agore PR tree-optimization/92645 (Hand written vector code is 450 times slower when...
Richard Biener [Tue, 3 Dec 2019 07:36:14 +0000 (07:36 +0000)]
re PR tree-optimization/92645 (Hand written vector code is 450 times slower when compiled with GCC compared to Clang)

2019-12-03  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92645
* tree-ssa.c (execute_update_addresses_taken): Avoid representing
a full def of a vector via a BIT_INSERT_EXPR.

From-SVN: r278920

4 years agoFix missing space of r278890
Luo Xiong Hu [Tue, 3 Dec 2019 01:46:16 +0000 (01:46 +0000)]
Fix missing space of r278890

gcc/testsuite/ChangeLog:

2019-12-03  Luo Xiong Hu  <luoxhu@linux.ibm.com>

* gcc.target/powerpc/pr72804.c: Fix missing space.

From-SVN: r278918

4 years agoDiagnose use of [*] in old-style parameter definitions (PR c/88704).
Joseph Myers [Tue, 3 Dec 2019 01:27:43 +0000 (01:27 +0000)]
Diagnose use of [*] in old-style parameter definitions (PR c/88704).

GCC wrongly accepts [*] in old-style parameter definitions because
because parm_flag is set on the scope used for those definitions and,
unlike the case of a prototype in a function definition, there is no
subsequent check to disallow this invalid usage.  This patch adds such
a check.  (At this point we don't have location information for the
[*], so the diagnostic location isn't ideal.)

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

PR c/88704
gcc/c:
* c-decl.c (store_parm_decls_oldstyle): Diagnose use of [*] in
old-style parameter definitions.

gcc/testsuite:
* gcc.dg/vla-25.c: New test.

From-SVN: r278917

4 years agoinline-crossmodule-1_0.C: Use -fdump-ipa-inline-details instead of -fdump-ipa-inline.
Jakub Jelinek [Tue, 3 Dec 2019 00:33:27 +0000 (01:33 +0100)]
inline-crossmodule-1_0.C: Use -fdump-ipa-inline-details instead of -fdump-ipa-inline.

* g++.dg/lto/inline-crossmodule-1_0.C: Use -fdump-ipa-inline-details
instead of -fdump-ipa-inline.  Use "inline" instead of "inlined" as
last argument to scan-wpa-ipa-dump-times, use \\\( and \\\) instead of
( and ) in the regex.

From-SVN: r278916

4 years agoDaily bump.
GCC Administrator [Tue, 3 Dec 2019 00:16:19 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278915

4 years agore PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)
Jakub Jelinek [Mon, 2 Dec 2019 21:33:06 +0000 (22:33 +0100)]
re PR c++/92695 (P1064R0 - virtual constexpr fails if object taken from array)

PR c++/92695
* constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Use
STRIP_NOPS before checking for ADDR_EXPR.

* g++.dg/cpp2a/constexpr-virtual15.C: New test.

From-SVN: r278912

4 years agoMake rs6000_invalid_builtin static.
Bill Schmidt [Mon, 2 Dec 2019 18:46:45 +0000 (18:46 +0000)]
Make rs6000_invalid_builtin static.

2019-12-02  Bill Schmidt  <wschmidt@linux.ibm.com>

* config/rs6000/rs6000-call.c (rs6000_invalid_builtin): Make
static.
* config/rs6000/rs6000-internal.h (rs6000_invalid_builtin): Remove
decl.

From-SVN: r278911

4 years agoTighten check for vector types in fold_convertible_p (PR 92741)
Richard Sandiford [Mon, 2 Dec 2019 17:51:08 +0000 (17:51 +0000)]
Tighten check for vector types in fold_convertible_p (PR 92741)

In this PR, IPA-CP was misled into using NOP_EXPR rather than
VIEW_CONVERT_EXPR to reinterpret a vector of 4 shorts as a vector
of 2 ints.  This tripped the tree-cfg.c assert I'd added in r278245.

2019-12-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR middle-end/92741
* fold-const.c (fold_convertible_p): Check vector types more
thoroughly.

gcc/testsuite/
PR middle-end/92741
* gcc.dg/pr92741.c: New test.

From-SVN: r278910

4 years ago[AArch64] Catch attempts to use SVE types when SVE is disabled
Richard Sandiford [Mon, 2 Dec 2019 17:48:08 +0000 (17:48 +0000)]
[AArch64] Catch attempts to use SVE types when SVE is disabled

This patch reports an error if code tries to use variable-length
SVE types when SVE is disabled.  We already report a similar error
for definitions or uses of SVE functions when SVE is disabled.

2019-12-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64.c (aarch64_report_sve_required): New function.
(aarch64_expand_mov_immediate): Use it when attempting to measure
the length of an SVE vector.
(aarch64_mov_operand_p): Only allow SVE CNT immediates when
SVE is enabled.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/nosve_4.c: New test.
* gcc.target/aarch64/sve/acle/general/nosve_5.c: Likewise.
* gcc.target/aarch64/sve/pcs/nosve_4.c: Expected a second error
for the copy.
* gcc.target/aarch64/sve/pcs/nosve_5.c: Likewise.
* gcc.target/aarch64/sve/pcs/nosve_6.c: Likewise.

From-SVN: r278909

4 years ago[AArch64] Run general SVE ACLE tests for C
Richard Sandiford [Mon, 2 Dec 2019 17:44:30 +0000 (17:44 +0000)]
[AArch64] Run general SVE ACLE tests for C

Now that the C frontend can cope with POLY_INT_CST-length initialisers,
we can make aarch64-sve-acle.exp run the full set of tests.  This will
introduce new failures for -mabi=ilp32; I'll make the testsuite ILP32
clean separately.

2019-12-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
* gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp: Run the
general/* tests too.

From-SVN: r278908

4 years ago[AArch64] Add a couple of SVE ACLE comparison folds
Richard Sandiford [Mon, 2 Dec 2019 17:39:06 +0000 (17:39 +0000)]
[AArch64] Add a couple of SVE ACLE comparison folds

When writing vector-length specific SVE code, it's useful to be able
to store an svbool_t predicate in a GNU vector of unsigned chars.
This patch makes sure that there is no overhead when converting
to that form and then immediately reading it back again.

2019-12-02  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64-sve-builtins.h
(gimple_folder::force_vector): Declare.
* config/aarch64/aarch64-sve-builtins.cc
(gimple_folder::force_vector): New function.
* config/aarch64/aarch64-sve-builtins-base.cc
(svcmp_impl::fold): Likewise.
(svdup_impl::fold): Handle svdup_z too.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/eqne_dup_1.c: New test.
* gcc.target/aarch64/sve/acle/asm/dup_f16.c (dup_0_f16_z): Expect
the call to be folded to zero.
* gcc.target/aarch64/sve/acle/asm/dup_f32.c (dup_0_f32_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_f64.c (dup_0_f64_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_s8.c (dup_0_s8_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_s16.c (dup_0_s16_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_s32.c (dup_0_s32_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_s64.c (dup_0_s64_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_u8.c (dup_0_u8_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_u16.c (dup_0_u16_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_u32.c (dup_0_u32_z): Likewise.
* gcc.target/aarch64/sve/acle/asm/dup_u64.c (dup_0_u64_z): Likewise.

From-SVN: r278907

4 years ago[Committed][Arm][testsuite] Fix failure for arm-fp16-ops-*.C
Sudakshina Das [Mon, 2 Dec 2019 17:21:35 +0000 (17:21 +0000)]
[Committed][Arm][testsuite] Fix failure for arm-fp16-ops-*.C

Since r275022 which deprecates some uses of volatile, all arm-fp16-ops-*.C
were failing with warnings of deprecated valatile uses on arm-none-eabi and
arm-none-linux-gnueabihf. This patch removes the volatile declarations from
the header. Since none of the tests are run with any high optimization levels,
this should change should not prevent the real function of the tests.

gcc/testsuite/ChangeLog:

2019-12-02  Sudakshina Das  <sudi.das@arm.com>

* g++.dg/ext/arm-fp16/arm-fp16-ops.h: Remove volatile keyword.

From-SVN: r278905

4 years agolibstdc++: Fix try_lock_until and try_lock_shared_until on arbitrary clock
Mike Crowe [Mon, 2 Dec 2019 16:23:14 +0000 (16:23 +0000)]
libstdc++: Fix try_lock_until and try_lock_shared_until on arbitrary clock

This is the equivalent to PR libstdc++/91906, but for shared_mutex.

A non-standard clock may tick more slowly than std::chrono::steady_clock.
This means that we risk returning false early when the specified timeout
may not have expired. This can be avoided by looping until the timeout time
as reported by the non-standard clock has been reached.

Unfortunately, we have no way to tell whether the non-standard clock ticks
more quickly that std::chrono::steady_clock. If it does then we risk
returning later than would be expected, but that is unavoidable without
waking up periodically to check, which would be rather too expensive.

François Dumont pointed out[1] a flaw in an earlier version of this patch
that revealed a hole in the test coverage, so I've added a new test that
try_lock_until acts as try_lock if the timeout has already expired.

[1] https://gcc.gnu.org/ml/libstdc++/2019-10/msg00021.html

2019-12-02  Mike Crowe  <mac@mcrowe.com>

Fix try_lock_until and try_lock_shared_until on arbitrary clock
* include/std/shared_mutex (shared_timed_mutex::try_lock_until)
(shared_timed_mutex::try_lock_shared_until): Loop until the absolute
timeout time is reached as measured against the appropriate clock.
* testsuite/30_threads/shared_timed_mutex/try_lock_until/1.cc: New
file. Test try_lock_until and try_lock_shared_until timeouts against
various clocks.
* testsuite/30_threads/shared_timed_mutex/try_lock_until/1.cc: New
file. Test try_lock_until and try_lock_shared_until timeouts against
various clocks.

From-SVN: r278904

4 years agolibstdc++: Add full steady_clock support to shared_timed_mutex
Mike Crowe [Mon, 2 Dec 2019 16:23:10 +0000 (16:23 +0000)]
libstdc++: Add full steady_clock support to shared_timed_mutex

The pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock functions
were added to glibc in v2.30. They have also been added to Android
Bionic. If these functions are available in the C library then they can
be used to implement shared_timed_mutex::try_lock_until,
shared_timed_mutex::try_lock_for,
shared_timed_mutex::try_lock_shared_until and
shared_timed_mutex::try_lock_shared_for so that they are no longer
unaffected by the system clock being warped. (This is the shared_mutex
equivalent of PR libstdc++/78237 for mutex.)

If the new functions are available then steady_clock is deemed to be the
"best" clock available which means that it is used for the relative
try_lock_for calls and absolute try_lock_until calls using steady_clock
and user-defined clocks. It's not possible to have
_GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK defined without
_GLIBCXX_USE_PTHREAD_RWLOCK_T, so the requirement that the clock be the
same as condition_variable is maintained. Calls explicitly using
system_clock (aka high_resolution_clock) continue to use CLOCK_REALTIME
via the old pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock
functions.

If the new functions are not available then system_clock is deemed to be
the "best" clock available which means that the previous suboptimal
behaviour remains.

Additionally, the user-defined clock used with
shared_timed_mutex::try_lock_for and shared_mutex::try_lock_shared_for
may have higher precision than __clock_t. We may need to round the
duration up to ensure that the timeout is long enough. (See
__timed_mutex_impl::_M_try_lock_for)

2019-12-02  Mike Crowe  <mac@mcrowe.com>

Add full steady_clock support to shared_timed_mutex
* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_RWLOCK_CLOCKLOCK): Define
to check for the presence of both pthread_rwlock_clockrdlock and
pthread_rwlock_clockwrlock.
* config.h.in: Regenerate.
* configure.ac: Call GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK.
* configure: Regenerate.
* include/std/shared_mutex (shared_timed_mutex): Define __clock_t as
the best clock to use for relative waits.
(shared_timed_mutex::try_lock_for) Round up wait duration if necessary.
(shared_timed_mutex::try_lock_shared_for): Likewise.
(shared_timed_mutex::try_lock_until): Use existing try_lock_until
implementation for system_clock (which matches __clock_t when
_GLIBCCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK is not defined). Add new
overload for steady_clock that uses pthread_rwlock_clockwrlock if it
is available. Simplify overload for non-standard clock to just call
try_lock_for with a relative timeout.
(shared_timed_mutex::try_lock_shared_until): Likewise.

From-SVN: r278903

4 years agolibstdc++: Fix timed_mutex::try_lock_until on arbitrary clock (PR 91906)
Mike Crowe [Mon, 2 Dec 2019 16:23:06 +0000 (16:23 +0000)]
libstdc++: Fix timed_mutex::try_lock_until on arbitrary clock (PR 91906)

A non-standard clock may tick more slowly than
std::chrono::steady_clock.  This means that we risk returning false
early when the specified timeout may not have expired. This can be
avoided by looping until the timeout time as reported by the
non-standard clock has been reached.

Unfortunately, we have no way to tell whether the non-standard clock
ticks more quickly that std::chrono::steady_clock. If it does then we
risk returning later than would be expected, but that is unavoidable and
permitted by the standard.

2019-12-02  Mike Crowe  <mac@mcrowe.com>

PR libstdc++/91906 Fix timed_mutex::try_lock_until on arbitrary clock
* include/std/mutex (__timed_mutex_impl::_M_try_lock_until): Loop
until the absolute timeout time is reached as measured against the
appropriate clock.
* testsuite/util/slow_clock.h: New file. Move implementation of
slow_clock test class.
* testsuite/30_threads/condition_variable/members/2.cc: Include
slow_clock from header.
* testsuite/30_threads/shared_timed_mutex/try_lock/3.cc: Convert
existing test to templated function so that it can be called with
both system_clock and steady_clock.
* testsuite/30_threads/timed_mutex/try_lock_until/3.cc: Also run test
using slow_clock to test above fix.
* testsuite/30_threads/recursive_timed_mutex/try_lock_until/3.cc:
Likewise.
* testsuite/30_threads/recursive_timed_mutex/try_lock_until/4.cc: Add
new test that try_lock_until behaves as try_lock if the timeout has
already expired or exactly matches the current time.

From-SVN: r278902

4 years agolibstdc++: PR 78237 Add full steady_clock support to timed_mutex
Mike Crowe [Mon, 2 Dec 2019 16:23:01 +0000 (16:23 +0000)]
libstdc++: PR 78237 Add full steady_clock support to timed_mutex

The pthread_mutex_clocklock function is available in glibc since the
2.30 release. If this function is available in the C library it can be
used to fix PR libstdc++/78237 by supporting steady_clock properly with
timed_mutex.

This means that code using timed_mutex::try_lock_for or
timed_mutex::wait_until with steady_clock is no longer subject to timing
out early or potentially waiting for much longer if the system clock is
warped at an inopportune moment.

If pthread_mutex_clocklock is available then steady_clock is deemed to
be the "best" clock available which means that it is used for the
relative try_lock_for calls and absolute try_lock_until calls using
steady_clock and user-defined clocks. Calls explicitly using
system_clock (aka high_resolution_clock) continue to use CLOCK_REALTIME
via __gthread_cond_timedwait.

If pthread_mutex_clocklock is not available then system_clock is deemed
to be the "best" clock available which means that the previous
suboptimal behaviour remains.

2019-12-02  Mike Crowe  <mac@mcrowe.com>

PR libstdc++/78237 Add full steady_clock support to timed_mutex
* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK): Define to
detect presence of pthread_mutex_clocklock function.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Call GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK.
* include/std/mutex (__timed_mutex_impl): Remove unnecessary __clock_t.
(__timed_mutex_impl::_M_try_lock_for): Use best clock to turn relative
timeout into absolute timeout.
(__timed_mutex_impl::_M_try_lock_until): Keep existing implementation
for system_clock. Add new implementation for steady_clock that calls
_M_clocklock. Modify overload for user-defined clock to use a relative
wait so that it automatically uses the best clock.
[_GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK] (timed_mutex::_M_clocklock):
New member function.
(recursive_timed_mutex::_M_clocklock): Likewise.

From-SVN: r278901

4 years agolibstdc++: Improve tests for try_lock_until members of mutex types
Mike Crowe [Mon, 2 Dec 2019 16:22:53 +0000 (16:22 +0000)]
libstdc++: Improve tests for try_lock_until members of mutex types

2019-12-02  Mike Crowe  <mac@mcrowe.com>

* testsuite/30_threads/recursive_timed_mutex/try_lock_until/3.cc:
New test. Ensure that timed_mutex::try_lock_until actually times out
after the specified time when using both system_clock and
steady_clock.
* testsuite/30_threads/timed_mutex/try_lock_until/3.cc: New test.
Likewise but for recursive_timed_mutex.
* testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Template
test functions and use them to test both steady_clock and system_clock.
* testsuite/30_threads/unique_lock/locking/4.cc: Likewise. Wrap call
to timed_mutex::try_lock_until in VERIFY macro to check its return
value.

From-SVN: r278900

4 years agoRefactor IPA devirt a bit.
Martin Liska [Mon, 2 Dec 2019 11:18:31 +0000 (12:18 +0100)]
Refactor IPA devirt a bit.

2019-12-02  Martin Liska  <mliska@suse.cz>

* ipa-devirt.c (warn_types_mismatch): Use get_odr_name_for_type
function.
(debug_tree_odr_name): New.
* ipa-utils.h (get_odr_name_for_type): New.
2019-12-02  Martin Liska  <mliska@suse.cz>

* g++.dg/lto/odr-7_0.C: New test.
* g++.dg/lto/odr-7_1.C: New test.

From-SVN: r278898

4 years agoFix dg failure
Jan Hubicka [Mon, 2 Dec 2019 11:11:34 +0000 (12:11 +0100)]
Fix dg failure

* g++.dg/lto/inline-crossmodule-1_0.C: fix template.

From-SVN: r278897

4 years agore PR tree-optimization/92742 (ICE in info_for_reduction, at tree-vect-loop.c:4367)
Richard Biener [Mon, 2 Dec 2019 10:50:45 +0000 (10:50 +0000)]
re PR tree-optimization/92742 (ICE in info_for_reduction, at tree-vect-loop.c:4367)

2019-12-02  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92742
* tree-vect-loop.c (vect_fixup_reduc_chain): Do not
touch the def-type but verify it is consistent with the
original stmts.

* gcc.dg/torture/pr92742.c: New testcase.

From-SVN: r278896

4 years agore PR tree-optimization/92712 (Performance regression with assumed values)
Jakub Jelinek [Mon, 2 Dec 2019 08:51:49 +0000 (09:51 +0100)]
re PR tree-optimization/92712 (Performance regression with assumed values)

PR tree-optimization/92712
* match.pd ((A * B) +- A -> (B +- 1) * A,
A +- (A * B) -> (1 +- B) * A): Allow optimizing signed integers
even when we don't know anything about range of A, but do know
something about range of B and the simplification won't introduce
new UB.

* gcc.dg/tree-ssa/pr92712-1.c: New test.
* gcc.dg/tree-ssa/pr92712-2.c: New test.
* gcc.dg/tree-ssa/pr92712-3.c: New test.
* gfortran.dg/loop_versioning_1.f90: Adjust expected number of
likely to be innermost dimension messages.
* gfortran.dg/loop_versioning_10.f90: Likewise.
* gfortran.dg/loop_versioning_6.f90: Likewise.

From-SVN: r278894

4 years agoEnable recursive function versioning
Feng Xue [Mon, 2 Dec 2019 06:37:30 +0000 (06:37 +0000)]
Enable recursive function versioning

2019-12-02  Feng Xue <fxue@os.amperecomputing.com>

        PR ipa/92133
        * doc/invoke.texi (ipa-cp-max-recursive-depth): Document new option.
        (ipa-cp-min-recursive-probability): Likewise.
        * params.opt (ipa-cp-max-recursive-depth): New.
        (ipa-cp-min-recursive-probability): Likewise.
        * ipa-cp.c (ipcp_lattice<valtype>::add_value): Add two new parameters
        val_p and unlimited.
        (self_recursively_generated_p): New function.
        (get_val_across_arith_op): Likewise.
        (propagate_vals_across_arith_jfunc): Add constant propagation for
        self-recursive function.
        (incorporate_penalties): Do not penalize pure self-recursive function.
        (good_cloning_opportunity_p): Dump node_is_self_scc flag.
        (propagate_constants_topo): Set node_is_self_scc flag for cgraph node.
        (get_info_about_necessary_edges): Relax hotness check for edge to
        self-recursive function.
        * ipa-prop.h (ipa_node_params): Add new field node_is_self_scc.

2019-12-02  Feng Xue  <fxue@os.amperecomputing.com>

        PR ipa/92133
        * gcc.dg/ipa/ipa-clone-2.c: New test.

From-SVN: r278893

4 years agoFix bugs relating to flexibly-sized objects in nios2 backend.
Sandra Loosemore [Mon, 2 Dec 2019 03:52:15 +0000 (22:52 -0500)]
Fix bugs relating to flexibly-sized objects in nios2 backend.

2019-12-01  Sandra Loosemore  <sandra@codesourcery.com>

Fix bugs relating to flexibly-sized objects in nios2 backend.

PR target/92499

gcc/c/
* c-decl.c (flexible_array_type_p): Move to common code.

gcc/
* config/nios2/nios2.c (nios2_in_small_data_p): Do not consider
objects of flexible types to be small if they have internal linkage
or are declared extern.
* config/nios2/nios2.h (ASM_OUTPUT_ALIGNED_LOCAL): Replace with...
(ASM_OUTPUT_ALIGNED_DECL_LOCAL): ...this.  Use targetm.in_small_data_p
instead of the size of the object initializer.
* tree.c (flexible_array_type_p): Move from C front end, and
generalize to handle fields in non-C structures.
* tree.h (flexible_array_type_p): Declare.

gcc/testsuite/
* gcc.target/nios2/pr92499-1.c: New.
* gcc.target/nios2/pr92499-2.c: New.
* gcc.target/nios2/pr92499-3.c: New.

From-SVN: r278891

4 years agoPR92398: Fix testcase failure of pr72804.c
Luo Xiong Hu [Mon, 2 Dec 2019 01:59:26 +0000 (01:59 +0000)]
PR92398: Fix testcase failure of pr72804.c

P9LE generated instruction is not worse than P8LE.
mtvsrdd;xxlnot;stxv vs. not;not;std;std.
It can have longer latency, but latency via memory is not so critical,
and this does save decode and other resources.  It's hard to choose
which is best.  Update the test case to fix failures.

gcc/testsuite/ChangeLog:

2019-12-02  Luo Xiong Hu  <luoxhu@linux.ibm.com>

PR testsuite/92398
* gcc.target/powerpc/pr72804.c: Split the store function to...
* gcc.target/powerpc/pr92398.h: ... this one.  New.
* gcc.target/powerpc/pr92398.p9+.c: New.
* gcc.target/powerpc/pr92398.p9-.c: New.
* lib/target-supports.exp (check_effective_target_p8): New.
(check_effective_target_p9+): New.

From-SVN: r278890

4 years agoDaily bump.
GCC Administrator [Mon, 2 Dec 2019 00:16:12 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r278889

4 years agore PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d and...
Jerry DeLisle [Sun, 1 Dec 2019 22:29:43 +0000 (22:29 +0000)]
re PR libfortran/90374 (Fortran 2018: Support d0.d, e0.d, es0.d, en0.d, g0.d and ew.d e0 edit descriptors for output)

2019-12-01  Jerry DeLisle  <jvdelisle@gcc.ngu.org>

PR fortran/90374
* io/format.c (parse_format_list): Add braces to disambiguate
conditional.

From-SVN: r278886

4 years agoprofile-count.h (profile_count::operator<): Use IPA value for comparsion.
Jan Hubicka [Sun, 1 Dec 2019 15:12:52 +0000 (16:12 +0100)]
profile-count.h (profile_count::operator<): Use IPA value for comparsion.

* profile-count.h (profile_count::operator<): Use IPA value for
comparsion.
(profile_count::operator>): Likewise.
(profile_count::operator<=): Likewise.
(profile_count::operator>=): Likewise.
* predict.c (maybe_hot_count_p): Do not convert to gcov_type.

From-SVN: r278885