1. 01 Aug, 2018 15 commits
  2. 31 Jul, 2018 25 commits
    • PR libstdc++/86751 default assignment operators for std::pair · e1821582
      The solution for PR 77537 causes ambiguities due to the extra copy
      assignment operator taking a __nonesuch_no_braces parameter. By making
      the base class non-assignable we don't need the extra deleted overload
      in std::pair. The copy assignment operator will be implicitly deleted
      (and the move assignment operator not declared) as needed. Without the
      additional user-provided operator in std::pair the ambiguity is avoided.
      
      	PR libstdc++/86751
      	* include/bits/stl_pair.h (__pair_base): New class with deleted copy
      	assignment operator.
      	(pair): Derive from __pair_base.
      	(pair::operator=): Remove deleted overload.
      	* python/libstdcxx/v6/printers.py (StdPairPrinter): New pretty printer
      	so that new base class isn't shown in GDB.
      	* testsuite/20_util/pair/86751.cc: New test.
      	* testsuite/20_util/pair/ref_assign.cc: New test.
      
      From-SVN: r263185
      Jonathan Wakely committed
    • Don't unconditionally define feature test macros in <version> · ff273400
      The macro definitions in <version> should depend on the same
      preprocessor conditions as the original macros in other headers.
      Otherwise <version> can define macros that imply the availability of
      features that are not actually defined.
      
      This fix is incomplete, as __cpp_lib_filesystem should depend on whether
      libstdc++fs.a is supported, and several macros should only be defined
      when _GLIBCXX_HOSTED is defined. Also, the feature test macros should
      define their value as type long, but most are type int.
      
      	* include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)
      	(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE): Move definitions here.
      	(_GLIBCXX_HAVE_BUILTIN_LAUNDER): Likewise. Use !__is_identifier
      	instead of __has_builtin.
      	* include/std/type_traits (_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)
      	(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE): Remove definitions from here.
      	* include/std/version [!_GLIBCXX_HAS_GTHREADS]
      	(__cpp_lib_shared_timed_mutex, __cpp_lib_scoped_lock)
      	(__cpp_lib_shared_mutex): Don't define when Gthreads not in use.
      	[!_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP]
      	(__cpp_lib_has_unique_object_representations): Don't define when
      	builtin not available.
      	[!_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE] (__cpp_lib_is_aggregate):
      	Likewise.
      	[!_GLIBCXX_HAVE_BUILTIN_LAUNDER] (__cpp_lib_launder): Likewise.
      	* libsupc++/new (_GLIBCXX_HAVE_BUILTIN_LAUNDER): Remove definition
      	from here.
      
      From-SVN: r263184
      Jonathan Wakely committed
    • Save discriminator info for LTO · b348c78a
      for  gcc/ChangeLog
      
      	* gimple-streamer-in.c (input_bb): Restore BB discriminator.
      	* gimple-streamer-out.c (output_bb): Save it.
      	* lto-streamer-in.c (input_struct_function_base): Restore
      	instance discriminator if available.  Create map on demand.
      	* lto-streamer-out.c (output_struct_function_base): Save it if
      	available.
      	* final.c (decl_to_instance_map): Document LTO strategy.
      
      From-SVN: r263183
      Alexandre Oliva committed
    • Introduce instance discriminators · fa6fd7b7
      With -gnateS, the Ada compiler sets itself up to output discriminators
      for different instantiations of generics, but the middle and back ends
      have lacked support for that.  This patch introduces the missing bits,
      translating the GNAT-internal representation of the per-file instance
      map to an instance_table that maps decls to instance discriminators.
      
      
      From: Alexandre Oliva  <oliva@adacore.com>, Olivier Hainque  <hainque@adacore.com>
      for  gcc/ChangeLog
      
      	* debug.h (decl_to_instance_map_t): New type.
      	(decl_to_instance_map): Declare.
      	(maybe_create_decl_to_instance_map): New inline function.
          	* final.c (bb_discriminator, last_bb_discriminator): New statics,
          	to track basic block discriminators.
          	(final_start_function_1): Initialize them.
          	(final_scan_insn_1): On NOTE_INSN_BASIC_BLOCK, track
      	bb_discriminator.
      	(decl_to_instance_map): New variable.
      	(map_decl_to_instance, maybe_set_discriminator): New functions.
          	(notice_source_line): Set discriminator.
      
      for  gcc/ada/ChangeLog
      
      	* trans.c: Include debug.h.
      	(file_map): New static variable.
      	(gigi): Set it.  Create decl_to_instance_map when needed.
      	(Subprogram_Body_to_gnu): Pass gnu_subprog_decl to...
      	(Sloc_to_locus): ... this.  Add decl parm, map it to instance.
      	* gigi.h (Sloc_to_locus): Adjust declaration.
      
      for  gcc/testsuite/ChangeLog
      
      	* gnat.dg/dinst.adb: New.
      	* gnat.dg/dinst_pkg.ads, gnat.dg/dinst_pkg.adb: New.
      
      Co-Authored-By: Olivier Hainque <hainque@adacore.com>
      
      From-SVN: r263182
      Alexandre Oliva committed
    • c-family: clean up the data tables in c-format.c · e540ccc0
      The format_char_info tables in c-format.c for our own formats contain
      a lot of repetition.
      
      This patch adds a macro to express the conversion specifiers implemented
      within pp_format, making it clearer which are custom ones added by the
      various diagnostic_format_decoder callbacks.
      
      Doing so uncovered a few mistakes in the data (based on comparison with
      the source of the diagnostic_format_decoder callbacks, and the notes
      below), which the patch fixes:
      
      - gcc_diag_char_table didn't have 'Z', but it *is* implemented by pp_format.
      
      - removed erroneous 'G' and 'K' entries from gcc_diag_char_table: they're
        implemented by default_tree_printer (and thus in "tdiag") and by the
        C/C++ FEs, but not in pp_format.
      
      - removed "v" (lower case) from gcc_tdiag_char_table and
        gcc_cxxdiag_char_table
      
      Notes:
      
      pretty-print.h uses this for ATTRIBUTE_GCC_PPDIAG, used by pp_printf
      and pp_verbatim:
      
      whereas diagnostic-core.h uses this for ATTRIBUTE_GCC_DIAG, used by
      the various diagnostic functions:
      
      /* If we haven't already defined a front-end-specific diagnostics
         style, use the generic one.  */
      
      Hence I'm assuming that __gcc_diag__ is for use for when we don't
      know what kind of diagnostic_format_decoder we have, and we can
      only rely on pp_format's core functionality, where __gcc_tdiag__
      is allowed to assume default_tree_printer.
      
      gcc/c-family/ChangeLog:
      	* c-format.c (PP_FORMAT_CHAR_TABLE): New macro, based on existing
      	table entries for gcc_diag_char_table, and the 'Z' entry from
      	gcc_tdiag_char_table, changing the "chain" entry for 'Z' from
      	&gcc_tdiag_char_table[0] to &gcc_diag_char_table[0].
      	(gcc_diag_char_table): Use PP_FORMAT_CHAR_TABLE, implicitly
      	adding missing "Z" for this table.  Remove erroneous "G" and "K"
      	entries.
      	(gcc_tdiag_char_table): Use PP_FORMAT_CHAR_TABLE.  Remove "v".
      	(gcc_cdiag_char_table): Use PP_FORMAT_CHAR_TABLE.
      	(gcc_cxxdiag_char_table): Use PP_FORMAT_CHAR_TABLE.  Remove "v".
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/format/gcc_diag-1.c (foo): Update the %v tests for
      	tdiag and cxxdiag.
      	* gcc.dg/format/gcc_diag-10.c (test_diag): Update tests of %G
      	and %K.
      
      From-SVN: r263181
      David Malcolm committed
    • targhooks.c (default_have_speculation_safe_value): Add ATTRIBUTE_UNUSED. · 31d87dd2
      	* targhooks.c (default_have_speculation_safe_value): Add
      	ATTRIBUTE_UNUSED.
      
      From-SVN: r263180
      Ian Lance Taylor committed
    • dumpfile.c: eliminate special-casing of dump_file/alt_dump_file · b84e3bde
      With the addition of optinfo, the various dump_* calls had three parts:
      - optionally print to dump_file
      - optionally print to alt_dump_file
      - optionally make an optinfo_item and add it to the pending optinfo,
        creating it for dump_*_loc calls.
      
      However, this split makes it difficult to implement the formatted dumps
      later in patch kit, so as enabling work towards that, this patch removes
      the above split, so that all dumping within the dump_* API goes through
      optinfo_item.
      
      In order to ensure that the dumps to dump_file and alt_dump_file are
      processed immediately (rather than being buffered within the pending
      optinfo for consolidation), this patch introduces the idea of "immediate"
      optinfo_item destinations vs "non-immediate" destinations.
      
      The patch also adds selftest coverage of what's printed, and of scopes.
      
      This adds two allocations per dump_* call when dumping is enabled.
      I'm assuming that this isn't a problem, as dump_enabled_p is normally
      false.  There are ways of optimizing it if it is an issue (by making
      optinfo_item instances become temporaries that borrow the underlying
      buffer), but they require nontrivial changes, so I'd prefer to leave
      that for another patch kit, if it becomes necessary.
      
      gcc/ChangeLog:
      	* dump-context.h: Include "pretty-print.h".
      	(dump_context::refresh_dumps_are_enabled): New decl.
      	(dump_context::emit_item): New decl.
      	(class dump_context): Add fields "m_test_pp" and
      	"m_test_pp_flags".
      	(temp_dump_context::temp_dump_context): Add param "test_pp_flags".
      	(temp_dump_context::get_dumped_text): New decl.
      	(class temp_dump_context): Add field "m_pp".
      	* dumpfile.c (refresh_dumps_are_enabled): Convert to...
      	(dump_context::refresh_dumps_are_enabled): ...and add a test for
      	m_test_pp.
      	(set_dump_file): Update for above change.
      	(set_alt_dump_file): Likewise.
      	(dump_loc): New overload, taking a pretty_printer *.
      	(dump_context::dump_loc): Call end_any_optinfo.  Dump the location
      	to any test pretty-printer.
      	(make_item_for_dump_gimple_stmt): New function, adapted from
      	optinfo::add_gimple_stmt.
      	(dump_context::dump_gimple_stmt): Call it, and use the result,
      	eliminating the direct usage of dump_file and alt_dump_file in
      	favor of indirectly using them via emit_item.
      	(make_item_for_dump_gimple_expr): New function, adapted from
      	optinfo::add_gimple_expr.
      	(dump_context::dump_gimple_expr): Call it, and use the result,
      	eliminating the direct usage of dump_file and alt_dump_file in
      	favor of indirectly using them via emit_item.
      	(make_item_for_dump_generic_expr): New function, adapted from
      	optinfo::add_tree.
      	(dump_context::dump_generic_expr): Call it, and use the result,
      	eliminating the direct usage of dump_file and alt_dump_file in
      	favor of indirectly using them via emit_item.
      	(make_item_for_dump_printf_va): New function, adapted from
      	optinfo::add_printf_va.
      	(make_item_for_dump_printf): New function.
      	(dump_context::dump_printf_va): Call make_item_for_dump_printf_va,
      	and use the result, eliminating the direct usage of dump_file and
      	alt_dump_file in favor of indirectly using them via emit_item.
      	(make_item_for_dump_dec): New function.
      	(dump_context::dump_dec): Call it, and use the result,
      	eliminating the direct usage of dump_file and alt_dump_file in
      	favor of indirectly using them via emit_item.
      	(make_item_for_dump_symtab_node): New function, adapted from
      	optinfo::add_symtab_node.
      	(dump_context::dump_symtab_node): Call it, and use the result,
      	eliminating the direct usage of dump_file and alt_dump_file in
      	favor of indirectly using them via emit_item.
      	(dump_context::begin_scope): Reimplement, avoiding direct usage
      	of dump_file and alt_dump_file in favor of indirectly using them
      	via emit_item.
      	(dump_context::emit_item): New member function.
      	(temp_dump_context::temp_dump_context): Add param "test_pp_flags".
      	Set up test pretty-printer on the underlying context.  Call
      	refresh_dumps_are_enabled.
      	(temp_dump_context::~temp_dump_context): Call
      	refresh_dumps_are_enabled.
      	(temp_dump_context::get_dumped_text): New member function.
      	(selftest::verify_dumped_text): New function.
      	(ASSERT_DUMPED_TEXT_EQ): New macro.
      	(selftest::test_capture_of_dump_calls): Run all tests twice, with
      	and then without optinfo enabled.  Add uses of
      	ASSERT_DUMPED_TEXT_EQ to all tests.  Add test of nested scopes.
      	* dumpfile.h: Update comment for the dump_* API.
      	* optinfo-emit-json.cc
      	(selftest::test_building_json_from_dump_calls): Update for new
      	param for temp_dump_context ctor.
      	* optinfo.cc (optinfo_item::optinfo_item): Remove "owned" param
      	and "m_owned" field.
      	(optinfo_item::~optinfo_item): Likewise.
      	(optinfo::add_item): New member function.
      	(optinfo::emit): Update comment.
      	(optinfo::add_string): Delete.
      	(optinfo::add_printf): Delete.
      	(optinfo::add_printf_va): Delete.
      	(optinfo::add_gimple_stmt): Delete.
      	(optinfo::add_gimple_expr): Delete.
      	(optinfo::add_tree): Delete.
      	(optinfo::add_symtab_node): Delete.
      	(optinfo::add_dec): Delete.
      	* optinfo.h (class dump_context): New forward decl.
      	(optinfo::add_item): New decl.
      	(optinfo::add_string): Delete.
      	(optinfo::add_printf): Delete.
      	(optinfo::add_printf_va): Delete.
      	(optinfo::add_gimple_stmt): Delete.
      	(optinfo::add_gimple_expr): Delete.
      	(optinfo::add_tree): Delete.
      	(optinfo::add_symtab_node): Delete.
      	(optinfo::add_dec): Delete.
      	(optinfo::add_poly_int): Delete.
      	(optinfo_item::optinfo_item): Remove "owned" param.
      	(class optinfo_item): Remove field "m_owned".
      
      From-SVN: r263178
      David Malcolm committed
    • re PR middle-end/86705 (pr45678-2.c ICE with msp430-elf -mlarge) · b06e1dce
      	PR middle-end/86705
      
      	* gcc/cfgexpand.c (set_parm_rtl): Use the alignment of Pmode when
      	MAX_SUPPORTED_STACK_ALIGNMENT would otherwise be exceeded by the
      	requested variable alignment.
      	(expand_one_ssa_partition): Likewise.
      	(expand_one_var): Likewise.
      
      From-SVN: r263177
      Jozef Lawrynowicz committed
    • pdp11 - example of a port not needing a speculation barrier · 31f52518
      This patch is intended as an example of all that is needed if the
      target system doesn't support CPUs that have speculative execution.
      I've chosen the pdp11 port on the basis that it's old enough that this
      is likely to be true for all existing implementations and that there
      is also little chance of that changing in future!
      
      	* config/pdp11/pdp11.c (TARGET_HAVE_SPECULATION_SAFE_VALUE): Redefine
      	to speculation_safe_value_not_needed.
      
      From-SVN: r263176
      Richard Earnshaw committed
    • targhooks - provide an alternative hook for targets that never execute speculatively · f3debef3
      This hook adds an alternative implementation for the target hook
      TARGET_HAVE_SPECULATION_SAFE_VALUE; it can be used by targets that have no
      CPU implementations that execute code speculatively.  All that is needed for
      such targets now is to add:
      
       #undef TARGET_HAVE_SPECULATION_SAFE_VALUE
       #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed.
      
      to where you have your other target hooks and you're done.
      
      gcc:
      	* targhooks.h (speculation_safe_value_not_needed): New prototype.
      	* targhooks.c (speculation_safe_value_not_needed): New function.
      	* target.def (have_speculation_safe_value): Update documentation.
      	* doc/tm.texi: Regenerated.
      
      From-SVN: r263175
      Richard Earnshaw committed
    • AArch64 - use CSDB based sequences if speculation tracking is enabled · c0111dc4
      In this final patch, now that we can track speculation through conditional
      branches, we can use this information to use a less expensive CSDB based
      speculation barrier.
      
      	* config/aarch64/iterators.md (ALLI_TI): New iterator.
      	* config/aarch64/aarch64.md (despeculate_copy<ALLI_TI:mode>): New
      	expand.
      	(despeculate_copy<ALLI:mode>_insn): New insn.
      	(despeculate_copyti_insn): New insn.
      	(despeculate_simple<ALLI:mode>): New insn
      	(despeculate_simpleti): New insn.
      	* config/aarch64/aarch64.c (aarch64_speculation_safe_value): New
      	function.
      	(TARGET_SPECULATION_SAFE_VALUE): Redefine to
      	aarch64_speculation_safe_value.
      	(aarch64_print_operand): Handle const0_rtx in modifier 'H'.
      
      From-SVN: r263174
      Richard Earnshaw committed
    • AArch64 - new pass to add conditional-branch speculation tracking · 3751345d
      This patch is the main part of the speculation tracking code.  It adds
      a new target-specific pass that is run just before the final branch
      reorg pass (so that it can clean up any new edge insertions we make).
      The pass is only run with -mtrack-speculation is passed on the command
      line.
      
      One thing that did come to light as part of this was that the stack pointer
      register was not being permitted in comparision instructions.  We rely on
      that for moving the tracking state between SP and the scratch register at
      function call boundaries.
      
      	* config/aarch64/aarch64-speculation.cc: New file.
      	* config/aarch64/aarch64-passes.def (pass_track_speculation): Add before
      	pass_reorder_blocks.
      	* config/aarch64/aarch64-protos.h (make_pass_track_speculation): Add
      	prototype.
      	* config/aarch64/aarch64.c (aarch64_conditional_register_usage): Fix
      	X14 and X15 when tracking speculation.
      	* config/aarch64/aarch64.md (register name constants): Add
      	SPECULATION_TRACKER_REGNUM and SPECULATION_SCRATCH_REGNUM.
      	(unspec): Add UNSPEC_SPECULATION_TRACKER.
      	(speculation_barrier): New insn attribute.
      	(cmp<mode>): Allow SP in comparisons.
      	(speculation_tracker): New insn.
      	(speculation_barrier): Add speculation_barrier attribute.
      	* config/aarch64/t-aarch64: Add make rule for aarch64-speculation.o.
      	* config.gcc (aarch64*-*-*): Add aarch64-speculation.o to extra_objs.
      	* doc/invoke.texi (AArch64 Options): Document -mtrack-speculation.
      
      From-SVN: r263173
      Richard Earnshaw committed
    • AArch64 - disable CB[N]Z TB[N]Z when tracking speculation · 6e1eaca9
      The CB[N]Z and TB[N]Z instructions do not expose the comparison through
      the condition code flags.  This makes it impossible to track speculative
      execution through such a branch.  We can handle this relatively easily
      by simply disabling the patterns in this case.
      
      A side effect of this is that the split patterns for the atomic operations
      need to also avoid generating these instructions.  They mostly have simple
      fall-backs for this already.
      
      	* config/aarch64/aarch64.md (cb<optab><mode>1): Disable when
      	aarch64_track_speculation is true.
      	(tb<optab><mode>1): Likewise.
      	* config/aarch64/aarch64.c (aarch64_split_compare_regs): Do not
      	generate CB[N]Z when tracking speculation.
      	(aarch64_split_compare_and_swap): Likewise.
      	(aarch64_split_atomic_op): Likewise.
      
      From-SVN: r263172
      Richard Earnshaw committed
    • AArch64 - Add new option -mtrack-speculation · 3b0c2502
      This patch doesn't do anything useful, it simply adds a new command-line
      option -mtrack-speculation to AArch64.  Subsequent patches build on this.
      
      	* config/aarch64/aarch64.opt (mtrack-speculation): New target option.
      
      From-SVN: r263171
      Richard Earnshaw committed
    • AArch64 - add speculation barrier · def745b2
      Similar to Arm, this adds an unconditional speculation barrier for AArch64.
      
      	* config/aarch64.md (unspecv): Add UNSPECV_SPECULAION_BARRIER.
      	(speculation_barrier): New insn.
      
      From-SVN: r263170
      Richard Earnshaw committed
    • Arm - add speculation_barrier pattern · bb8b0096
      This patch defines a speculation barrier for AArch32.
      
      	* config/arm/unspecs.md (unspecv): Add VUNSPEC_SPECULATION_BARRIER.
      	* config/arm/arm.md (speculation_barrier): New expand.
      	(speculation_barrier_insn): New pattern.
      
      From-SVN: r263169
      Richard Earnshaw committed
    • Add __builtin_speculation_safe_value · 425fc685
      This patch defines a new intrinsic function
      __builtin_speculation_safe_value.  A generic default implementation is
      defined which will attempt to use the backend pattern
      "speculation_safe_barrier".  If this pattern is not defined, or if it
      is not available, then the compiler will emit a warning, but
      compilation will continue.
      
      Note that the test spec-barrier-1.c will currently fail on all
      targets.  This is deliberate, the failure will go away when
      appropriate action is taken for each target backend.
      
      gcc:
      	* builtin-types.def (BT_FN_PTR_PTR_VAR): New function type.
      	(BT_FN_I1_I1_VAR, BT_FN_I2_I2_VAR, BT_FN_I4_I4_VAR): Likewise.
      	(BT_FN_I8_I8_VAR, BT_FN_I16_I16_VAR): Likewise.
      	* builtin-attrs.def (ATTR_NOVOPS_NOTHROW_LEAF_LIST): New attribute
      	list.
      	* builtins.def (BUILT_IN_SPECULATION_SAFE_VALUE_N): New builtin.
      	(BUILT_IN_SPECULATION_SAFE_VALUE_PTR): New internal builtin.
      	(BUILT_IN_SPECULATION_SAFE_VALUE_1): Likewise.
      	(BUILT_IN_SPECULATION_SAFE_VALUE_2): Likewise.
      	(BUILT_IN_SPECULATION_SAFE_VALUE_4): Likewise.
      	(BUILT_IN_SPECULATION_SAFE_VALUE_8): Likewise.
      	(BUILT_IN_SPECULATION_SAFE_VALUE_16): Likewise.
      	* builtins.c (expand_speculation_safe_value): New function.
      	(expand_builtin): Call it.
      	* doc/cpp.texi: Document predefine __HAVE_SPECULATION_SAFE_VALUE.
      	* doc/extend.texi: Document __builtin_speculation_safe_value.
      	* doc/md.texi: Document "speculation_barrier" pattern.
      	* doc/tm.texi.in: Pull in TARGET_SPECULATION_SAFE_VALUE and
      	TARGET_HAVE_SPECULATION_SAFE_VALUE.
      	* doc/tm.texi: Regenerated.
      	* target.def (have_speculation_safe_value, speculation_safe_value): New
      	hooks.
      	* targhooks.c (default_have_speculation_safe_value): New function.
      	(default_speculation_safe_value): New function.
      	* targhooks.h (default_have_speculation_safe_value): Add prototype.
      	(default_speculation_safe_value): Add prototype.
      
      c-family:
      	* c-common.c (speculation_safe_resolve_call): New function.
      	(speculation_safe_resolve_params): New function.
      	(speculation_safe_resolve_return): New function.
      	(resolve_overloaded_builtin): Handle __builtin_speculation_safe_value.
      	* c-cppbuiltin.c (c_cpp_builtins): Add pre-define for
      	__HAVE_SPECULATION_SAFE_VALUE.
      
      testsuite:
      	* c-c++-common/spec-barrier-1.c: New test.
      	* c-c++-common/spec-barrier-2.c: New test.
      	* gcc.dg/spec-barrier-3.c: New test.
      
      From-SVN: r263168
      Richard Earnshaw committed
    • Simplify dump_context by adding a dump_loc member function · 1d8693a0
      This patch removes some duplicated code in dumpfile.c by
      reimplementing the various dump_foo_loc calls in terms of dump_foo.
      
      gcc/ChangeLog:
      	* dump-context.h (dump_context::dump_loc): New decl.
      	* dumpfile.c (dump_context::dump_loc): New member function.
      	(dump_context::dump_gimple_stmt_loc): Reimplement using dump_loc
      	and dump_gimple_stmt.
      	(dump_context::dump_gimple_expr_loc): Likewise, using
      	dump_gimple_expr.
      	(dump_context::dump_generic_expr_loc): Likewise, using
      	dump_generic_expr.
      	(dump_context::dump_printf_loc_va): Likewise, using
      	dump_printf_va.
      	(dump_context::begin_scope): Explicitly using the global function
      	"dump_loc", rather than the member function.
      
      From-SVN: r263167
      David Malcolm committed
    • PR tree-optimization/86741 - ICE in -Warray-bounds indexing into an object of incomplete type · 8e73e614
      gcc/ChangeLog:
      
      	PR tree-optimization/86741
      	* tree-vrp.c (vrp_prop::check_mem_ref): Avoid incomplete types.
      
      gcc/testsuite/ChangeLog:
      
      	PR tree-optimization/86741
      	* gcc.dg/Warray-bounds-33.c: New test.
      
      From-SVN: r263166
      Martin Sebor committed
    • S/390: Don't emit prefetch instructions for clrmem · 4de3a1e1
      gcc/ChangeLog:
      
      2018-07-31  Andreas Krebbel  <krebbel@linux.ibm.com>
      
      	* config/s390/s390.c (s390_expand_setmem): Make the unrolling to
      	depend on whether prefetch instructions will be emitted or not.
      	Use TARGET_SETMEM_PFD for checking whether prefetch instructions
      	will be emitted or not.
      	* config/s390/s390.h (TARGET_SETMEM_PREFETCH_DISTANCE)
      	(TARGET_SETMEM_PFD): New macros.
      
      gcc/testsuite/ChangeLog:
      
      2018-07-31  Andreas Krebbel  <krebbel@linux.ibm.com>
      
      	* gcc.target/s390/memset-1.c: Improve testcase.
      
      From-SVN: r263165
      Andreas Krebbel committed
    • [c++] Fix DECL_BY_REFERENCE of clone parms · 77b46042
      Consider test.C compiled at -O0 -g:
      ...
      class string {
      public:
        string (const char *p) { this->p = p ; }
        string (const string &s) { this->p = s.p; }
      
      private:
        const char *p;
      };
      
      class foo {
      public:
        foo (string dir_hint) {}
      };
      
      int
      main (void)
      {
        std::string s = "This is just a string";
        foo bar(s);
        return 0;
      }
      ...
      
      When parsing foo::foo, the dir_hint parameter gets a DECL_ARG_TYPE of
      'struct string & restrict'.  Then during finish_struct, we call
      clone_constructors_and_destructors and create clones for foo::foo, and
      set the DECL_ARG_TYPE in the same way.
      
      Later on, during finish_function, cp_genericize is called for the original
      foo::foo, which sets the type of parm dir_hint to DECL_ARG_TYPE, and sets
      DECL_BY_REFERENCE of dir_hint to 1.
      
      After that, during maybe_clone_body update_cloned_parm is called with:
      ...
      (gdb) call debug_generic_expr (parm.typed.type)
      struct string & restrict
      (gdb) call debug_generic_expr (cloned_parm.typed.type)
      struct string
      ...
      The type of the cloned_parm is then set to the type of parm, but
      DECL_BY_REFERENCE is not set.
      
      When doing cp_genericize for the clone later on,
      TREE_ADDRESSABLE (TREE_TYPE ()) is no longer true for the updated type for
      the parm, so DECL_BY_REFERENCE is not set there either.
      
      The missing DECL_BY_REFERENCE on cloned_parm causes incorrect debug info to be
      generated.
      
      This patch fixes the problem by copying DECL_BY_REFERENCE in update_cloned_parm.
      
      Bootstrapped and reg-tested on x86_64.
      
      2018-07-31  Tom de Vries  <tdevries@suse.de>
      
      	PR debug/86687
      	* optimize.c (update_cloned_parm): Copy DECL_BY_REFERENCE.
      
      	* g++.dg/guality/pr86687.C: New test.
      
      From-SVN: r263164
      Tom de Vries committed
    • Improve libstdc++ docs w.r.t newer C++ standards · 3e64a626
      Instead of repeating all the old headers for every new standard I've
      changed the docs to only list the new headers for each standard.
      
      	* doc/xml/manual/test.xml: Improve documentation on writing tests for
      	newer standards.
      	* doc/xml/manual/using.xml: Document all headers for C++11 and later.
      	* doc/html/*: Regenerate.
      
      From-SVN: r263163
      Jonathan Wakely committed
    • Replace safe bool idiom with explicit operator bool · 77a6c969
      	* include/ext/pointer.h [__cplusplus >= 201103L]
      	(_Pointer_adapter::operator bool): Add explicit conversion operator
      	to replace safe bool idiom.
      
      From-SVN: r263162
      Jonathan Wakely committed
    • [46/46] Turn stmt_vec_info back into a typedef · ddf98a96
      This patch removes the stmt_vec_info wrapper class added near the
      beginning of the series and turns stmt_vec_info back into a typedef.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (stmt_vec_info): Turn back into a typedef.
      	(NULL_STMT_VEC_INFO): Delete.
      	(stmt_vec_info::operator*): Likewise.
      	(stmt_vec_info::operator gimple *): Likewise.
      	* tree-vect-loop.c (vectorizable_reduction): Use NULL instead
      	of NULL_STMT_VEC_INFO.
      	* tree-vect-patterns.c (vect_init_pattern_stmt): Likewise.
      	(vect_reassociating_reduction_p): Likewise.
      	* tree-vect-stmts.c (vect_build_gather_load_calls): Likewise.
      	(vectorizable_store): Likewise.
      	* tree-vectorizer.c (vec_info::set_vinfo_for_stmt): Likewise.
      	(vec_info::free_stmt_vec_infos): Likewise.
      
      From-SVN: r263161
      Richard Sandiford committed
    • [45/46] Remove vect_stmt_in_region_p · dddecc5c
      Unlike the old vinfo_for_stmt, vec_info::lookup_stmt can cope with
      any statement, so there's no need to check beforehand that the statement
      is part of the vectorisable region.  This means that there are no longer
      any calls to vect_stmt_in_region_p.
      
      2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
      
      gcc/
      	* tree-vectorizer.h (vect_stmt_in_region_p): Delete.
      	* tree-vectorizer.c (vect_stmt_in_region_p): Likewise.
      
      From-SVN: r263160
      Richard Sandiford committed