gcc.git
6 years agoFix probabilities for jump table (PR tree-optimization/86702).
Martin Liska [Mon, 27 Aug 2018 12:17:54 +0000 (14:17 +0200)]
Fix probabilities for jump table (PR tree-optimization/86702).

2018-08-27  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86702
* tree-switch-conversion.c (jump_table_cluster::emit):
        Make probabilities even for values in jump table
        according to number of cases handled.
(switch_decision_tree::compute_cases_per_edge): Pass
        argument to reset_out_edges_aux function.
(switch_decision_tree::analyze_switch_statement): Likewise.
* tree-switch-conversion.h (switch_decision_tree::reset_out_edges_aux):
        Make it static.

From-SVN: r263877

6 years agoAdd new gswitch related functions into tree-cfg.c.
Martin Liska [Mon, 27 Aug 2018 12:17:19 +0000 (14:17 +0200)]
Add new gswitch related functions into tree-cfg.c.

2018-08-27  Martin Liska  <mliska@suse.cz>

* cfgexpand.c (expand_asm_stmt): Use label_to_block and pass
        cfun argument explicitly.
* gimple-pretty-print.c (dump_gimple_switch): Likewise.
* hsa-gen.c (gen_hsa_insns_for_switch_stmt): Use new
        function gimple_switch_default_bb.
(convert_switch_statements):
(expand_builtins):
* ipa-fnsummary.c (set_switch_stmt_execution_predicate):
* stmt.c (label_to_block_fn): Use label_to_block and pass
        cfun argument explicitly and use gimple_switch_label_bb.
(expand_case): Likewise.
* tree-cfg.c (lower_phi_internal_fn): Use label_to_block and pass
        cfun argument explicitly. Likewise.
(make_edges_bb): Likewise.
(make_cond_expr_edges): Likewise.
(get_cases_for_edge): Likewise.
(make_gimple_switch_edges): Likewise.
(label_to_block_fn): Likewise.
(label_to_block): Likewise.
(make_goto_expr_edges): Likewise.
(make_gimple_asm_edges): Likewise.
(main_block_label): Likewise.
(group_case_labels_stmt): Likewise.
(find_taken_edge_computed_goto): Likewise.
(find_taken_edge_switch_expr): Likewise.
(gimple_verify_flow_info): Likewise.
(gimple_redirect_edge_and_branch): Likewise.
(gimple_switch_label_bb): New function.
(gimple_switch_default_bb): Likewise.
(gimple_switch_edge): Likewise.
(gimple_switch_default_edge): Likewise.
* tree-cfg.h (label_to_block_fn): Remove and replace ...
(label_to_block): ... with this.
(gimple_switch_label_bb): New.
(gimple_switch_default_bb): Likewise.
(gimple_switch_edge): Likewise.
(gimple_switch_default_edge): Likewise.
* tree-cfgcleanup.c (convert_single_case_switch): Use
        new gimple functions and pass new argument to label_to_block.
(cleanup_control_flow_bb):
* tree-eh.c (make_eh_dispatch_edges): Use label_to_block and pass
        cfun argument explicitly.
(make_eh_edges): Likewise.
(redirect_eh_dispatch_edge): Likewise.
(lower_resx): Likewise.
(lower_eh_dispatch): Likewise.
(maybe_remove_unreachable_handlers): Likewise.
(unsplit_eh): Likewise.
(cleanup_empty_eh): Likewise.
(verify_eh_edges): Likewise.
(verify_eh_dispatch_edge): Likewise.
* tree-ssa-dom.c (record_edge_info): Likewise.
* tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
* tree-ssa-threadedge.c (thread_around_empty_blocks): Likewise.
(thread_through_normal_block): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
* tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
* tree-switch-conversion.c (switch_conversion::collect): Use new
        gimple functions.
(switch_conversion::check_final_bb): Likewise.
(switch_conversion::gather_default_values): Pass new argument
        to label_to_block.
(switch_conversion::build_constructors): Likewise.
(switch_decision_tree::compute_cases_per_edge): Use new
        gimple_switch_edge function.
(switch_decision_tree::analyze_switch_statement): Pass new argument
        to label_to_block.
(switch_decision_tree::try_switch_expansion): Use
        gimple_switch_default_edge.
* tree-vrp.c (find_switch_asserts): Pass new argument
        to label_to_block.
* vr-values.c (vr_values::vrp_visit_switch_stmt): Likewise.
(vr_values::simplify_switch_using_ranges): Likewise.

From-SVN: r263876

6 years agocfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.
Richard Biener [Mon, 27 Aug 2018 10:55:53 +0000 (10:55 +0000)]
cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.

2018-08-27  Richard Biener  <rguenther@suse.de>

* cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.
* cfganal.c (rev_post_order_and_mark_dfs_back_seme): New function.

* tree-ssa-sccvn.h (struct vn_pval): New structure.
(struct vn_nary_op_s): Add unwind_to member.  Add
predicated_values flag and put result into a union together
with a linked list of vn_pval.
(struct vn_ssa_aux): Add name member to make maintaining
a map of SSA name to vn_ssa_aux possible.  Remove no longer
needed info, dfsnum, low, visited, on_sccstack, use_processed
and range_info_anti_range_p members.
(run_scc_vn, vn_eliminate, free_scc_vn, vn_valueize): Remove.
(do_rpo_vn, run_rpo_vn, eliminate_with_rpo_vn, free_rpo_vn):
New functions.
(vn_valueize): New global.
(vn_context_bb): Likewise.
(VN_INFO_RANGE_INFO, VN_INFO_ANTI_RANGE_P, VN_INFO_RANGE_TYPE,
VN_INFO_PTR_INFO): Remove.
* tree-ssa-sccvn.c: ... (rewrite)
(pass_fre::execute): For -O2+ initialize loops and run
RPO VN in optimistic mode (iterating).  For -O1 and -Og
run RPO VN in non-optimistic mode.
* params.def (PARAM_SCCVN_MAX_SCC_SIZE): Remove.
(PARAM_RPO_VN_MAX_LOOP_DEPTH): Add.
* doc/invoke.texi (sccvn-max-scc-size): Remove.
(rpo-vn-max-loop-depth): Document.
* tree-ssa-alias.c (walk_non_aliased_vuses): Stop walking
when valuezing the VUSE signals we walked out of the region.
* tree-ssa-pre.c (phi_translate_1): Ignore predicated values.
(phi_translate): Set VN context block to use for availability
lookup.
(compute_avail): Likewise.
(pre_valueize): New function.
(pass_pre::execute): Adjust to the RPO VN API.

* tree-ssa-loop-ivcanon.c: Include tree-ssa-sccvn.h.
(propagate_constants_for_unrolling): Remove.
(tree_unroll_loops_completely): Perform value-numbering
on the unrolled bodies loop parent.

* g++.dg/torture/20180705-1.C: New testcase.
* gcc.dg/tree-ssa/ssa-fre-67.c: Likewise.
* gcc.dg/tree-ssa/ssa-ccp-14.c: Scan FRE dump.
* gcc.dg/tree-ssa/ssa-fre-46.c: Use -O2.
* gcc.dg/tree-ssa/vrp92.c: Disable FRE.
* gcc.dg/pr83666.c: Drop --param=sccvn-max-scc-size option.
* gcc.dg/pr85195.c: Likewise.
* gcc.dg/pr85467.c: Likewise.
* gcc.dg/torture/pr81790.c: Likewise.

* gfortran.dg/reassoc_4.f: Change max-completely-peeled-insns
param to current default.

From-SVN: r263875

6 years agotree-ssa-pre.c (compute_antic): Re-use inverted postorder for partial antic compute.
Richard Biener [Mon, 27 Aug 2018 10:50:45 +0000 (10:50 +0000)]
tree-ssa-pre.c (compute_antic): Re-use inverted postorder for partial antic compute.

2018-08-27  Richard Biener  <rguenther@suse.de>

* tree-ssa-pre.c (compute_antic): Re-use inverted postorder
for partial antic compute.

From-SVN: r263874

6 years agore PR rtl-optimization/87065 (combine causes ICE in trunc_int_for_mode)
Jakub Jelinek [Mon, 27 Aug 2018 08:41:22 +0000 (10:41 +0200)]
re PR rtl-optimization/87065 (combine causes ICE in trunc_int_for_mode)

PR rtl-optimization/87065
* combine.c (simplify_if_then_else): Formatting fix.
(if_then_else_cond): Guard MULT optimization with SCALAR_INT_MODE_P
check.
(known_cond): Don't return const_true_rtx for vector modes.  Use
CONST0_RTX instead of const0_rtx.  Formatting fixes.

* gcc.target/i386/pr87065.c: New test.

From-SVN: r263872

6 years agoDo not read gcda files multiple times (PR gcov-profile/87069).
Martin Liska [Mon, 27 Aug 2018 08:01:54 +0000 (10:01 +0200)]
Do not read gcda files multiple times (PR gcov-profile/87069).

2018-08-27  Martin Liska  <mliska@suse.cz>

        PR gcov-profile/87069
* gcov.c (process_file): Record files already processed
        and warn about a file being processed multiple times.

From-SVN: r263871

6 years agoPrint default options selection for -march,-mcpu and -mtune for aarch64 (PR driver...
Martin Liska [Mon, 27 Aug 2018 08:01:14 +0000 (10:01 +0200)]
Print default options selection for -march,-mcpu and -mtune for aarch64 (PR driver/83193).

2018-08-27  Martin Liska  <mliska@suse.cz>

        PR driver/83193
* config/aarch64/aarch64.c (aarch64_override_options_internal):
        Set default values for x_aarch64_*_string strings.
* config/aarch64/aarch64.opt: Remove --{march,mcpu,mtune}==
        prefix.  For -mabi do not print '=ABI' in help and use
        <option_value> format for -msve-vector-bits and -moverride
        options.

From-SVN: r263870

6 years agoframe-header-opt.c: Include "backend.h" rather than "cfg.h"
Jeff Law [Mon, 27 Aug 2018 02:54:32 +0000 (20:54 -0600)]
frame-header-opt.c: Include "backend.h" rather than "cfg.h"

* config/mips/frame-header-opt.c: Include "backend.h" rather than
"cfg.h"

From-SVN: r263869

6 years agoDaily bump.
GCC Administrator [Mon, 27 Aug 2018 00:17:00 +0000 (00:17 +0000)]
Daily bump.

From-SVN: r263867

6 years agoPR c++/87029, Implement -Wredundant-move.
Marek Polacek [Sun, 26 Aug 2018 16:45:51 +0000 (16:45 +0000)]
PR c++/87029, Implement -Wredundant-move.

* c.opt (Wredundant-move): New option.

* typeck.c (treat_lvalue_as_rvalue_p): New function.
(maybe_warn_pessimizing_move): Call convert_from_reference.
Warn about redundant moves.

* doc/invoke.texi: Document -Wredundant-move.

* g++.dg/cpp0x/Wredundant-move1.C: New test.
* g++.dg/cpp0x/Wredundant-move2.C: New test.
* g++.dg/cpp0x/Wredundant-move3.C: New test.
* g++.dg/cpp0x/Wredundant-move4.C: New test.

From-SVN: r263863

6 years agore PR c++/87080 (ice in cp_get_fndecl_from_callee, at cp/cvt.c:965)
Marek Polacek [Sun, 26 Aug 2018 16:31:27 +0000 (16:31 +0000)]
re PR c++/87080 (ice in cp_get_fndecl_from_callee, at cp/cvt.c:965)

PR c++/87080
* typeck.c (maybe_warn_pessimizing_move): Do nothing in a template.

* g++.dg/cpp0x/Wpessimizing-move5.C: New test.

From-SVN: r263862

6 years agoDaily bump.
GCC Administrator [Sun, 26 Aug 2018 00:16:54 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263860

6 years agore PR fortran/86704 (Segmentation fault when using matmul in combination with transpose)
Thomas Koenig [Sat, 25 Aug 2018 21:31:30 +0000 (21:31 +0000)]
re PR fortran/86704 (Segmentation fault when using matmul in combination with transpose)

2018-08-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR libfortran/86704
* m4/matmul_internal.m4: Correct calculation of needed buffer size
for arrays of shape (1,n).
* generated/matmul_c10.c: Regenerated
* generated/matmul_c16.c: Regenerated
* generated/matmul_c4.c: Regenerated
* generated/matmul_c8.c: Regenerated
* generated/matmul_i1.c: Regenerated
* generated/matmul_i16.c: Regenerated
* generated/matmul_i2.c: Regenerated
* generated/matmul_i4.c: Regenerated
* generated/matmul_i8.c: Regenerated
* generated/matmul_r10.c: Regenerated
* generated/matmul_r16.c: Regenerated
* generated/matmul_r4.c: Regenerated
* generated/matmul_r8.c: Regenerated
* generated/matmulavx128_c10.c: Regenerated
* generated/matmulavx128_c16.c: Regenerated
* generated/matmulavx128_c4.c: Regenerated
* generated/matmulavx128_c8.c: Regenerated
* generated/matmulavx128_i1.c: Regenerated
* generated/matmulavx128_i16.c: Regenerated
* generated/matmulavx128_i2.c: Regenerated
* generated/matmulavx128_i4.c: Regenerated
* generated/matmulavx128_i8.c: Regenerated
* generated/matmulavx128_r10.c: Regenerated
* generated/matmulavx128_r16.c: Regenerated
* generated/matmulavx128_r4.c: Regenerated
* generated/matmulavx128_r8.c: Regenerated

2018-08-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR libfortran/86704
* gfortran.dg/matmul_19.f90: New test.

From-SVN: r263856

6 years agore PR tree-optimization/87059 (internal compiler error: in set_value_range, at tree...
Martin Sebor [Sat, 25 Aug 2018 19:12:36 +0000 (19:12 +0000)]
re PR tree-optimization/87059 (internal compiler error: in set_value_range, at tree-vrp.c:289)

PR tree-optimization/87059
* builtins.c (expand_builtin_strncmp): Convert MIN_EXPR operand
to the same type as the other.
* fold-const.c (fold_binary_loc): Assert expectation.

From-SVN: r263855

6 years agore PR fortran/86545 (ICE in transfer_expr on invalid WRITE statement)
Janus Weil [Sat, 25 Aug 2018 15:41:34 +0000 (17:41 +0200)]
re PR fortran/86545 (ICE in transfer_expr on invalid WRITE statement)

fix PR 86545

2018-08-25  Janus Weil  <janus@gcc.gnu.org>

PR fortran/86545
* resolve.c (resolve_transfer): Correctly determine typespec for
generic function calls, in order to throw a proper error.

2018-08-25  Janus Weil  <janus@gcc.gnu.org>

PR fortran/86545
* gfortran.dg/generic_35.f90: New test case.

From-SVN: r263854

6 years agoCode clean-up on darwin.c
Iain Sandoe [Sat, 25 Aug 2018 09:11:47 +0000 (09:11 +0000)]
Code clean-up on darwin.c

* config/darwin.c (machopic_legitimize_pic_address): Clean up
extraneous parentheses, dead code section and formatting.

From-SVN: r263851

6 years agoDon't force visibility to hidden for Darwin > 8.
Iain Sandoe [Sat, 25 Aug 2018 09:02:28 +0000 (09:02 +0000)]
Don't force visibility to hidden for Darwin > 8.

PR libstdc++/70694
* configure.host (OPT_LDFLAGS): Don't append
-fvisibility-inlines-hidden for newer Darwin.

From-SVN: r263850

6 years agoDaily bump.
GCC Administrator [Sat, 25 Aug 2018 00:16:53 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263849

6 years agoSet start_location to 0 if we ran out of line map space
H.J. Lu [Fri, 24 Aug 2018 23:37:53 +0000 (23:37 +0000)]
Set start_location to 0 if we ran out of line map space

With profiledbootstrap and --with-build-config=bootstrap-lto, linemap_add
may create a macro map when we run out of line map space.  This patch
changes start_location to UNKNOWN_LOCATION (0) in this case.

Tested with profiledbootstrap and --with-build-config=bootstrap-lto on
Linux/x86-64.

PR bootstrap/86872
* line-map.c (pure_location_p): Return true if linemap_lookup
returns NULL.
(linemap_add): Set start_location to 0 if we run out of line map
space.

From-SVN: r263845

6 years agodiagnostics: tweaks to line-spans vs line numbering (PR 87091)
David Malcolm [Fri, 24 Aug 2018 21:17:48 +0000 (21:17 +0000)]
diagnostics: tweaks to line-spans vs line numbering (PR 87091)

This patch tweaks how line numbers are printed for a diagnostic
containing multiple line spans.

With this patch, rather than printing span headers:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: message
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1:
  ++ |+#include <vector>
  74 | #endif
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22:
  87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
     |                      ^~~

we now print:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: message
  +++ |+#include <vector>
   74 | #endif
  ....
   87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |                      ^~~

and for sufficiently close lines, rather than print a gap:

  + |+#include <stdio.h>
  1 | test (int ch)
  ..
  3 |  putchar (ch);
    |  ^~~~~~~

we print the line itself:

  + |+#include <stdio.h>
  1 | test (int ch)
  2 | {
  3 |  putchar (ch);
    |  ^~~~~~~

gcc/ChangeLog:
PR 87091
* diagnostic-show-locus.c (layout::layout): Ensure the margin is
wide enough for jumps in the line-numbering to be visible.
(layout::print_gap_in_line_numbering): New member function.
(layout::calculate_line_spans): When using line numbering, merge
line spans that are only 1 line apart.
(diagnostic_show_locus): When printing line numbers, show gaps in
line numbering directly, rather than printing headers.
(selftest::test_diagnostic_show_locus_fixit_lines): Add test of
line-numbering with multiple line spans.
(selftest::test_fixit_insert_containing_newline_2): Add test of
line-numbering, in which the spans are close enough to be merged.

gcc/testsuite/ChangeLog:
PR 87091
* gcc.dg/missing-header-fixit-3.c: Update for changes to how
line spans are printed with -fdiagnostics-show-line-numbers.

From-SVN: r263843

6 years agogimple-ssa-evrp-analyze.c (set_ssa_range_info): Pass value_range to range_includes_ze...
Aldy Hernandez [Fri, 24 Aug 2018 18:37:51 +0000 (18:37 +0000)]
gimple-ssa-evrp-analyze.c (set_ssa_range_info): Pass value_range to range_includes_zero_p.

* gimple-ssa-evrp-analyze.c (set_ssa_range_info): Pass value_range
to range_includes_zero_p.  Do not special case VR_ANTI_RANGE.
* tree-vrp.c (range_is_nonnull): Remove.
(range_includes_zero_p): Accept value_range instead of min/max.
(extract_range_from_binary_expr_1): Do not early bail on
POINTER_PLUS_EXPR.
Use range_includes_zero_p instead of range_is_nonnull.
(extract_range_from_unary_expr): Use range_includes_zero_p instead
of range_is_nonnull.
(vrp_meet_1): Pass value_range to range_includes_zero_p.  Do not
special case VR_ANTI_RANGE.
(vrp_finalize): Same.
* tree-vrp.h (range_includes_zero_p): Pass value_range as argument
instead of min/max.
(range_is_nonnull): Remove.
* vr-values.c (vrp_stmt_computes_nonzero): Use
range_includes_zero_p instead of range_is_nonnull.
(extract_range_basic): Pass value_range to range_includes_zero_p
instead of range_is_nonnull.

From-SVN: r263842

6 years agonew(nothrow) is malloc-like
Marc Glisse [Fri, 24 Aug 2018 18:24:42 +0000 (20:24 +0200)]
new(nothrow) is malloc-like

2018-08-24  Marc Glisse  <marc.glisse@inria.fr>

PR libstdc++/86822
* libsupc++/new (operator new(size_t, nothrow_t), operator
new[](size_t, nothrow_t), operator new(size_t, align_val_t, nothrow_t),
operator new[](size_t, align_val_t, nothrow_t)): Add malloc attribute.

From-SVN: r263841

6 years agoruntime: remove the dummy arg of getcallersp
Ian Lance Taylor [Fri, 24 Aug 2018 18:15:04 +0000 (18:15 +0000)]
runtime: remove the dummy arg of getcallersp

    This is a port of https://golang.org/cl/109596 to the gofrontend, in
    preparation for updating libgo to 1.11.

    Original CL description:

        getcallersp is intrinsified, and so the dummy arg is no longer
        needed. Remove it, as well as a few dummy args that are solely
        to feed getcallersp.

    Reviewed-on: https://go-review.googlesource.com/131116

From-SVN: r263840

6 years agoForward declare debug containers so std::pmr aliases work
Jonathan Wakely [Fri, 24 Aug 2018 17:43:18 +0000 (18:43 +0100)]
Forward declare debug containers so std::pmr aliases work

Prior to this change, including a <debug/xxx> header when _GLIBCXX_DEBUG
is also defined would fail to compile in C++17 or later. The <debug/xxx>
header would include the standard <xxx> header which defined
std::pmr::xxx as an alias for std::xxx. But in Debug Mode std::xxx
refers to std::__debug::xxx which has not been defined yet (because it
is in <debug/xxx> after the inclusion of <xxx>).

This adds declarations of the debug containers before including the
non-Debug Mode <xxx> header, so that the std::pmr::xxx aliases work.

* include/debug/deque (std::__debug::deque): Declare.
* include/debug/forward_list (std::__debug::forward_list): Declare.
* include/debug/list (std::__debug::list): Declare.
* include/debug/map (std::__debug::map): Declare.
* include/debug/set (std::__debug::set): Declare.
* include/debug/unordered_map (std::__debug::unordered_map): Declare.
* include/debug/unordered_set (std::__debug::unordered_set): Declare.
* include/debug/vector (std::__debug::vector): Declare.
* testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: New test.
* testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: New
test.
* testsuite/23_containers/list/pmr_typedefs_debug.cc: New test.
* testsuite/23_containers/map/pmr_typedefs_debug.cc: New test.
* testsuite/23_containers/multimap/pmr_typedefs_debug.cc: New test.
* testsuite/23_containers/multiset/pmr_typedefs_debug.cc: New test.
* testsuite/23_containers/set/pmr_typedefs_debug.cc: New test.
* testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc: New
test.
* testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc:
New test.
* testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc:
New test.
* testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc: New
test.
* testsuite/23_containers/vector/cons/destructible_debug_neg.cc:
Adjust dg-error lineno.
* testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: New
test.

From-SVN: r263839

6 years agore PR fortran/86837 (Optimization breaks an unformatted read with implicit loop)
Thomas Koenig [Fri, 24 Aug 2018 17:26:57 +0000 (17:26 +0000)]
re PR fortran/86837 (Optimization breaks an unformatted read with implicit loop)

2018-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/86837
* frontend-passes.c (var_in_expr_callback): New function.
(var_in_expr): New function.
(traverse_io_block): Use var_in_expr instead of
gfc_check_dependency for checking if the variable depends on the
previous interators.

2018-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/86837
* gfortran.dg/implied_do_io_6.f90: New test.

From-SVN: r263838

6 years agoAdd a testcase for PR middle-end/87092
H.J. Lu [Fri, 24 Aug 2018 16:58:27 +0000 (16:58 +0000)]
Add a testcase for PR middle-end/87092

PR middle-end/87092
* gcc.dg/pr87092.c: New test.

From-SVN: r263837

6 years agore PR c++/67012 (decltype(auto) with trailing return type)
Marek Polacek [Fri, 24 Aug 2018 15:48:43 +0000 (15:48 +0000)]
re PR c++/67012 (decltype(auto) with trailing return type)

PR c++/67012
PR c++/86942
* decl.c (grokdeclarator): Disallow functions with trailing return
        type with decltype(auto) as its type.  Also check the function if
        it's inner declarator doesn't exist

* g++.dg/cpp0x/auto52.C: New test.
* g++.dg/cpp1y/auto-fn52.C: New test.
* g++.dg/cpp1y/auto-fn53.C: New test.
* g++.dg/cpp1y/auto-fn54.C: New test.

From-SVN: r263836

6 years agoemit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.
Uros Bizjak [Fri, 24 Aug 2018 14:42:32 +0000 (16:42 +0200)]
emit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.

* emit-rtl.c (init_emit_once): Do not emit MODE_POINTER_BOUNDS RTXes.
* emit-rtl.h (rtl_data): Remove return_bnd.
* explow.c (trunc_int_for_mode): Do not handle POINTER_BOUNDS_MODE_P.
* function.c (diddle_return_value): Do not handle crtl->return_bnd.
* genmodes.c (complete_mode): Do not handle MODE_POINTER_BOUNDS.
(POINTER_BOUNDS_MODE): Remove definition.
(make_pointer_bounds_mode): Remove.
(get_mode_class): Do not handle MODE_POINTER_BOUNDS.
* machmode.h (POINTER_BOUNDS_MODE_P): Remove definition.
(scalare_mode::includes_p): Do not handle MODE_POINTER_BOUNDS.
* mode-classes.def: Do not define MODE_POINTER_BOUNDS.
* stor-layout.c (int_mode_for_mode): Do not handle MODE_POINTER_BOUNDS.
* tree-core.h (enum tree_index): Remove TI_POINTER_BOUNDS_TYPE.
* varasm.c (output_constant_pool_2): Do not handle MODE_POINTER_BOUNDS.

* config/i386/i386-modes.def (BND32, BND64): Remove.
* config/i386/i386.c (dbx_register_map): Remove bound registers.
(dbx64_register_map): Ditto.
(svr4_dbx_register_map): Ditto.
(indirect_thunk_bnd_needed): Remove.
(indirect_thunks_bnd_used): Ditto.
(indirect_return_bnd_needed): Ditto.
(indirect_return_via_cx_bnd): Ditto.
(enum indirect_thunk_prefix): Remove indirect_thunk_prefix_bnd.
(indirect_thunk_name): Remove handling of indirect_thunk_prefix_bnd.
(output_indirect_thunk): Ditto.  Remove need_prefix argument.
(output_indirect_thunk_function): Remove handling of
indirect_return_bnd_needed, indirect_return_via_cx_bnd,
indirect_thunk_bnd_needed and indirect_thunks_bnd_used variables.
(ix86_save_reg): Remove handling of crtl->return_bnd.
(ix86_legitimate_constant_p): Remove handling of POINTER_BOUNDS_MODE_P.
(ix86_print_operand_address_as): Remove handling of UNSPEC_BNDMK_ADDR
and UNSPEC_BNDLX_ADDR.
(ix86_output_indirect_branch_via_reg): Remove handling of
indirect_thunk_prefix_bnd.
(ix86_output_indirect_branch_via_push): Ditto.
(ix86_output_function_return): Ditto.
(ix86_output_indirect_function_return): Ditto.
(avoid_func_arg_motion): Do not handle UNSPEC_BNDSTX.
* config/i386/i386.h (FIXED_REGISTERS): Remove bound registers.
(CALL_USED_REGISTERS): Ditto.
(REG_ALLOC_ORDER): Update for removal of bound registers.
(HI_REGISTER_NAMES): Ditto.
* config/i386/i386.md (UNSPEC_BNDMK, UNSPEC_BNDMK_ADDR, UNSPEC_BNDSTX)
(UNSPEC_BNDLDX, UNSPEC_BNDLDX_ADDR, UNSPEC_BNDCL, UNSPEC_BNDCU)
(UNSPEC_BNDCN, UNSPEC_MPX_FENCE): Remove.
(BND0_REG, BND1_REG, BND2_REG, BND3_REG): Remove
(FIRST_PSEUDO_REG): Update.
(BND): Remove mode iterator.
* config/i386/predicates.md (bnd_mem_operator): Remove.

From-SVN: r263835

6 years agoDefine vect_perm for variable-length SVE
Richard Sandiford [Fri, 24 Aug 2018 13:06:56 +0000 (13:06 +0000)]
Define vect_perm for variable-length SVE

Variable-length SVE now supports enough permutes to define vect_perm.

The change to vect_perm_supported is currently a no-op because the
function is only called with a count of 3.

2018-08-24  Richard Sandiford  <richard.sandiford@arm.com>

gcc/testsuite/
* lib/target-supports.exp (vect_perm_supported): Only return
false for variable-length vectors if the permute size is not
a power of 2.
(check_effective_target_vect_perm)
(check_effective_target_vect_perm_byte)
(check_effective_target_vect_perm_short): Remove check for
variable-length vectors.
* gcc.dg/vect/slp-23.c: Add an XFAIL for variable-length SVE.
* gcc.dg/vect/slp-perm-10.c: Likewise.
* gcc.dg/vect/slp-perm-9.c: Add an XFAIL for variable-length vectors.

From-SVN: r263834

6 years agoAvoid is_constant calls in vectorizable_bswap
Richard Sandiford [Fri, 24 Aug 2018 13:06:09 +0000 (13:06 +0000)]
Avoid is_constant calls in vectorizable_bswap

The "new" VEC_PERM_EXPR handling makes it easy to support bswap
for variable-length vectors.

2018-08-24  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-stmts.c (vectorizable_bswap): Handle variable-length
vectors.

gcc/testsuite/
* gcc.target/aarch64/sve/bswap_1.c: New test.
* gcc.target/aarch64/sve/bswap_2.c: Likewise.
* gcc.target/aarch64/sve/bswap_3.c: Likewise.

From-SVN: r263833

6 years agoHandle SLP permutations for variable-length vectors
Richard Sandiford [Fri, 24 Aug 2018 13:05:36 +0000 (13:05 +0000)]
Handle SLP permutations for variable-length vectors

The SLP code currently punts for all variable-length permutes.
This patch makes it handle the easy case of N->N permutes in which
the number of vector lanes is a multiple of N.  Every permute then
uses the same mask, and that mask repeats (with a stride) every
N elements.

The patch uses the same path for constant-length vectors,
since it should be slightly cheaper in terms of compile time.

2018-08-24  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-slp.c (vect_transform_slp_perm_load): Separate out
the case in which the permute needs only a single element and
repeats for every vector of the result.  Extend that case to
handle variable-length vectors.
* tree-vect-stmts.c (vectorizable_load): Update accordingly.

gcc/testsuite/
* gcc.target/aarch64/sve/slp_perm_1.c: New test.
* gcc.target/aarch64/sve/slp_perm_2.c: Likewise.
* gcc.target/aarch64/sve/slp_perm_3.c: Likewise.
* gcc.target/aarch64/sve/slp_perm_4.c: Likewise.
* gcc.target/aarch64/sve/slp_perm_5.c: Likewise.
* gcc.target/aarch64/sve/slp_perm_6.c: Likewise.
* gcc.target/aarch64/sve/slp_perm_7.c: Likewise.

From-SVN: r263832

6 years agoDWARF: Call set_indirect_string on DW_MACINFO_start_file
H.J. Lu [Fri, 24 Aug 2018 11:28:40 +0000 (11:28 +0000)]
DWARF: Call set_indirect_string on DW_MACINFO_start_file

Since -gsplit-dwarf -g3 will output filename as indirect string, call
set_indirect_string on DW_MACINFO_start_file for -gsplit-dwarf -g3.

gcc/

PR debug/79342
* dwarf2out.c (save_macinfo_strings): Call set_indirect_string
on DW_MACINFO_start_file for -gsplit-dwarf -g3.

gcc/testsuite/

PR debug/79342
* gcc.dg/pr79342.: New test.

From-SVN: r263831

6 years agocfg.h (struct control_flow_graph): Add edge_flags_allocated and bb_flags_allocated...
Richard Biener [Fri, 24 Aug 2018 11:17:16 +0000 (11:17 +0000)]
cfg.h (struct control_flow_graph): Add edge_flags_allocated and bb_flags_allocated members.

2018-08-24  Richard Biener  <rguenther@suse.de>

* cfg.h (struct control_flow_graph): Add edge_flags_allocated and
bb_flags_allocated members.
(auto_flag): New RAII class for allocating flags.
(auto_edge_flag): New RAII class for allocating edge flags.
(auto_bb_flag): New RAII class for allocating bb flags.
* cfgloop.c (verify_loop_structure): Allocate temporary edge
flag dynamically.
* cfganal.c (dfs_enumerate_from): Remove use of visited sbitmap
in favor of temporarily allocated BB flag.
* hsa-brig.c: Re-order includes.
* hsa-dump.c: Likewise.
* hsa-regalloc.c: Likewise.
* print-rtl.c: Likewise.
* profile-count.c: Likewise.

From-SVN: r263830

6 years agors6000: Check that the base of a TOCREL is the TOC (PR86989)
Segher Boessenkool [Fri, 24 Aug 2018 10:49:27 +0000 (12:49 +0200)]
rs6000: Check that the base of a TOCREL is the TOC (PR86989)

There currently is nothing that prevents replacing the TOC_REGISTER in
a TOCREL unspec with something else, like a pseudo, or a memory ref.
This of course does not work.  Fix that.

Tested on powerpc64-linux {-m32,-m64}; committing.

Segher

2018-08-24  Segher Boessenkool  <segher@kernel.crashing.org>

PR target/86989
* config/rs6000/rs6000.c (toc_relative_expr_p): Check that the base is
the TOC register.

---
 gcc/config/rs6000/rs6000.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a967912..ed33912 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -7932,7 +7932,9 @@ toc_relative_expr_p (const_rtx op, bool strict, const_rtx *tocrel_base_ret,
     *tocrel_offset_ret = tocrel_offset;

   return (GET_CODE (tocrel_base) == UNSPEC
-   && XINT (tocrel_base, 1) == UNSPEC_TOCREL);
+   && XINT (tocrel_base, 1) == UNSPEC_TOCREL
+   && REG_P (XVECEXP (tocrel_base, 0, 1))
+   && REGNO (XVECEXP (tocrel_base, 0, 1)) == TOC_REGISTER);
 }

 /* Return true if X is a constant pool address, and also for cmodel=medium
--
1.8.3.1

From-SVN: r263829

6 years agoPR 87073/bootstrap
Aldy Hernandez [Fri, 24 Aug 2018 08:06:06 +0000 (08:06 +0000)]
PR 87073/bootstrap

PR 87073/bootstrap
* wide-int-range.cc (wide_int_range_div): Do not ignore result
from wide_int_range_multiplicative_op.

From-SVN: r263828

6 years agoDaily bump.
GCC Administrator [Fri, 24 Aug 2018 00:16:48 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263827

6 years agoPR tree-optimization/87072 - false warning: array subscript is above array bounds
Martin Sebor [Thu, 23 Aug 2018 19:39:18 +0000 (19:39 +0000)]
PR tree-optimization/87072 - false warning: array subscript is above array bounds

gcc/testsuite/ChangeLog:
* gcc.dg/Warray-bounds-35.c: New test.

From-SVN: r263822

6 years ago* async.h (ASYNC_IO): Revert _AIX test.
David Edelsohn [Thu, 23 Aug 2018 19:33:45 +0000 (19:33 +0000)]
* async.h (ASYNC_IO): Revert _AIX test.

From-SVN: r263821

6 years agoFix failure when -fno-rtti test is run in C++17 or later
Jonathan Wakely [Thu, 23 Aug 2018 19:27:54 +0000 (20:27 +0100)]
Fix failure when -fno-rtti test is run in C++17 or later

* testsuite/util/testsuite_allocator.h (__gnu_test::memory_resource):
Only define when RTTI is enabled.

From-SVN: r263820

6 years agotree-vect-data-refs.c (vect_grouped_store_supported): Fix typo "permutaion".
Prathamesh Kulkarni [Thu, 23 Aug 2018 18:22:10 +0000 (18:22 +0000)]
tree-vect-data-refs.c (vect_grouped_store_supported): Fix typo "permutaion".

2018-08-23  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

* tree-vect-data-refs.c (vect_grouped_store_supported): Fix typo
"permutaion".

From-SVN: r263819

6 years agoFix typo 'exapnded' to 'expanded'
Giuliano Belinassi [Thu, 23 Aug 2018 17:01:09 +0000 (17:01 +0000)]
Fix typo 'exapnded' to 'expanded'

2018-08-23  Giuliano Belinassi  <giuliano.belinassi@usp.br>

gcc/
* genmatch.c (parser::parse_operation): Fix typo 'exapnded'
to 'expanded'.

gcc/ada/
* exp_unst.ads: Fix typo 'exapnded' to 'expanded'.

From-SVN: r263818

6 years agoscev: dump final value replacement expressions
Alexander Monakov [Thu, 23 Aug 2018 16:01:12 +0000 (19:01 +0300)]
scev: dump final value replacement expressions

* tree-scalar-evolution.c (final_value_replacement_loop): Dump
full GENERIC expression used for replacement.

From-SVN: r263817

6 years agoDefine debug mode function for C++98
Jonathan Wakely [Thu, 23 Aug 2018 15:23:31 +0000 (16:23 +0100)]
Define debug mode function for C++98

This function is declared unconditionally but was only defined for C++11
and later, leading to linker errors when the testsuite was run with
-std=gnu++98 -D_GLIBCXX_DEBUG added to the flags.

* include/debug/vector (__niter_base): Define for C++98.

From-SVN: r263816

6 years agoFix C++98 tests to not use C++11 features.
Jonathan Wakely [Thu, 23 Aug 2018 15:10:45 +0000 (16:10 +0100)]
Fix C++98 tests to not use C++11 features.

* testsuite/25_algorithms/partial_sort_copy/debug/irreflexive_neg.cc:
Fix C++98 test to not use C++11 features.
* testsuite/25_algorithms/fill_n/2.cc: Likewise.

From-SVN: r263815

6 years agoFix comments in testsuite script
Jonathan Wakely [Thu, 23 Aug 2018 15:10:35 +0000 (16:10 +0100)]
Fix comments in testsuite script

* scripts/check_compile: Fix comments.

From-SVN: r263814

6 years agotree-vrp.c (abs_extent_range): Remove.
Aldy Hernandez [Thu, 23 Aug 2018 13:25:36 +0000 (13:25 +0000)]
tree-vrp.c (abs_extent_range): Remove.

* tree-vrp.c (abs_extent_range): Remove.
(extract_range_into_wide_ints): Pass wide ints by reference.
(extract_range_from_binary_expr_1): Rewrite the *DIV_EXPR code.
Pass wide ints by reference in all calls to
extract_range_into_wide_ints.
* wide-int-range.cc (wide_int_range_div): New.
* wide-int-range.h (wide_int_range_div): New.
(wide_int_range_includes_zero_p): New.
(wide_int_range_zero_p): New.

From-SVN: r263813

6 years ago[AARCH64] use "arch_enabled" attribute for aarch64.
Matthew Malcomson [Thu, 23 Aug 2018 12:43:17 +0000 (12:43 +0000)]
[AARCH64] use "arch_enabled" attribute for aarch64.

arm.md has some attributes "arch" and "arch_enabled" to aid enabling
and disabling insn alternatives based on the architecture being
targeted.  This patch introduces a similar attribute in the aarch64
backend.  The new attribute will be used to enable a new alternative
for the atomic_store insn in a future patch, but is an atomic change
in itself.

The new attribute has values "any", "fp", "fp16", "simd", and "sve".
These attribute values have been taken from the pre-existing
attributes "fp", "fp16", "simd", and "sve".

The standalone "fp" attribute has been reintroduced in terms of the
"arch" attribute as it's needed for the xgene1.md scheduling file --
the use in this file can't be changed to check for `(eq_attr "arch"
"fp")` as the file is reused by the arm.md machine description whose
'arch' attribute doesn't have an 'fp' value.

2018-08-23  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/aarch64/aarch64.md (arches): New enum.
(arch): New enum attr.
(arch_enabled): New attr.
(enabled): Now uses arch_enabled only.
(simd, sve, fp16): Removed attribute.
(fp): Attr now defined in terms of 'arch'.
(*mov<mode>_aarch64, *movsi_aarch64, *movdi_aarch64, *movti_aarch64,
*movhf_aarch64, <optab><fcvt_target><GPF:mode>2,
<FCVT_F2FIXED:fcvt_fixed_insn><GPF:mode>3,
<FCVT_FIXED2F:fcvt_fixed_insn><GPI:mode>3): Merge 'fp' and 'simd'
attributes into 'arch'.
(*movsf_aarch64, *movdf_aarch64, *movtf_aarch64, *add<mode>3_aarch64,
subdi3, neg<mode>2, <optab><mode>3, one_cmpl<mode>2,
*<NLOGICAL:optab>_one_cmpl<mode>3, *xor_one_cmpl<mode>3,
*aarch64_ashl_sisd_or_int_<mode>3, *aarch64_lshr_sisd_or_int_<mode>3,
*aarch64_ashr_sisd_or_int_<mode>3, *aarch64_sisd_ushl): Convert use of
'simd' attribute into 'arch'.
(load_pair_sw_<SX:mode><SX2:mode>, load_pair_dw_<DX:mode><DX2:mode>,
store_pair_sw_<SX:mode><SX2:mode>, store_pair_dw_<DX:mode><DX2:mode>):
Convert use of 'fp' attribute to 'arch'.
* config/aarch64/aarch64-simd.md (move_lo_quad_internal_<mode>,
move_lo_quad_internal_<mode>): (different modes) Merge 'fp' and 'simd'
into 'arch'.
(move_lo_quad_internal_be_<mode>, move_lo_quad_internal_be_<mode>):
(different modes) Merge 'fp' and 'simd' into 'arch'.
(*aarch64_combinez<mode>, *aarch64_combinez_be<mode>): Merge 'fp' and
'simd' into 'arch'.

From-SVN: r263811

6 years agoFix recent bug in canonicalize_comparison (PR87026)
Segher Boessenkool [Thu, 23 Aug 2018 12:40:14 +0000 (14:40 +0200)]
Fix recent bug in canonicalize_comparison (PR87026)

The new code testing which way a comparison is best expressed creates
a pseudoregister (by hand) and creates some insns with that.  Such
insns will no longer recog() when pseudo-registers are no longer
aloowed (after reload).  But we have an ifcvt pass after reload (ce3).

This patch simply returns if we cannot create pseudos.

PR rtl-optimization/87026
* expmed.c (canonicalize_comparison): If we can no longer create
pseudoregisters, don't.

From-SVN: r263810

6 years agoFix C++11-ism in C++98 member function
Jonathan Wakely [Thu, 23 Aug 2018 11:21:17 +0000 (12:21 +0100)]
Fix C++11-ism in C++98 member function

* include/debug/string (insert(__const_iterator, _InIter, _InIter)):
[!_GLIBCXX_USE_CXX11_ABI]: Replace use of C++11-only cbegin() with
begin(), for C++98 compatibility.

From-SVN: r263809

6 years agoFix testsuite failures for __gnu_debug::string with old ABI
Jonathan Wakely [Thu, 23 Aug 2018 10:51:52 +0000 (11:51 +0100)]
Fix testsuite failures for __gnu_debug::string with old ABI

The __gnu_debug string (mostly) implements the C++11 API, but when it
wraps the old COW string many of the member functions in the base class
have the wrong parameter types or return types. This makes the
__gnu_debug::string type adapt itself to the base class API. This
actually makes the debug string slightly more conforming than the
underlying string type when using the old ABI.

* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
(basic_string::__const_iterator): Change access to protected.
[!_GLIBCXX_USE_CXX11_ABI] (basic_string::__const_iterator): Define
as typedef for iterator.
* include/debug/string (__const_iterator): Use typedef from base.
(insert(const_iterator, _CharT))
(replace(const_iterator, const_iterator, const basic_string&))
(replace(const_iterator, const_iterator, const _CharT*, size_type))
(replace(const_iterator, const_iterator, const CharT*))
(replace(const_iterator, const_iterator, size_type, _CharT))
(replace(const_iterator, const_iterator, _InputIter, _InputIter))
(replace(const_iterator, const_iterator, initializer_list<_CharT>)):
Change const_iterator parameters to __const_iterator.
(insert(iterator, size_type, _CharT)): Add C++98 overload.
(insert(const_iterator, _InputIterator, _InputIterator)): Change
const_iterator parameter to __const_iterator.
[!_GLIBCXX_USE_CXX11_ABI]: Add workaround for incorrect return type
of base's member function.
(insert(const_iterator, size_type, _CharT)) [!_GLIBCXX_USE_CXX11_ABI]:
Likewise.
(insert(const_iterator, initializer_list<_CharT>))
[!_GLIBCXX_USE_CXX11_ABI]: Likewise.
* testsuite/21_strings/basic_string/init-list.cc: Remove effective
target directive.

From-SVN: r263808

6 years ago[libiberty patch] Fix PGO bootstrap
Nathan Sidwell [Thu, 23 Aug 2018 10:21:21 +0000 (10:21 +0000)]
[libiberty patch] Fix PGO bootstrap

https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01386.html
PR driver/87056
* pex-unix.c (pex_unix_exec_child): Duplicate bad_fn into local
scopes to avoid potential clobber.

Co-Authored-By: Martin Liska <mliska@suse.cz>
From-SVN: r263807

6 years agoPR target/86951 arm - Handle speculation barriers on pre-armv7 CPUs
Richard Earnshaw [Thu, 23 Aug 2018 09:47:34 +0000 (09:47 +0000)]
PR target/86951 arm - Handle speculation barriers on pre-armv7 CPUs

The AArch32 instruction sets prior to Armv7 do not define the ISB and
DSB instructions that are needed to form a speculation barrier.  While
I do not know of any instances of cores based on those instruction
sets being vulnerable to speculative side channel attacks it is
possible to run code built for those ISAs on more recent hardware
where they would become vulnerable.

This patch works around this by using a library call added to libgcc.
That code can then take any platform-specific actions necessary to
ensure safety.

For the moment I've only handled two cases: the library code being
built for armv7 or later anyway and running on Linux.

On Linux we can handle this by calling the kernel function that will
flush a small amount of cache.  Such a sequence ends with a ISB+DSB
sequence if running on an Armv7 or later CPU.

gcc:

PR target/86951
* config/arm/arm-protos.h (arm_emit_speculation_barrier): New
prototype.
* config/arm/arm.c (speculation_barrier_libfunc): New static
variable.
(arm_init_libfuncs): Initialize it.
(arm_emit_speculation_barrier): New function.
* config/arm/arm.md (speculation_barrier): Call
arm_emit_speculation_barrier for architectures that do not have
DSB or ISB.
(speculation_barrier_insn): Only match on Armv7 or later.

libgcc:

PR target/86951
* config/arm/lib1funcs.asm (speculation_barrier): New function.
* config/arm/t-arm (LIB1ASMFUNCS): Add it to list of functions
to build.

From-SVN: r263806

6 years agore PR ipa/87024 (ICE in fold_stmt_1)
Richard Biener [Thu, 23 Aug 2018 09:29:45 +0000 (09:29 +0000)]
re PR ipa/87024 (ICE in fold_stmt_1)

2018-08-23  Richard Biener  <rguenther@suse.de>

PR middle-end/87024
* tree-inline.c (copy_bb): Drop unused __builtin_va_arg_pack_len
calls.

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

From-SVN: r263805

6 years ago[AArch64] Improve SVE handling of single-vector permutes
Richard Sandiford [Thu, 23 Aug 2018 08:57:17 +0000 (08:57 +0000)]
[AArch64] Improve SVE handling of single-vector permutes

aarch64_vectorize_vec_perm_const was failing to set one_vector_p
if the permute had only a single input.  This in turn was hiding
a problem in the SVE TBL handling: it accepted single-vector
variable-length permutes, but sent them through the general
two-vector aarch64_expand_sve_vec_perm, which is only set up
to handle constant-length permutes.

2018-08-23  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64.c (aarch64_evpc_sve_tbl): Fix handling
of single-vector TBLs.
(aarch64_vectorize_vec_perm_const): Set one_vector_p when only
one input is given.

gcc/testsuite/
* gcc.dg/vect/no-vfa-vect-depend-2.c: Remove XFAIL.
* gcc.dg/vect/no-vfa-vect-depend-3.c: Likewise.
* gcc.dg/vect/pr65947-13.c: Update for vect_fold_extract_last.
* gcc.dg/vect/pr80631-2.c: Likewise.

From-SVN: r263804

6 years agoFix aarch64_evpc_tbl guard (PR 85910)
Richard Sandiford [Thu, 23 Aug 2018 08:51:38 +0000 (08:51 +0000)]
Fix aarch64_evpc_tbl guard (PR 85910)

This patch fixes a typo in aarch64_expand_vec_perm_const_1 that I
introduced as part of the SVE changes.  I don't know of any cases in
which it has any practical effect, since we'll eventually try to use
TBL as a variable permute instead.  Having the code is still an
important part of defining the interface properly and so we shouldn't
simply drop it.

2018-08-23  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR target/85910
* config/aarch64/aarch64.c (aarch64_expand_vec_perm_const_1): Fix
aarch64_evpc_tbl guard.

From-SVN: r263803

6 years agoSigned zero for {max,min}val intrinsics
Janne Blomqvist [Thu, 23 Aug 2018 08:35:17 +0000 (11:35 +0300)]
Signed zero for {max,min}val intrinsics

The Fortran standard specifies (e.g. F2018 7.4.3.2) that intrinsic
procedures shall treat positive and negative real zero as equivalent,
unless it is explicitly specified otherwise.  For {max,min}val there
is no such explicit mention.  Thus, remove code to handle signed
zeros.

2018-08-23  Janne Blomqvist  <blomqvist.janne@gmail.com>

* trans-intrinsic.c (gfc_conv_intrinsic_minmaxval): Delete
HONOR_SIGNED_ZEROS checks.

From-SVN: r263802

6 years agoRemove C++14-isms from C++11 tests
Jonathan Wakely [Thu, 23 Aug 2018 08:26:22 +0000 (09:26 +0100)]
Remove C++14-isms from C++11 tests

* testsuite/20_util/reference_wrapper/lwg2993.cc: Fix C++11 test to
not use C++14 feature.
* testsuite/23_containers/list/68222_neg.cc: Likewise.

From-SVN: r263801

6 years agoSkip tests that depend on the cxx11 std::string
Jonathan Wakely [Thu, 23 Aug 2018 08:26:16 +0000 (09:26 +0100)]
Skip tests that depend on the cxx11 std::string

* testsuite/21_strings/basic_string/init-list.cc:
Require cxx11-abi.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
Likewise.
* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
Likewise.

From-SVN: r263800

6 years agore PR fortran/86863 ([OOP][F2008] type-bound module procedure name not recognized)
Paul Thomas [Thu, 23 Aug 2018 06:27:54 +0000 (06:27 +0000)]
re PR fortran/86863 ([OOP][F2008] type-bound module procedure name not recognized)

2017-08-23  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/86863
* resolve.c (resolve_typebound_call): If the TBP is not marked
as a subroutine, check the specific symbol.

2017-08-23  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/86863
* gfortran.dg/submodule_32.f08: New test.

From-SVN: r263799

6 years agoDaily bump.
GCC Administrator [Thu, 23 Aug 2018 00:17:18 +0000 (00:17 +0000)]
Daily bump.

From-SVN: r263798

6 years agotree-ssa-dse.c (compute_trims): Avoid folding away undefined behaviour.
Bernd Edlinger [Wed, 22 Aug 2018 23:43:44 +0000 (23:43 +0000)]
tree-ssa-dse.c (compute_trims): Avoid folding away undefined behaviour.

* tree-ssa-dse.c (compute_trims): Avoid folding away undefined
behaviour.

From-SVN: r263793

6 years agoFix tests that fail in C++98 mode
Jonathan Wakely [Wed, 22 Aug 2018 23:43:43 +0000 (00:43 +0100)]
Fix tests that fail in C++98 mode

* testsuite/23_containers/deque/capacity/max_size.cc: Fix test for
C++98 mode.
* testsuite/23_containers/deque/modifiers/assign/1.cc: Likewise.
* testsuite/23_containers/list/modifiers/assign/1.cc: Likewise.
* testsuite/23_containers/vector/bool/modifiers/assign/1.cc: Likewise.
* testsuite/23_containers/vector/capacity/max_size.cc: Likewise.
* testsuite/23_containers/vector/modifiers/assign/1.cc: Likewise.

From-SVN: r263792

6 years agoPR libstdc++/87061 remove pmr type aliases for COW strings
Jonathan Wakely [Wed, 22 Aug 2018 22:54:33 +0000 (23:54 +0100)]
PR libstdc++/87061 remove pmr type aliases for COW strings

The pmr aliases for basic_string and match_results are incompatible with
the gcc4-compatible ABI because the Copy-On-Write basic_string class
doesn't support C++11 allocators.

PR libstdc++/87061
* include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::match_results, experimental::pmr::cmatch)
(experimental::pmr::smatch, experimental::pmr::wcmatch)
(experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
because COW strings don't support C++11 allocator model.
* include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::basic_string, experimental::pmr::string)
(experimental::pmr::u16string, experimental::pmr::u32string)
(experimental::pmr::wstring): Likewise.
* include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results)
(pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise.
* include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string)
(pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise.
* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require
cxx11-abi.
* testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.

From-SVN: r263791

6 years agoPR libstdc++/78448 limit vector::max_size and deque::max_size
Jonathan Wakely [Wed, 22 Aug 2018 22:22:40 +0000 (23:22 +0100)]
PR libstdc++/78448 limit vector::max_size and deque::max_size

The container requirements imply that max_size() can't exceed the
maximum value of the container's difference_type. Enforce this for
std::vector and std::deque, and add checks to ensure the container
doesn't grow larger than that.

PR libstdc++/78448
* include/bits/deque.tcc (deque::_M_range_initialize): Use
_S_check_init_len to check size.
(deque::_M_push_back_aux, deque::_M_push_front_aux): Throw length
error if size would exceed max_size().
* include/bits/stl_deque.h (_Deque_base::size_type): Remove typedef.
(_Deque_base(_Deque_base&&, const allocator_type&, size_t)): Use
size_t instead of size_type.
(deq(size_type, const allocator_type&)
(deq(size_type, const value_type&, const allocator_type&)
(deque::_M_initialize_dispatch): Use _S_check_init_len to check size.
(deque::max_size): Call _S_max_size.
(deque::_S_check_init_len, deque::_S_max_size): New functions.
* include/bits/stl_vector.h (vector(size_type, const allocator_type&))
(vector(size_type, const value_type&, const allocator_type&))
(vector::_M_initialize_dispatch, vector::_M_range_initialize): Use
_S_check_init_len to check size.
(vector::max_size): Call _S_max_size.
(vector::_M_check_len): Prevent max from being expanded as a
function-like macro.
(vector::_S_check_init_len, vector::_S_max_size): New functions.
* include/bits/vector.tcc (vector::_M_assign_aux): Use
_S_check_init_len to check size.
* testsuite/23_containers/deque/capacity/max_size.cc: New test.
* testsuite/23_containers/vector/capacity/max_size.cc: New test.

From-SVN: r263789

6 years agogfortran.texi: Mention that asynchronous I/O does not work on systems which lack...
Thomas Koenig [Wed, 22 Aug 2018 21:29:49 +0000 (21:29 +0000)]
gfortran.texi: Mention that asynchronous I/O does not work on systems which lack condition...

2018-08-22  Thomas Koenig  <tkoenig@gcc.gnu.org>

* gfortran.texi: Mention that asynchronous I/O does
not work on systems which lack condition variables, such
as AIX.

2018-08-22  Thomas Koenig  <tkoenig@gcc.gnu.org>

* async.h: Set ASYNC_IO to zero if _AIX is defined.
(struct adv_cond): If ASYNC_IO is zero, the struct has no members.
(async_unit): If ASYNC_IO is zero, remove unneeded members.

From-SVN: r263788

6 years agore PR fortran/86935 (Bad locus in ASSOCIATE statement)
Janus Weil [Wed, 22 Aug 2018 19:31:40 +0000 (21:31 +0200)]
re PR fortran/86935 (Bad locus in ASSOCIATE statement)

fix PR 86935

2018-08-22  Janus Weil  <janus@gcc.gnu.org>

PR fortran/86935
* match.c (gfc_match_associate): Improve diagnostics for the ASSOCIATE
statement.

2018-08-22  Janus Weil  <janus@gcc.gnu.org>

PR fortran/86935
* gfortran.dg/associate_3.f90: Update error message.
* gfortran.dg/associate_39.f90: New test case.

From-SVN: r263787

6 years agore PR libstdc++/68222 (_Safe_iterator provides operators the wrapped iterator can...
François Dumont [Wed, 22 Aug 2018 18:51:25 +0000 (18:51 +0000)]
re PR libstdc++/68222 (_Safe_iterator provides operators the wrapped iterator can't actually support)

2018-08-22  François Dumont  <fdumont@gcc.gnu.org>

PR libstdc++/68222
* include/debug/safe_iterator.h
(_Safe_iterator<_It, _Sq, _Cat>): Add category template parameter.
(_Safe_iterator<>::_Const_iterator): Remove.
(_Safe_iterator<>::_IsConstant): New.
(_Safe_iterator<>::_OtherIterator): New.
(_Safe_iterator<_It, _Sq, _Cat>::_Safe_iterator<_MutIte>(
const _Safe_iterator<_MutIte, _Sq, _Cat>&)): Add _IsConstant::__value in
__gnu_cxx::__enable_if condition.
(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_to): New.
(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_from_begin): New.
(_Safe_iterator<_It, _Sq, _Cat>::_M_get_distance_to_end): New.
(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>): New.
(_Safe_iterator<_It, _Sq, _Cat>::operator--()): Move...
(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
::operator--()): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator--(int)): Move...
(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
::operator--(int)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::_M_decrementable()): Move...
(_Safe_iterator<_It, _Sq, std::bidirectional_iterator_tag>
::_M_decrementable()): ...here.
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>): New.
(_Safe_iterator<_It, _Sq, _Cat>::operator[](const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator[](const difference_type&)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator+=(const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator+=(const difference_type&)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator+(const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator+(const difference_type&)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator-=(const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator-=(const difference_type&)): ...here.
(_Safe_iterator<_It, _Sq, _Cat>::operator-(const difference_type&)):
Move...
(_Safe_iterator<_It, _Sq, std::random_access_iterator_tag>
::operator-(const difference_type&)): ...here.
(operator<(const _Safe_iterator<>&, const _Safe_iterator<>&)):
Constraint to random access iterators.
(operator<=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
Likewise.
(operator>(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
(operator>=(const _Safe_iterator<>&, const _Safe_iterator<>&)):
Likewise.
(operator-(const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
(operator+(const difference_type&, const _Safe_iterator<>&)): Likewise.
(__check_dereferenceable(const _Safe_iterator<>&)): Remove.
(__get_distance): Remove.
(__get_distance_from_begin): Remove.
(__get_distance_to_end): Remove.
(struct __is_safe_random_iterator<_Safe_iterator<>>): Remove partial
specialization.
(__base(const _Safe_iterator<>&, std::input_iterator_tag)): Remove.
(__base(const _Safe_iterator<>&, std::random_access_iterator_tag)): Remove.
(__base(const _Safe_iterator<>&)): Constraint to random access iterator.
* include/debug/safe_iterator.tcc
(_Safe_iterator<>::_M_get_distance_from_begin()): New.
(_Safe_iterator<>::_M_get_distance_to_end()): New.
(_Safe_iterator<>::_M_get_distance_to(const _Safe_iterator<>&)): New.
(_Safe_iterator<_It, _Seq, std::random_access_iterator_tag>
::_M_valid_range): New.
* include/debug/safe_local_iterator.h
(_Safe_local_iterator<>::_Const_local_iterator): Remove.
(_Safe_local_iterator<>::_IsConstant): New.
(_Safe_local_iterator<>::_OtherIterator): New.
(_Safe_local_iterator<_It, _Cont>::_Safe_local_iterator<_MutIte, _Cont>(
const _Safe_local_iterator<_MutIte, _Seq>&)): Add _IsConstant::__value
in __gnu_cxx::__enable_if condition. If singular compare base iterator
with _MutIte rather than _It.
(_Safe_local_iterator<>::_S_constant): Make constexpr.
(_Safe_local_iterator<>::_M_get_distance_to): New.
(__check_dereferenceable(const _Safe_local_iterator<>&)): Remove.
(__get_distance(const _Safe_local_iterator<>&,
const _Safe_local_iterator<>&, std::input_iterator_tag)): Remove.
(__valid_range(const _Safe_local_iterator<>&,
const _Safe_local_iterator<>&)): New.
* include/debug/safe_local_iterator.tcc
(_Safe_local_iterator<>::_M_get_distance_to): New.
* include/debug/deque (std::__debug::deque<>): Add
::__gnu_debug::_Safe_iterator<> friend declaration.
* include/debug/forward_list (std::__debug::forward_list<>): Likewise.
* include/debug/list (std::__debug::list<>): Likewise.
* include/debug/map.h (std::__debug::map<>): Likewise.
* include/debug/multimap.h (std::__debug::multimap<>): Likewise.
* include/debug/set.h (std::__debug::set<>): Likewise.
* include/debug/multiset.h (std::__debug::multiset<>): Likewise.
* include/debug/string (std::__debug::basic_string<>): Likewise.
* include/debug/unordered_map (std::__debug::unordered_map<>): Likewise
and add ::__gnu_debug::_Safe_local_iterator<> friend declaration.
(std::__debug::unordered_multimap<>): Likewise.
* include/debug/unordered_set (std::__debug::unordered_set<>): Likewise.
(std::__debug::unordered_multiset<>): Likewise.
* include/debug/formatter.h: Adapt.
* include/debug/helper_functions.h
(__gnu_debug::_Safe_local_iterator<>): Add declaration.
(__get_distance<_Ite>(_Ite, _Ite, std::random_access_iterator_tag):
Pass parameter by copy.
(__get_distance<_Ite>(_Ite, _Ite, std::input_iterator_tag): Likewise.
(__get_distance<_Ite>(_Ite, _Ite): Likewise.
(__valid_range_aux<_Integral>): Pass _Integral by copy.
(__valid_range<_InputIterator>): Pass _InputIterator by copy.
(__valid_range<>(const _Safe_iterator<>&,
const _Safe_iterator<>&, typename _Distance_traits<>::__type&)):
Declare.
(__valid_range(const _Safe_local_iterator<>&,
const _Safe_local_iterator<>&, typename _Distance_traits<>::__type&)):
Declare.
(__valid_range<>(const _Safe_iterator<>&, const _Safe_iterator<>&)):
Declare.
(__valid_range(const _Safe_local_iterator<>&, const _Safe_local_iterator<>&)):
Declare.
(__can_advance): Adapt.
(struct __is_safe_random_iterator<>): Remove.
(struct _SIter_base<>): Remove.
* include/debug/functions.h: Include <bits/stl_iterator.h>.
(__check_dereferenceable): Remove.
(__foreign_iterator_aux4, __foreign_iterator_aux3): Adapt.
(__foreign_iterator_aux2, __foreign_iterator_aux): Adapt.
(__foreign_iterator): Adapt.
* include/debug/stl_iterator.h
(__is_safe_random_iterator<std::reverse_iterator<>>): Remove.
(__base(const std::reverse_iterator<_Safe_iterator<_It, _Sq>)):
Constraint for random access iterators.
(__niter_base): Adapt.
* testsuite/util/testsuite_containers.h:
Include <bits/boost_concept_check.h>.
(iterator_concept_checks<_It, _Mutable, _Category>): New.
(citerator<_Cont>::forward_members::forward_members()): Instantiate
latter for container iterator and const_iterator.
* testsuite/23_containers/list/68222_neg.cc: New.
* testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Adapt
line number.
* testsuite/23_containers/unordered_set/debug/debug_functions.cc:
(test01): Remove.
* testsuite/23_containers/vector/debug/debug_functions.cc (test01):
Remove.

From-SVN: r263786

6 years agomodule.c (load_generic_interfaces): Move call to find_symbol() so that only occurs...
Andrew Benson [Wed, 22 Aug 2018 17:47:53 +0000 (17:47 +0000)]
module.c (load_generic_interfaces): Move call to find_symbol() so that only occurs if actually needed.

2018-08-22  Andrew Benson  <abensonca@gmail.com>

        * module.c (load_generic_interfaces): Move call to find_symbol()
        so that only occurs if actually needed.

From-SVN: r263784

6 years agoUpdate write after approval list
Andrew Benson [Wed, 22 Aug 2018 17:40:55 +0000 (17:40 +0000)]
Update write after approval list

2018-08-22  Andrew Benson  <abensonca@gmail.com>

        * MAINTAINERS: Add self to write after approval list.

From-SVN: r263783

6 years agore PR fortran/86888 ([F08] allocatable components of indirectly recursive type)
Janus Weil [Wed, 22 Aug 2018 17:10:00 +0000 (19:10 +0200)]
re PR fortran/86888 ([F08] allocatable components of indirectly recursive type)

fix PR 86888

2018-08-22  Janus Weil  <janus@gcc.gnu.org>

PR fortran/86888
* decl.c (gfc_match_data_decl): Allow allocatable components of
indirectly recursive type.
* resolve.c (resolve_component): Remove two errors messages ...
(resolve_fl_derived): ... and replace them by a new one.

2018-08-22  Janus Weil  <janus@gcc.gnu.org>

PR fortran/86888
* gfortran.dg/alloc_comp_basics_6.f90: Update an error message and add
an additional case.
* gfortran.dg/alloc_comp_basics_7.f90: New test case.
* gfortran.dg/class_17.f03: Update error message.
* gfortran.dg/class_55.f90: Ditto.
* gfortran.dg/dtio_11.f90: Update error messages.
* gfortran.dg/implicit_actual.f90: Add an error message.
* gfortran.dg/typebound_proc_12.f90: Update error message.

From-SVN: r263782

6 years agoPR middle-end/87052 - STRING_CST printing incomplete in Gimple dumps
Martin Sebor [Wed, 22 Aug 2018 16:42:56 +0000 (16:42 +0000)]
PR middle-end/87052 - STRING_CST printing incomplete in Gimple dumps

gcc/testsuite/ChangeLog:

PR middle-end/87052
* gcc.dg/pr87052.c: New test.
* gcc.dg/tree-ssa/dump-3.c: Adjust.

gcc/ChangeLog:

PR middle-end/87052
* tree-pretty-print.c (pretty_print_string): Add argument.
(dump_generic_node): Call to pretty_print_string with string size.

From-SVN: r263781

6 years ago[ fix changelog ]
Segher Boessenkool [Wed, 22 Aug 2018 16:04:09 +0000 (18:04 +0200)]
[ fix changelog ]

2018-08-22  Segher Boessenkool  <segher@kernel.crashing.org>

PR rtl-optimization/86771
* combine.c (try_combine): Do not allow splitting a resulting PARALLEL
of two SETs into those two SETs, one to be placed at i2, if that SETs
destination is modified between i2 and i3.

From-SVN: r263780

6 years agoChange AArch64 specific FMAX/FMIN tests into generic MAX_EXPR/MIN_EXPR tests
Szabolcs Nagy [Wed, 22 Aug 2018 15:12:05 +0000 (15:12 +0000)]
Change AArch64 specific FMAX/FMIN tests into generic MAX_EXPR/MIN_EXPR tests

gfortran now always uses MAX_EXPR/MIN_EXPR for MAX/MIN intrinsics, so the
AArch64 specific FMAX/FMIN tests are no longer valid.

2018-08-22  Szabolcs Nagy  <szabolcs.nagy@arm.com>

* gfortran.dg/max_fmax_aarch64.f90: Rename to...
* gfortran.dg/max_expr.f90: ...this.
* gfortran.dg/min_fmin_aarch64.f90: Rename to...
* gfortran.dg/min_expr.f90: ...this.

From-SVN: r263778

6 years agocombine: Do another check before splitting a parallel (PR86771)
Segher Boessenkool [Wed, 22 Aug 2018 13:41:05 +0000 (15:41 +0200)]
combine: Do another check before splitting a parallel (PR86771)

When combine splits a resulting parallel into its two SETs, it has to
place one at i2, and the other stays at i3.  This does not work if the
destination of the SET that will be placed at i2 is modified between
i2 and i3.  This patch fixes it.

* combine.c (try_combine): Do not allow splitting a resulting PARALLEL
of two SETs into those two SETs, one to be placed at i2, if that SETs
destination is modified between i2 and i3.

From-SVN: r263776

6 years ago[2/2] Fix bogus inner induction (PR 86725)
Richard Sandiford [Wed, 22 Aug 2018 13:02:48 +0000 (13:02 +0000)]
[2/2] Fix bogus inner induction (PR 86725)

This patch is the second part of the fix for PR 86725.  The problem
in the original test is that for:

  outer1:
    x_1 = PHI <x_4(outer2), ...>;
    ...

  inner:
    x_2 = PHI <x_1(outer1), x_3(...)>;
    ...
    x_3 = ...;
    ...

  outer2:
    x_4 = PHI <x_3(inner)>;
    ...

there are corner cases in which it is possible to classify the
inner phi as an induction but not the outer phi.  The -4.c test
is a more direct example.

After failing to classify x_1 as an induction, we go on to
classify it as a double reduction (which is basically true).
But we still classified the inner phi as an induction rather
than as part of a reduction, leading to an ICE when trying
to vectorise the outer phi.

We analyse the phis for outer loops first, so the simplest
fix is not to classify the phi as an induction if outer loop
analysis said that it should be a reduction.

The -2.c test is from the original PR.  The -3.c test is a
version in which "wo" really is used a reduction; this was
already correctly rejected, but for the wrong reason ("inner-loop
induction only used outside of the outer vectorized loop").
The -4.c test is another way of tickling the original problem
without relying on the undefinedness of signed overflow.
The -5.c test shows an (uninteresting) example in which the
patch prevents a spurious failure to vectorise the outer loop.

2018-08-22  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR tree-optimization/86725
* tree-vect-loop.c (vect_inner_phi_in_double_reduction_p): New
function.
(vect_analyze_scalar_cycles_1): Check it.

gcc/testsuite/
PR tree-optimization/86725
* gcc.dg/vect/no-scevccp-pr86725-2.c: New test.
* gcc.dg/vect/no-scevccp-pr86725-3.c: Likewise.
* gcc.dg/vect/no-scevccp-pr86725-4.c: Likewise.
* gcc.dg/vect/no-scevccp-pr86725-5.c: Likewise.

From-SVN: r263774

6 years ago[1/2] Fix bogus double reduction (PR 86725)
Richard Sandiford [Wed, 22 Aug 2018 13:02:39 +0000 (13:02 +0000)]
[1/2] Fix bogus double reduction (PR 86725)

This patch is the first part of the fix for PR 86725.  We would
treat x_1 in:

    outer1:
      x_1 = PHI <x_4(outer2), ...>;
      ...

    inner:
      x_2 = ...x_1...;
      ...
      x_3 = ...;
      ...

    outer2:
      x_4 = PHI <x_3(inner)>;
      ...

as a double reduction without checking what kind of statement x_2 is.
In practice it has to be a phi, since for other x_2, x_1 would simply
be a loop invariant that gets used for every inner loop iteration.

The idea with doing this patch first is that, by checking x_2 really
is a phi, we can hand off the validation of the rest of the reduction
to the phi analysis in the inner loop.

The test case is a variant of the one in the PR.

2018-08-22  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR tree-optimization/86725
* tree-vect-loop.c (vect_is_simple_reduction): When treating
an outer loop phi as a double reduction, make sure that the
single user of the phi result is an inner loop phi.

gcc/testsuite/
PR tree-optimization/86725
* gcc.dg/vect/no-scevccp-pr86725-1.c: New test.

From-SVN: r263773

6 years agoMake the vectoriser drop to strided accesses for stores with gaps
Richard Sandiford [Wed, 22 Aug 2018 12:59:08 +0000 (12:59 +0000)]
Make the vectoriser drop to strided accesses for stores with gaps

We could vectorise:

     for (...)
       {
         a[0] = ...;
         a[1] = ...;
         a[2] = ...;
         a[3] = ...;
         a += stride;
       }

(including the case when stride == 8) but not:

     for (...)
       {
         a[0] = ...;
         a[1] = ...;
         a[2] = ...;
         a[3] = ...;
         a += 8;
       }

(where the stride is always 8).  The former was treated as a "grouped
and strided" store, while the latter was treated as a grouped store
with gaps, which we don't support.

This patch makes us treat groups of stores with gaps at the end as
strided groups too.  I tried to go through all uses of STMT_VINFO_STRIDED_P
and all vector uses of DR_STEP to see whether there were any hard-baked
assumptions, but couldn't see any.  I wondered whether we should relax:

  /* We do not have to consider dependences between accesses that belong
     to the same group, unless the stride could be smaller than the
     group size.  */
  if (DR_GROUP_FIRST_ELEMENT (stmtinfo_a)
      && (DR_GROUP_FIRST_ELEMENT (stmtinfo_a)
          == DR_GROUP_FIRST_ELEMENT (stmtinfo_b))
      && !STMT_VINFO_STRIDED_P (stmtinfo_a))
    return false;

for cases in which the step is constant and the absolute step is known
to be greater than the group size, but data dependence analysis should
already return chrec_known for those cases.

The new test is a version of vect-avg-15.c with the variable step
replaced by a constant one.

A natural follow-on would be to do the same for groups with gaps in
the middle:

          /* Check that the distance between two accesses is equal to the type
             size. Otherwise, we have gaps.  */
          diff = (TREE_INT_CST_LOW (DR_INIT (data_ref))
                  - TREE_INT_CST_LOW (prev_init)) / type_size;
          if (diff != 1)
            {
              [...]
              if (DR_IS_WRITE (data_ref))
                {
                  if (dump_enabled_p ())
                    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                                     "interleaved store with gaps\n");
                  return false;
                }

But I think we should do that separately and see what the fallout
from this change is first.

2018-08-22  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-data-refs.c (vect_analyze_group_access_1): Convert
grouped stores with gaps to a strided group.

gcc/testsuite/
* gcc.dg/vect/vect-avg-16.c: New test.
* gcc.dg/vect/slp-37.c: Expect the loop to be vectorized.
* gcc.dg/vect/vect-strided-u8-i8-gap4.c,
* gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c: Likewise for
the second loop in main1.

From-SVN: r263772

6 years agoOnly test STMT_VINFO_STRIDED_P for the first statement in a group
Richard Sandiford [Wed, 22 Aug 2018 12:58:53 +0000 (12:58 +0000)]
Only test STMT_VINFO_STRIDED_P for the first statement in a group

get_load_store_type & co were testing STMT_VINFO_STRIDED_P on individual
statements in a group instead of the first.  This has no effect on
its own, but is needed by a later patch.

2018-08-22  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-stmts.c (get_group_load_store_type)
(get_load_store_type): Only test STMT_VINFO_STRIDED_P for the
first statement in a group.

From-SVN: r263771

6 years agoUdate Darwin's LTO specs to match what's in gcc/gcc.c
Iain Sandoe [Wed, 22 Aug 2018 12:31:23 +0000 (12:31 +0000)]
Udate Darwin's LTO specs to match what's in gcc/gcc.c

gcc/
* config/darwin.h (LINK_COMMAND_SPEC_A): Sync LTO options with
the sequence used in gcc/gcc.c.

From-SVN: r263770

6 years agostringify __USER_LABEL_PREFIX__ in pr85248 testcase.
Iain Sandoe [Wed, 22 Aug 2018 12:22:07 +0000 (12:22 +0000)]
stringify __USER_LABEL_PREFIX__ in pr85248 testcase.

gcc/testsuite

* gcc.dg/lto/pr85248_0.c (test_alias):
Stringify __USER_LABEL_PREFIX__.
(test_noreturn): Likewise.

From-SVN: r263769

6 years agoMake the gcc-ar,nm, strip tools respond correctly to --help and --version
Iain Sandoe [Wed, 22 Aug 2018 12:12:46 +0000 (12:12 +0000)]
Make the gcc-ar,nm, strip tools respond correctly to --help and --version
when there's no plugin built.

gcc/

PR other/704
* gcc-ar.c (main): Don’t try to invoke the plug-in if we’re not
building it.

From-SVN: r263768

6 years agoPR libstdc++/77854 document size_type for containers
Jonathan Wakely [Wed, 22 Aug 2018 12:11:17 +0000 (13:11 +0100)]
PR libstdc++/77854 document size_type for containers

PR libstdc++/77854
* doc/xml/manual/status_cxx1998.xml: Document size_type and
difference_type for containers.
* doc/html/*: Regenerate.

From-SVN: r263767

6 years agocommit missed change from r263764
Iain Sandoe [Wed, 22 Aug 2018 12:05:45 +0000 (12:05 +0000)]
commit missed change from r263764

From-SVN: r263766

6 years agoMove Darwin10 unwinder fix to a crt shim.
Iain Sandoe [Wed, 22 Aug 2018 11:58:43 +0000 (11:58 +0000)]
Move Darwin10 unwinder fix to a crt shim.

gcc/
* config/darwin10.h (LINK_GCC_C_SEQUENCE_SPEC): Adjust to use the
Darwin10-specific unwinder-shim.
* config/darwin12.h (LINK_GCC_C_SEQUENCE_SPEC): Remove.
* config/rs6000/darwin.h (DARWIN_CRT1_SPEC, DARWIN_DYLIB1_SPEC):
New to cater for Darwin10 Rosetta.

libgcc/
* config/unwind-dw2-fde-darwin.c
(_darwin10_Unwind_FindEnclosingFunction): move from here ...
* config/darwin10-unwind-find-enc-func.c: … to here.
* config/t-darwin: Build Darwin10 unwinder shim crt.
* libgcc/config.host: Add the Darwin10 unwinder shim.

From-SVN: r263765

6 years agoAllw for Darwin to operate with an assembler supporting gotoff in data.
Iain Sandoe [Wed, 22 Aug 2018 11:42:53 +0000 (11:42 +0000)]
Allw for Darwin to operate with an assembler supporting gotoff in data.

gcc/

* config/i386/i386.c (ix86_output_addr_diff_elt): Move the MACH-O
specific test before the one for HAVE_AS_GOTOFF_IN_DATA.

From-SVN: r263764

6 years agoFix FDE labels for Darwin
Iain Sandoe [Wed, 22 Aug 2018 11:37:02 +0000 (11:37 +0000)]
Fix FDE labels for Darwin

gcc/

PR bootstrap/81033
PR target/81733
PR target/52795
* gcc/dwarf2out.c (FUNC_SECOND_SECT_LABEL): New.
(dwarf2out_switch_text_section): Generate a local label for the second
function sub-section and apply it as the second FDE start label.
* gcc/final.c (final_scan_insn_1): Emit second FDE label after the second
sub-section start.

From-SVN: r263763

6 years agore PR tree-optimization/86988 (ICE: tree check: expected integer_cst, have var_decl...
Richard Biener [Wed, 22 Aug 2018 11:01:58 +0000 (11:01 +0000)]
re PR tree-optimization/86988 (ICE: tree check: expected integer_cst, have var_decl in get_len, at tree.h:5563)

2018-08-22  Richard Biener  <rguenther@suse.de>

PR tree-optimization/86988
* tree-vrp.c (vrp_prop::check_mem_ref): Bail out on VLAs.

* g++.dg/pr86988.C: New testcase.

From-SVN: r263762

6 years agore PR tree-optimization/86945 (BUG with optimisation of select case statement in...
Richard Biener [Wed, 22 Aug 2018 08:07:36 +0000 (08:07 +0000)]
re PR tree-optimization/86945 (BUG with optimisation of select case statement in gfortran)

2018-08-22  Richard Biener  <rguenther@suse.de>

PR tree-optimization/86945
* tree-cfg.c (generate_range_test): Use unsigned arithmetic.

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

From-SVN: r263761

6 years agors6000 small data: add note on sdata2/r2
Alexandre Oliva [Wed, 22 Aug 2018 03:48:00 +0000 (03:48 +0000)]
rs6000 small data: add note on sdata2/r2

for  gcc/ChangeLog

* config/rs6000/rs6000.c (SMALL_DATA_RELOC, SMALL_DATA_REG): Add
a comment about how uses of r2 for .sdata2 come about.

From-SVN: r263760

6 years agofix reassoc cut&pasto
Alexandre Oliva [Wed, 22 Aug 2018 03:47:48 +0000 (03:47 +0000)]
fix reassoc cut&pasto

for  gcc/ChangeLog

* tree-ssa-reassoc.c (is_reassociable_op): Fix cut&pasto.

From-SVN: r263759

6 years agoDaily bump.
GCC Administrator [Wed, 22 Aug 2018 00:16:29 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263758

6 years agoP0646R1 Improving the Return Value of Erase-Like Algorithms I
François Dumont [Tue, 21 Aug 2018 19:44:41 +0000 (19:44 +0000)]
P0646R1 Improving the Return Value of Erase-Like Algorithms I

2018-08-21  François Dumont  <fdumont@gcc.gnu.org>

P0646R1 Improving the Return Value of Erase-Like Algorithms I
* include/debug/forward_list (forward_list::__remove_return_type):
Define typedef as size_type or void, according to __cplusplus value.
(_GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
empty, according to __cplusplus value.
(_GLIBCXX20_ONLY): Define macro.
(forward_list::remove, forward_list::unique): Use typedef and macro
to change return type and add abi-tag for C++2a. Return number of
removed elements for C++2a.
(forward_list::remove_if<Pred>, forward_list::unique<BinPred>): Use
typedef to change return type for C++2a. Return number of removed
elements for C++2a.
* include/debug/list (list::__remove_return_type): Define typedef as
size_type or void, according to __cplusplus value.
(_GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
empty, according to __cplusplus value.
(_GLIBCXX20_ONLY): Define macro.
(list::remove, list::unique): Use typedef and macro to change return
type and add abi-tag for C++2a. Return number of removed elements for
C++2a.
(list::remove_if<Predicate>, list::unique<BinaryPredicate>): Use typedef
to change return type for C++2a. Return number of removed elements for
C++2a.

From-SVN: r263752

6 years agoUnconditionally use MAX_EXPR/MIN_EXPR for MAX/MIN intrinsics
Janne Blomqvist [Tue, 21 Aug 2018 19:36:13 +0000 (22:36 +0300)]
Unconditionally use MAX_EXPR/MIN_EXPR for MAX/MIN intrinsics

For floating point types, the question is what MAX(a, NaN) or MIN(a,
NaN) should return (where "a" is a normal number).  There are valid
usecases for returning either one, but the Fortran standard doesn't
specify which one should be chosen.  Also, there is no consensus among
other tested compilers.  In short, it's a mess.  So lets just do
whatever is fastest, which is using MAX_EXPR/MIN_EXPR which are not
defined to do anything in particular if one of the operands is a NaN.

gcc/fortran/ChangeLog:

2018-08-21  Janne Blomqvist  <jb@gcc.gnu.org>

* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Use
MAX_EXPR/MIN_EXPR unconditionally for real arguments.
* gfortran.texi (Compiler Characteristics): Document MAX/MIN
behavior wrt NaN.

gcc/testsuite/ChangeLog:

2018-08-21  Janne Blomqvist  <jb@gcc.gnu.org>

* gfortran.dg/nan_1.f90: Remove tests that test MAX/MIN with NaNs.

From-SVN: r263751

6 years agore PR fortran/25829 ([F03] Asynchronous IO support)
Nicolas Koenig [Tue, 21 Aug 2018 18:48:59 +0000 (18:48 +0000)]
re PR fortran/25829 ([F03] Asynchronous IO support)

2018-08-21  Nicolas Koenig  <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>

PR fortran/25829
* gfortran.texi: Add description of asynchronous I/O.
* trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables
as volatile.
* trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to
st_wait_async and change argument spec from ".X" to ".w".
(gfc_trans_wait): Pass ID argument via reference.

2018-08-21  Nicolas Koenig  <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>

PR fortran/25829
* gfortran.dg/f2003_inquire_1.f03: Add write statement.
* gfortran.dg/f2003_io_1.f03: Add wait statement.

2018-08-21  Nicolas Koenig  <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>

PR fortran/25829
* Makefile.am: Add async.c to gfor_io_src.
Add async.h to gfor_io_headers.
* Makefile.in: Regenerated.
* gfortran.map: Add _gfortran_st_wait_async.
* io/async.c: New file.
* io/async.h: New file.
* io/close.c: Include async.h.
(st_close): Call async_wait for an asynchronous unit.
* io/file_pos.c (st_backspace): Likewise.
(st_endfile): Likewise.
(st_rewind): Likewise.
(st_flush): Likewise.
* io/inquire.c: Add handling for asynchronous PENDING
and ID arguments.
* io/io.h (st_parameter_dt): Add async bit.
(st_parameter_wait): Correct.
(gfc_unit): Add au pointer.
(st_wait_async): Add prototype.
(transfer_array_inner): Likewise.
(st_write_done_worker): Likewise.
* io/open.c: Include async.h.
(new_unit): Initialize asynchronous unit.
* io/transfer.c (async_opt): New struct.
(wrap_scalar_transfer): New function.
(transfer_integer): Call wrap_scalar_transfer to do the work.
(transfer_real): Likewise.
(transfer_real_write): Likewise.
(transfer_character): Likewise.
(transfer_character_wide): Likewise.
(transfer_complex): Likewise.
(transfer_array_inner): New function.
(transfer_array): Call transfer_array_inner.
(transfer_derived): Call wrap_scalar_transfer.
(data_transfer_init): Check for asynchronous I/O.
Perform a wait operation on any pending asynchronous I/O
if the data transfer is synchronous. Copy PDT and enqueue
thread for data transfer.
(st_read_done_worker): New function.
(st_read_done): Enqueue transfer or call st_read_done_worker.
(st_write_done_worker): New function.
(st_write_done): Enqueue transfer or call st_read_done_worker.
(st_wait): Document as no-op for compatibility reasons.
(st_wait_async): New function.
* io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK;
add NOTE where necessary.
(get_gfc_unit): Likewise.
(init_units): Likewise.
(close_unit_1): Likewise. Call async_close if asynchronous.
(close_unit): Use macros LOCK and UNLOCK.
(finish_last_advance_record): Likewise.
(newunit_alloc): Likewise.
* io/unix.c (find_file): Likewise.
(flush_all_units_1): Likewise.
(flush_all_units): Likewise.
* libgfortran.h (generate_error_common): Add prototype.
* runtime/error.c: Include io.h and async.h.
(generate_error_common): New function.

2018-08-21  Nicolas Koenig  <koenigni@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>

PR fortran/25829
* testsuite/libgomp.fortran/async_io_1.f90: New test.
* testsuite/libgomp.fortran/async_io_2.f90: New test.
* testsuite/libgomp.fortran/async_io_3.f90: New test.
* testsuite/libgomp.fortran/async_io_4.f90: New test.
* testsuite/libgomp.fortran/async_io_5.f90: New test.
* testsuite/libgomp.fortran/async_io_6.f90: New test.
* testsuite/libgomp.fortran/async_io_7.f90: New test.

Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>
From-SVN: r263750

6 years agore PR c++/86499 (lambda-expressions with capture-default are allowed at namespace...
Marek Polacek [Tue, 21 Aug 2018 18:37:23 +0000 (18:37 +0000)]
re PR c++/86499 (lambda-expressions with capture-default are allowed at namespace scope)

PR c++/86499
* parser.c (cp_parser_lambda_introducer): Give error if a non-local
lambda has a capture-default.

* g++.dg/cpp0x/lambda/lambda-non-local.C: New test.
* g++.dg/cpp0x/lambda/lambda-this10.C: Adjust dg-error.

From-SVN: r263749

6 years agodecl.c (check_static_variable_definition): Change to return void.
Paolo Carlini [Tue, 21 Aug 2018 15:49:58 +0000 (15:49 +0000)]
decl.c (check_static_variable_definition): Change to return void.

2018-08-21  Paolo Carlini  <paolo.carlini@oracle.com>

* decl.c (check_static_variable_definition): Change to return void.

From-SVN: r263742

6 years agoPR c++/86981, Implement -Wpessimizing-move.
Marek Polacek [Tue, 21 Aug 2018 15:38:36 +0000 (15:38 +0000)]
PR c++/86981, Implement -Wpessimizing-move.

* c.opt (Wpessimizing-move): New option.

* typeck.c (decl_in_std_namespace_p): New.
(is_std_move_p): New.
(maybe_warn_pessimizing_move): New.
(can_do_nrvo_p): New, factored out of ...
(check_return_expr): ... here.  Warn about potentially harmful
std::move in a return statement.

* doc/invoke.texi: Document -Wpessimizing-move.

* g++.dg/cpp0x/Wpessimizing-move1.C: New test.
* g++.dg/cpp0x/Wpessimizing-move2.C: New test.
* g++.dg/cpp0x/Wpessimizing-move3.C: New test.
* g++.dg/cpp0x/Wpessimizing-move4.C: New test.
* g++.dg/cpp1z/Wpessimizing-move1.C: New test.

From-SVN: r263741

6 years agore PR c++/65043 (Expected narrowing conversion during list initialization of bool...
Marek Polacek [Tue, 21 Aug 2018 15:25:17 +0000 (15:25 +0000)]
re PR c++/65043 (Expected narrowing conversion during list initialization of bool from double)

PR c++/65043
* call.c (standard_conversion): Set check_narrowing.
* typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
than comparing with INTEGER_TYPE.

* g++.dg/concepts/pr67595.C: Add dg-warning.
* g++.dg/cpp0x/Wnarrowing11.C: New test.
* g++.dg/cpp0x/Wnarrowing12.C: New test.
* g++.dg/cpp0x/rv-cast5.C: Add static_cast.

From-SVN: r263739

6 years ago* cp-tree.h: Fix typo.
Marek Polacek [Tue, 21 Aug 2018 15:10:51 +0000 (15:10 +0000)]
* cp-tree.h: Fix typo.

From-SVN: r263738

6 years ago[Ada] Minor reformattings
Hristian Kirtchev [Tue, 21 Aug 2018 14:50:03 +0000 (14:50 +0000)]
[Ada] Minor reformattings

2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* checks.adb, contracts.adb, exp_aggr.adb, exp_attr.adb,
exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, exp_unst.adb,
exp_util.adb, freeze.adb, gnatlink.adb, layout.adb,
lib-writ.adb, lib-xref-spark_specific.adb, sem_ch13.adb,
sem_ch3.adb, sem_ch6.adb, sem_res.adb, sem_util.adb, sinfo.ads,
sprint.adb: Minor reformatting.

From-SVN: r263737