1. 18 Dec, 2017 3 commits
  2. 17 Dec, 2017 9 commits
  3. 16 Dec, 2017 17 commits
    • PR tree-optimization/78918 - missing -Wrestrict on memcpy copying over self · cc8bea0a
      gcc/c-family/ChangeLog:
      
      	PR tree-optimization/78918
      	* c-common.c (check_function_restrict): Avoid checking built-ins.
      	* c.opt (-Wrestrict): Include in -Wall.
      
      gcc/ChangeLog:
      
      	PR tree-optimization/78918
      	* Makefile.in (OBJS): Add gimple-ssa-warn-restrict.o.
      	* builtins.c (check_sizes): Rename...
      	(check_access): ...to this.  Rename function arguments for clarity.
      	(check_memop_sizes): Adjust names.
      	(expand_builtin_memchr, expand_builtin_memcpy): Same.
      	(expand_builtin_memmove, expand_builtin_mempcpy): Same.
      	(expand_builtin_strcat, expand_builtin_stpncpy): Same.
      	(check_strncat_sizes, expand_builtin_strncat): Same.
      	(expand_builtin_strncpy, expand_builtin_memset): Same.
      	(expand_builtin_bzero, expand_builtin_memcmp): Same.
      	(expand_builtin_memory_chk, maybe_emit_chk_warning): Same.
      	(maybe_emit_sprintf_chk_warning): Same.
      	(expand_builtin_strcpy): Adjust.
      	(expand_builtin_stpcpy): Same.
      	(expand_builtin_with_bounds): Detect out-of-bounds accesses
      	in pointer-checking forms of memcpy, memmove, and mempcpy.
      	(gcall_to_tree_minimal, max_object_size): Define new functions.
      	* builtins.h (max_object_size): Declare.
      	* calls.c (alloc_max_size): Call max_object_size instead of
      	hardcoding ssizetype limit.
      	(get_size_range): Handle new argument.
      	* calls.h (get_size_range): Add a new argument.
      	* cfgexpand.c (expand_call_stmt): Propagate no-warning bit.
      	* doc/invoke.texi (-Wrestrict): Adjust, add example.
      	* gimple-fold.c (gimple_fold_builtin_memory_op): Detect overlapping
      	operations.
      	(gimple_fold_builtin_memory_chk): Same.
      	(gimple_fold_builtin_stxcpy_chk): New function.
      	* gimple-ssa-warn-restrict.c: New source.
      	* gimple-ssa-warn-restrict.h: New header.
      	* gimple.c (gimple_build_call_from_tree): Propagate location.
      	* passes.def (pass_warn_restrict): Add new pass.
      	* tree-pass.h (make_pass_warn_restrict): Declare.
      	* tree-ssa-strlen.c (handle_builtin_strcpy): Detect overlapping
      	operations.
      	(handle_builtin_strcat): Same.
      	(strlen_optimize_stmt): Rename...
      	(strlen_check_and_optimize_stmt): ...to this.  Handle strncat,
      	stpncpy, strncpy, and their checking forms.
      
      gcc/testsuite/ChangeLog:
      
      	PR tree-optimization/78918
      	* c-c++-common/Warray-bounds.c: New test.
      	* c-c++-common/Warray-bounds-2.c: New test.
      	* c-c++-common/Warray-bounds-3.c: New test.
      	* c-c++-common/Warray-bounds-4.c: New test.
      	* c-c++-common/Warray-bounds-5.c: New test.
      	* c-c++-common/Wrestrict-2.c: New test.
      	* c-c++-common/Wrestrict.c: New test.
      	* c-c++-common/Wrestrict.s: New test.
      	* c-c++-common/Wsizeof-pointer-memaccess1.c: Adjust
      	* c-c++-common/Wsizeof-pointer-memaccess2.c: Same.
      	* g++.dg/torture/Wsizeof-pointer-memaccess1.C: Same.
      	* g++.dg/torture/Wsizeof-pointer-memaccess2.C: Same.
      	* gcc.dg/range.h: New header.
      	* gcc.dg/memcpy-6.c: New test.
      	* gcc.dg/pr69172.c: Adjust.
      	* gcc.dg/pr79223.c: Same.
      	* gcc.dg/pr81345.c: Adjust.
      	* gcc.dg/Wobjsize-1.c: Same.
      	* gcc.dg/Wrestrict-2.c: New test.
      	* gcc.dg/Wrestrict.c: New test.
      	* gcc.dg/Wsizeof-pointer-memaccess1.c: Adjust.
      	* gcc.dg/builtin-stpncpy.c: Same.
      	* gcc.dg/builtin-stringop-chk-1.c: Same.
      	* gcc.target/i386/chkp-stropt-17.c: New test.
      	* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Adjust.
      
      From-SVN: r255755
      Martin Sebor committed
    • PR tree-optimization/83239 - False positive from -Wstringop-overflow · d4356822
      PR tree-optimization/83239 - False positive from -Wstringop-overflow
      on simple std::vector code
      
      libstdc++/CHangeLog:
      	* include/bits/vector.tcc (vector::_M_default_append): Assert
              invariant to generate better code.
      
      gcc/testsuite/ChangeLog:
      	* g++.dg/pr83239.C: New test case.
      
      From-SVN: r255753
      Martin Sebor committed
    • re PR libfortran/81937 (stack-buffer-overflow on memcpy in libgfortran/io/unix.c… · 1eaa31d8
      re PR libfortran/81937 (stack-buffer-overflow on memcpy in libgfortran/io/unix.c on character(kind=4))
      
      2017-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
      
              PR libgfortran/81937
              * io/list_read.c (next_char_internal): Don't attempt to read
              from the internal unit stream if no bytes are left. Decrement
              bytes_left in the right place.
      
      From-SVN: r255750
      Jerry DeLisle committed
    • re PR target/82767 (gcc.target/i386/pr71321.c scan-assembler-times fail) · c16c06da
      	PR testsuite/82767
      	 * gcc.target/i386/pr71321.c: Test with -mtune=generic
      
      From-SVN: r255749
      Sebastian Peryt committed
    • re PR rtl-optimization/82849 (ICE on valid code since r254379) · a9007865
      2017-12-16  Jan Hubicka  <hubicka@ucw.cz>
      
      	PR rtl-optimization/82849
      	* modulo-sched.c (sms_schedule): Use get_estimated_loop_iterations_int
      	and get_max_loop_iterations_int.
      
      From-SVN: r255748
      Jan Hubicka committed
    • poly_int: mode query functions · b4d43553
      This patch changes the bit size and vector count arguments to the
      machmode.h functions from unsigned int to poly_uint64.
      
      2017-12-16  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* machmode.h (mode_for_size, int_mode_for_size, float_mode_for_size)
      	(smallest_mode_for_size, smallest_int_mode_for_size): Take the mode
      	size as a poly_uint64.
      	(mode_for_vector, mode_for_int_vector): Take the number of vector
      	elements as a poly_uint64.
      	* stor-layout.c (mode_for_size, smallest_mode_for_size): Take the mode
      	size as a poly_uint64.
      	(mode_for_vector, mode_for_int_vector): Take the number of vector
      	elements as a poly_uint64.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r255747
      Richard Sandiford committed
    • Revert accidental commit · b4ddce36
      From-SVN: r255746
      Richard Sandiford committed
    • Add a gen_int_shift_amount helper function · 7e594332
      This patch adds a helper routine that constructs rtxes
      for constant shift amounts, given the mode of the value
      being shifted.  As well as helping with the SVE patches, this
      is one step towards allowing CONST_INTs to have a real mode.
      
      One long-standing problem has been to decide what the mode
      of a shift count should be for arbitrary rtxes (as opposed to those
      directly tied to a target pattern).  Realistic choices would be
      the mode of the shifted elements, word_mode, QImode, or the same
      mode as the shift optabs (in which case what should the mode
      be when the target doesn't have a pattern?)
      
      For now the patch picks the mode of the shifted elements,
      but with a ??? comment.
      
      2017-11-06  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* emit-rtl.h (gen_int_shift_amount): Declare.
      	* emit-rtl.c (gen_int_shift_amount): New function.
      	* asan.c (asan_emit_stack_protection): Use gen_int_shift_amount
      	instead of GEN_INT.
      	* calls.c (shift_return_value): Likewise.
      	* cse.c (fold_rtx): Likewise.
      	* dse.c (find_shift_sequence): Likewise.
      	* expmed.c (init_expmed_one_mode, store_bit_field_1, expand_shift_1)
      	(expand_shift, expand_smod_pow2): Likewise.
      	* lower-subreg.c (shift_cost): Likewise.
      	* optabs.c (expand_superword_shift, expand_doubleword_mult)
      	(expand_unop, expand_binop, shift_amt_for_vec_perm_mask)
      	(expand_vec_perm_var): Likewise.
      	* simplify-rtx.c (simplify_unary_operation_1): Likewise.
      	(simplify_binary_operation_1): Likewise.
      	* combine.c (try_combine, find_split_point, force_int_to_mode)
      	(simplify_shift_const_1, simplify_shift_const): Likewise.
      	(change_zero_ext): Likewise.  Use simplify_gen_binary.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r255745
      Richard Sandiford committed
    • poly_int: MACRO_MODE · 05210ba6
      This patch uses a MACRO_MODE wrapper for the target macro invocations
      in targhooks.c and address.h, so that macros for non-AArch64 targets
      can continue to treat modes as fixed-size.
      
      It didn't seem worth converting the address macros to hooks since
      (a) they're heavily used, (b) they should be probably be replaced
      with a different interface rather than converted to hooks as-is,
      and most importantly (c) addresses.h already localises the problem.
      
      2017-12-16  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* machmode.h (MACRO_MODE): New macro.
      	* addresses.h (base_reg_class, ok_for_base_p_1): Use it.
      	* targhooks.c (default_libcall_value, default_secondary_reload)
      	(default_memory_move_cost, default_register_move_cost)
      	(default_class_max_nregs): Likewise.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r255744
      Richard Sandiford committed
    • poly_int: IN_TARGET_CODE · 8fcc61f8
      This patch makes each target-specifc TU define an IN_TARGET_CODE macro,
      which is used to decide whether poly_int<1, C> should convert to C.
      
      2017-12-16  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* doc/sourcebuild.texi: Document IN_TARGET_CODE.
      	* genattrtab.c (write_header): Define IN_TARGET_CODE to 1 in the
      	target C file.
      	* genautomata.c (main): Likewise.
      	* genconditions.c (write_header): Likewise.
      	* genemit.c (main): Likewise.
      	* genextract.c (print_header): Likewise.
      	* genopinit.c (main): Likewise.
      	* genoutput.c (output_prologue): Likewise.
      	* genpeep.c (main): Likewise.
      	* genpreds.c (write_insn_preds_c): Likewise.
      	* genrecog.c (writer_header): Likewise.
      	* config/aarch64/aarch64-builtins.c (IN_TARGET_CODE): Define.
      	* config/aarch64/aarch64-c.c (IN_TARGET_CODE): Likewise.
      	* config/aarch64/aarch64.c (IN_TARGET_CODE): Likewise.
      	* config/aarch64/cortex-a57-fma-steering.c (IN_TARGET_CODE): Likewise.
      	* config/aarch64/driver-aarch64.c (IN_TARGET_CODE): Likewise.
      	* config/alpha/alpha.c (IN_TARGET_CODE): Likewise.
      	* config/alpha/driver-alpha.c (IN_TARGET_CODE): Likewise.
      	* config/arc/arc-c.c (IN_TARGET_CODE): Likewise.
      	* config/arc/arc.c (IN_TARGET_CODE): Likewise.
      	* config/arc/driver-arc.c (IN_TARGET_CODE): Likewise.
      	* config/arm/aarch-common.c (IN_TARGET_CODE): Likewise.
      	* config/arm/arm-builtins.c (IN_TARGET_CODE): Likewise.
      	* config/arm/arm-c.c (IN_TARGET_CODE): Likewise.
      	* config/arm/arm.c (IN_TARGET_CODE): Likewise.
      	* config/arm/driver-arm.c (IN_TARGET_CODE): Likewise.
      	* config/avr/avr-c.c (IN_TARGET_CODE): Likewise.
      	* config/avr/avr-devices.c (IN_TARGET_CODE): Likewise.
      	* config/avr/avr-log.c (IN_TARGET_CODE): Likewise.
      	* config/avr/avr.c (IN_TARGET_CODE): Likewise.
      	* config/avr/driver-avr.c (IN_TARGET_CODE): Likewise.
      	* config/avr/gen-avr-mmcu-specs.c (IN_TARGET_CODE): Likewise.
      	* config/bfin/bfin.c (IN_TARGET_CODE): Likewise.
      	* config/c6x/c6x.c (IN_TARGET_CODE): Likewise.
      	* config/cr16/cr16.c (IN_TARGET_CODE): Likewise.
      	* config/cris/cris.c (IN_TARGET_CODE): Likewise.
      	* config/darwin.c (IN_TARGET_CODE): Likewise.
      	* config/epiphany/epiphany.c (IN_TARGET_CODE): Likewise.
      	* config/epiphany/mode-switch-use.c (IN_TARGET_CODE): Likewise.
      	* config/epiphany/resolve-sw-modes.c (IN_TARGET_CODE): Likewise.
      	* config/fr30/fr30.c (IN_TARGET_CODE): Likewise.
      	* config/frv/frv.c (IN_TARGET_CODE): Likewise.
      	* config/ft32/ft32.c (IN_TARGET_CODE): Likewise.
      	* config/h8300/h8300.c (IN_TARGET_CODE): Likewise.
      	* config/i386/djgpp.c (IN_TARGET_CODE): Likewise.
      	* config/i386/driver-i386.c (IN_TARGET_CODE): Likewise.
      	* config/i386/driver-mingw32.c (IN_TARGET_CODE): Likewise.
      	* config/i386/host-cygwin.c (IN_TARGET_CODE): Likewise.
      	* config/i386/host-i386-darwin.c (IN_TARGET_CODE): Likewise.
      	* config/i386/host-mingw32.c (IN_TARGET_CODE): Likewise.
      	* config/i386/i386-c.c (IN_TARGET_CODE): Likewise.
      	* config/i386/i386.c (IN_TARGET_CODE): Likewise.
      	* config/i386/intelmic-mkoffload.c (IN_TARGET_CODE): Likewise.
      	* config/i386/msformat-c.c (IN_TARGET_CODE): Likewise.
      	* config/i386/winnt-cxx.c (IN_TARGET_CODE): Likewise.
      	* config/i386/winnt-stubs.c (IN_TARGET_CODE): Likewise.
      	* config/i386/winnt.c (IN_TARGET_CODE): Likewise.
      	* config/i386/x86-tune-sched-atom.c (IN_TARGET_CODE): Likewise.
      	* config/i386/x86-tune-sched-bd.c (IN_TARGET_CODE): Likewise.
      	* config/i386/x86-tune-sched-core.c (IN_TARGET_CODE): Likewise.
      	* config/i386/x86-tune-sched.c (IN_TARGET_CODE): Likewise.
      	* config/ia64/ia64-c.c (IN_TARGET_CODE): Likewise.
      	* config/ia64/ia64.c (IN_TARGET_CODE): Likewise.
      	* config/iq2000/iq2000.c (IN_TARGET_CODE): Likewise.
      	* config/lm32/lm32.c (IN_TARGET_CODE): Likewise.
      	* config/m32c/m32c-pragma.c (IN_TARGET_CODE): Likewise.
      	* config/m32c/m32c.c (IN_TARGET_CODE): Likewise.
      	* config/m32r/m32r.c (IN_TARGET_CODE): Likewise.
      	* config/m68k/m68k.c (IN_TARGET_CODE): Likewise.
      	* config/mcore/mcore.c (IN_TARGET_CODE): Likewise.
      	* config/microblaze/microblaze-c.c (IN_TARGET_CODE): Likewise.
      	* config/microblaze/microblaze.c (IN_TARGET_CODE): Likewise.
      	* config/mips/driver-native.c (IN_TARGET_CODE): Likewise.
      	* config/mips/frame-header-opt.c (IN_TARGET_CODE): Likewise.
      	* config/mips/mips.c (IN_TARGET_CODE): Likewise.
      	* config/mmix/mmix.c (IN_TARGET_CODE): Likewise.
      	* config/mn10300/mn10300.c (IN_TARGET_CODE): Likewise.
      	* config/moxie/moxie.c (IN_TARGET_CODE): Likewise.
      	* config/msp430/driver-msp430.c (IN_TARGET_CODE): Likewise.
      	* config/msp430/msp430-c.c (IN_TARGET_CODE): Likewise.
      	* config/msp430/msp430.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32-cost.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32-fp-as-gp.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32-intrinsic.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32-isr.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32-md-auxiliary.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32-memory-manipulation.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32-pipelines-auxiliary.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32-predicates.c (IN_TARGET_CODE): Likewise.
      	* config/nds32/nds32.c (IN_TARGET_CODE): Likewise.
      	* config/nios2/nios2.c (IN_TARGET_CODE): Likewise.
      	* config/nvptx/mkoffload.c (IN_TARGET_CODE): Likewise.
      	* config/nvptx/nvptx.c (IN_TARGET_CODE): Likewise.
      	* config/pa/pa.c (IN_TARGET_CODE): Likewise.
      	* config/pdp11/pdp11.c (IN_TARGET_CODE): Likewise.
      	* config/powerpcspe/driver-powerpcspe.c (IN_TARGET_CODE): Likewise.
      	* config/powerpcspe/host-darwin.c (IN_TARGET_CODE): Likewise.
      	* config/powerpcspe/host-ppc64-darwin.c (IN_TARGET_CODE): Likewise.
      	* config/powerpcspe/powerpcspe-c.c (IN_TARGET_CODE): Likewise.
      	* config/powerpcspe/powerpcspe-linux.c (IN_TARGET_CODE): Likewise.
      	* config/powerpcspe/powerpcspe.c (IN_TARGET_CODE): Likewise.
      	* config/riscv/riscv-builtins.c (IN_TARGET_CODE): Likewise.
      	* config/riscv/riscv-c.c (IN_TARGET_CODE): Likewise.
      	* config/riscv/riscv.c (IN_TARGET_CODE): Likewise.
      	* config/rl78/rl78-c.c (IN_TARGET_CODE): Likewise.
      	* config/rl78/rl78.c (IN_TARGET_CODE): Likewise.
      	* config/rs6000/driver-rs6000.c (IN_TARGET_CODE): Likewise.
      	* config/rs6000/host-darwin.c (IN_TARGET_CODE): Likewise.
      	* config/rs6000/host-ppc64-darwin.c (IN_TARGET_CODE): Likewise.
      	* config/rs6000/rs6000-c.c (IN_TARGET_CODE): Likewise.
      	* config/rs6000/rs6000-linux.c (IN_TARGET_CODE): Likewise.
      	* config/rs6000/rs6000-p8swap.c (IN_TARGET_CODE): Likewise.
      	* config/rs6000/rs6000-string.c (IN_TARGET_CODE): Likewise.
      	* config/rs6000/rs6000.c (IN_TARGET_CODE): Likewise.
      	* config/rx/rx.c (IN_TARGET_CODE): Likewise.
      	* config/s390/driver-native.c (IN_TARGET_CODE): Likewise.
      	* config/s390/s390-c.c (IN_TARGET_CODE): Likewise.
      	* config/s390/s390.c (IN_TARGET_CODE): Likewise.
      	* config/sh/sh-c.c (IN_TARGET_CODE): Likewise.
      	* config/sh/sh-mem.cc (IN_TARGET_CODE): Likewise.
      	* config/sh/sh.c (IN_TARGET_CODE): Likewise.
      	* config/sh/sh_optimize_sett_clrt.cc (IN_TARGET_CODE): Likewise.
      	* config/sh/sh_treg_combine.cc (IN_TARGET_CODE): Likewise.
      	* config/sparc/driver-sparc.c (IN_TARGET_CODE): Likewise.
      	* config/sparc/sparc-c.c (IN_TARGET_CODE): Likewise.
      	* config/sparc/sparc.c (IN_TARGET_CODE): Likewise.
      	* config/spu/spu-c.c (IN_TARGET_CODE): Likewise.
      	* config/spu/spu.c (IN_TARGET_CODE): Likewise.
      	* config/stormy16/stormy16.c (IN_TARGET_CODE): Likewise.
      	* config/tilegx/mul-tables.c (IN_TARGET_CODE): Likewise.
      	* config/tilegx/tilegx-c.c (IN_TARGET_CODE): Likewise.
      	* config/tilegx/tilegx.c (IN_TARGET_CODE): Likewise.
      	* config/tilepro/mul-tables.c (IN_TARGET_CODE): Likewise.
      	* config/tilepro/tilepro-c.c (IN_TARGET_CODE): Likewise.
      	* config/tilepro/tilepro.c (IN_TARGET_CODE): Likewise.
      	* config/v850/v850-c.c (IN_TARGET_CODE): Likewise.
      	* config/v850/v850.c (IN_TARGET_CODE): Likewise.
      	* config/vax/vax.c (IN_TARGET_CODE): Likewise.
      	* config/visium/visium.c (IN_TARGET_CODE): Likewise.
      	* config/vms/vms-c.c (IN_TARGET_CODE): Likewise.
      	* config/vms/vms-f.c (IN_TARGET_CODE): Likewise.
      	* config/vms/vms.c (IN_TARGET_CODE): Likewise.
      	* config/xtensa/xtensa.c (IN_TARGET_CODE): Likewise.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r255743
      Richard Sandiford committed
    • Minor vn_reference_lookup_3 tweak · 7a667e64
      The repeated checks for MEM_REF made this code hard to convert to
      poly_ints as-is.  Hopefully the new structure also makes it clearer
      at a glance what the two cases are.
      
      2017-12-16  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid repeated
      	checks for MEM_REF.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r255742
      Richard Sandiford committed
    • Add VEC_SERIES_EXPR and associated optab · 9adab579
      Similarly to the VEC_DUPLICATE_EXPR, this patch adds a tree code
      equivalent of the VEC_SERIES rtx code: VEC_SERIES_EXPR.
      
      2017-12-16  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* doc/generic.texi (VEC_SERIES_EXPR): Document.
      	* doc/md.texi (vec_series@var{m}): Document.
      	* tree.def (VEC_SERIES_EXPR): New tree code.
      	* tree.h (build_vec_series): Declare.
      	* tree.c (build_vec_series): New function.
      	* cfgexpand.c (expand_debug_expr): Handle VEC_SERIES_EXPR.
      	* tree-pretty-print.c (dump_generic_node): Likewise.
      	* gimple-pretty-print.c (dump_binary_rhs): Likewise.
      	* tree-inline.c (estimate_operator_cost): Likewise.
      	* expr.c (expand_expr_real_2): Likewise.
      	* optabs-tree.c (optab_for_tree_code): Likewise.
      	* tree-cfg.c (verify_gimple_assign_binary): Likewise.
      	* fold-const.c (const_binop): Fold VEC_SERIES_EXPRs of constants.
      	* expmed.c (make_tree): Handle VEC_SERIES.
      	* optabs.def (vec_series_optab): New optab.
      	* optabs.h (expand_vec_series_expr): Declare.
      	* optabs.c (expand_vec_series_expr): New function.
      	* tree-vect-generic.c (expand_vector_operations_1): Check that
      	the operands also have vector type.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r255741
      Richard Sandiford committed
    • Add VEC_DUPLICATE_EXPR and associated optab · be4c1d4a
      SVE needs a way of broadcasting a scalar to a variable-length vector.
      This patch adds VEC_DUPLICATE_EXPR for when CONSTRUCTOR would be used
      for fixed-length vectors; this is the tree equivalent of the existing
      rtl code VEC_DUPLICATE.
      
      The patch also adds a vec_duplicate_optab to go with VEC_DUPLICATE_EXPR.
      
      2017-12-16  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hawyard@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* doc/generic.texi (VEC_DUPLICATE_EXPR): Document.
      	(VEC_COND_EXPR): Add missing @tindex.
      	* doc/md.texi (vec_duplicate@var{m}): Document.
      	* tree.def (VEC_DUPLICATE_EXPR): New tree codes.
      	* tree.c (build_vector_from_val): Add stubbed-out handling of
      	variable-length vectors, using VEC_DUPLICATE_EXPR.
      	(uniform_vector_p): Handle VEC_DUPLICATE_EXPR.
      	* cfgexpand.c (expand_debug_expr): Likewise.
      	* tree-cfg.c (verify_gimple_assign_unary): Likewise.
      	* tree-inline.c (estimate_operator_cost): Likewise.
      	* tree-pretty-print.c (dump_generic_node): Likewise.
      	* tree-vect-generic.c (ssa_uniform_vector_p): Likewise.
      	* fold-const.c (const_unop): Fold VEC_DUPLICATE_EXPRs of a constant.
      	(test_vec_duplicate_folding): New function.
      	(fold_const_c_tests): Call it.
      	* optabs.def (vec_duplicate_optab): New optab.
      	* optabs-tree.c (optab_for_tree_code): Handle VEC_DUPLICATE_EXPR.
      	* optabs.h (expand_vector_broadcast): Declare.
      	* optabs.c (expand_vector_broadcast): Make non-static.  Try using
      	vec_duplicate_optab.
      	* expr.c (store_constructor): Try using vec_duplicate_optab for
      	uniform vectors.
      	(expand_expr_real_2): Handle VEC_DUPLICATE_EXPR.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r255740
      Richard Sandiford committed
    • re PR target/83358 (division not converted with Intel tuning since r253934) · 02308bd3
      2017-12-15  Markus Trippelsdorf  <markus@trippelsdorf.de>
      
      	PR target/83358
      	* config/i386/x86-tune-costs.h (skylake_cost, core_cost): Increase
      	div/mod latencies a bit.
      
              PR target/83358
      	* gcc.target/i386/pr83358-1.c: New test.
      	* gcc.target/i386/pr83358-2.c: New test.
      
      From-SVN: r255739
      Markus Trippelsdorf committed
    • os: pass -s to hostname on AIX · be528ae9
          
          Reviewed-on: https://go-review.googlesource.com/79375
      
      From-SVN: r255738
      Ian Lance Taylor committed
    • syscall: emulate Flock on AIX · fe6272cc
          
          Reviewed-on: https://go-review.googlesource.com/79095
      
      From-SVN: r255737
      Ian Lance Taylor committed
    • Daily bump. · dead5b99
      From-SVN: r255734
      GCC Administrator committed
  4. 15 Dec, 2017 11 commits
    • re PR middle-end/36550 (Wrong "may be used uninitialized" warning (conditional PHIs)) · b021b385
      	PR tree-optimization/36550
      	* tree-ssa-threadupdate.c (count_stmts_and_phis_in_block): New.
      	(mark_threaded_blocks): Rewrite code to avoid block copying when
      	optimizing for size.  Don't pessimize blocks which will be
      	copied, but all the statements will be dead.
      
      	PR tree-optimization/36550
      	* gcc.dg/tree-ssa/pr36550.c: New test.
      
      From-SVN: r255731
      Jeff Law committed
    • re PR tree-optimization/81165 (Regression in GCC-8.0.0's optimizer) · 5806e062
      	PR tree-optimization/81165
      	* tree-ssa-threadupdate.c (uses_in_bb): New.
      	(estimate_threading_killed_stmts): New.
      	* tree-ssa-threadupdate.h (estimate_threading_killed_stmts): Prototype.
      	* tree-ssa-threadedge.c
      	(record_temporary_equivalences_from_stmts_at_dest): Expand limit
      	when its hit.
      
      	PR tree-optimization/81165
      	* gcc.dg/pr81165.c: New.
      
      From-SVN: r255724
      Jeff Law committed
    • re PR c++/83205 (ICE on structured binding with ill-formed negative std::tuple_size<T>::value) · 38f4bea8
      	PR c++/83205
      	* decl.c (cp_finish_decomp): Handle the case when tsize is not
      	error_mark_node, but doesn't fit into uhwi.  Split up count != eltscnt
      	and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n
      	to handle plural forms properly.
      
      	* g++.dg/cpp1z/decomp3.C: Adjust for structured binding count
      	mismatch diagnostics split into error and warning with plural
      	forms.
      	* g++.dg/cpp1z/decomp10.C: Likewise.
      	* g++.dg/cpp1z/decomp32.C: New test.
      
      From-SVN: r255706
      Jakub Jelinek committed
    • re PR c++/81197 (ICE with structured binding and lifetime-extended temporaries) · 70356f77
      	PR c++/81197
      	* cp-tree.h (cp_maybe_mangle_decomp): Declare.
      	* decl.c (cp_maybe_mangle_decomp): New function.
      	(cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here.
      	* parser.c (cp_convert_range_for,
      	cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp.
      	* pt.c (tsubst_expr): Likewise.
      	* mangle.c (find_decomp_unqualified_name): New function.
      	(write_unqualified_name): Handle DECL_DECOMPOSITION_P
      	where DECL_ASSEMBLER_NAME is already set.
      
      	* g++.dg/cpp1z/decomp34.C: New test.
      
      From-SVN: r255705
      Jakub Jelinek committed
    • re PR c++/80135 (ICE in output_constructor_regular_field, at varasm.c:4968) · a8c55cac
      	PR c++/80135
      	PR c++/81922
      	* typeck2.c (digest_init_r): Change nested argument type from bool to
      	int.  Use code instead of TREE_CODE (type) where possible.  If
      	nested == 2, diagnose initialization of flexible array member with
      	STRING_CST.  Pass nested to process_init_constructor.  Formatting fix.
      	(digest_init, digest_init_flags): Adjust digest_init_r caller.
      	(massage_init_elt): Add nested argument.  Pass 2 instead of 1 to
      	digest_init_r's nested argument if nested is non-zero.
      	(process_init_constructor_array): Add nested argument.  If nested == 2,
      	diagnose initialization of flexible array member with non-empty
      	braced enclosed list.  Pass nested to massage_init_elt.
      	(process_init_constructor_record, process_init_constructor_union): Add
      	nested argument, pass it to massage_init_elt.
      	(process_init_constructor): Add nested argument, pass it to
      	process_init_constructor_{array,record,union}.
      	* init.c (find_field_init): Renamed to ...
      	(find_flexarray_init): ... this.  Return NULL_TREE if init is
      	error_mark_node.  Don't look through nested CONSTRUCTORs.
      	(warn_placement_new_too_small): Adjust caller.
      
      	* g++.dg/warn/Wplacement-new-size-1.C (fBx1): Initialize nested
      	flexible array member only with {}.  Add dg-warning.
      	(fBx2, fBx3): Remove.
      	* g++.dg/warn/Wplacement-new-size-2.C (fBx1): Initialize nested
      	flexible array member only with {}.  Add dg-warning.
      	(fBx2, fBx3): Remove.
      	* g++.dg/warn/Wplacement-new-size-6.C: New test.
      	* g++.dg/ext/flexary13.C (main): Remove test for initialization
      	of nested flexible array member with non-empty initializer.
      	* g++.dg/ext/flexary25.C: New test.
      	* g++.dg/ext/flexary26.C: New test.
      	* g++.dg/ext/flexary27.C: New test.
      	* g++.dg/parse/pr43765.C: Expect diagnostics about initialization
      	of nested flexible array member with non-empty initializer.  Expect
      	C++2A diagnostics about mixing of designated and non-designated
      	initializers.
      
      From-SVN: r255703
      Jakub Jelinek committed
    • re PR c++/83217 (Compiler segfault: structured binding by reference to a… · e3a661b4
      re PR c++/83217 (Compiler segfault: structured binding by reference to a templated type via a pointer)
      
      	PR c++/83217
      	* decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
      	call complete_type (TREE_TYPE (type)).
      
      	* g++.dg/cpp1z/decomp33.C: New test.
      
      From-SVN: r255702
      Jakub Jelinek committed
    • re PR tree-optimization/80631 (Compiling with -O3 -mavx2 gives wrong code) · 32151c3f
      	PR tree-optimization/80631
      	* gcc.target/i386/avx2-pr80631.c: New test.
      
      From-SVN: r255701
      Jakub Jelinek committed
    • re PR tree-optimization/83410 (libgomp.graphite/force-parallel-4.c etc. FAIL) · 8f80d734
      	PR tree-optimization/83410
      	* tree-ssa-threadupdate.c (thread_block_1): Avoid certain jump
      	threads when parallelizing loops.
      
      From-SVN: r255700
      Jeff Law committed
    • tree-core.h (struct attribute_spec): Swap affects_type_identity and handler fields. · 4849deb1
      	* tree-core.h (struct attribute_spec): Swap affects_type_identity and
      	handler fields.
      	* config/alpha/alpha.c (vms_attribute_table): Swap
      	affects_type_identity and handler fields, adjust comments.
      	* config/mips/mips.c (mips_attribute_table): Likewise.
      	* config/visium/visium.c (visium_attribute_table): Likewise.
      	* config/epiphany/epiphany.c (epiphany_attribute_table): Likewise.
      	* config/microblaze/microblaze.c (microblaze_attribute_table):
      	Likewise.
      	* config/spu/spu.c (spu_attribute_table): Likewise.
      	* config/mcore/mcore.c (mcore_attribute_table): Likewise.
      	* config/arc/arc.c (arc_attribute_table): Likewise.
      	* config/m68k/m68k.c (m68k_attribute_table): Likewise.
      	* config/v850/v850.c (v850_handle_interrupt_attribute,
      	v850_handle_data_area_attribute): Formatting fixes.
      	(v850_attribute_table): Swap affects_type_identity and handler
      	fields, adjust comments.
      	* config/m32r/m32r.c (m32r_attribute_table): Likewise.
      	* config/arm/arm.c (arm_attribute_table): Likewise.
      	* config/avr/avr.c (avr_attribute_table): Likewise.
      	* config/s390/s390.c (s390_attribute_table): Likewise.
      	* config/sh/sh.c (sh_attribute_table): Likewise.
      	* config/i386/i386.c (ix86_handle_cconv_attribute,
      	ix86_handle_callee_pop_aggregate_return): Formatting fixes.
      	(ix86_attribute_table): Swap affects_type_identity and handler
      	fields, adjust comments.
      	* config/i386/cygming.h (SUBTARGET_ATTRIBUTE_TABLE): Likewise.
      	* config/sparc/sparc.c (sparc_attribute_table): Likewise.
      	* config/m32c/m32c.c (m32c_attribute_table): Likewise.
      	* config/sol2.h (SOLARIS_ATTRIBUTE_TABLE): Likewise.
      	* config/ia64/ia64.c (ia64_attribute_table): Likewise.
      	* config/msp430/msp430.c (msp430_attribute_table): Likewise.
      	* config/rx/rx.c (rx_attribute_table): Likewise.
      	* config/cr16/cr16.c (cr16_attribute_table): Likewise.
      	* config/h8300/h8300.c (h8300_attribute_table): Likewise.
      	* config/nvptx/nvptx.c (nvptx_attribute_table): Likewise.
      	* config/powerpcspe/powerpcspe.c (rs6000_attribute_table): Likewise.
      	* config/darwin.h (SUBTARGET_ATTRIBUTE_TABLE): Likewise.
      	* config/stormy16/stormy16.c (xstormy16_attribute_table): Likewise.
      	* config/bfin/bfin.c (bfin_attribute_table): Likewise.
      	* config/rs6000/rs6000.c (rs6000_attribute_table): Likewise.
      	* config/rl78/rl78.c (rl78_attribute_table): Likewise.
      	* config/nds32/nds32.c (nds32_attribute_table): Likewise.
      	* doc/plugins.texi (user_attr): Likewise.  Add NULL for
      	exclude.
      	* attribs.c (empty_attribute_table): Swap affects_type_identity and
      	handler fields.
      	(register_scoped_attributes, decl_attributes): Formatting fixes.
      ada/
      	* gcc-interface/utils.c (gnat_internal_attribute_table): Swap
      	affects_type_identity and handler fields, adjust comments.
      brig/
      	* brig-lang.c (brig_attribute_table): Swap affects_type_identity
      	and handler fields, adjust comments.
      c-family/
      	* c-attribs.c (c_common_attribute_table,
      	c_common_format_attribute_table): Swap affects_type_identity
      	and handler fields, adjust comments.
      cp/
      	* tree.c (cxx_attribute_table, std_attribute_table): Swap
      	affects_type_identity and handler fields, adjust comments.
      fortran/
      	* f95-lang.c (gfc_attribute_table): Swap affects_type_identity
      	and handler fields, adjust comments.
      lto/
      	* lto-lang.c (lto_attribute_table, lto_format_attribute_table): Swap
      	affects_type_identity and handler fields, adjust comments.
      testsuite/
      	* g++.dg/plugin/attribute_plugin.c (user_attr): Swap
      	affects_type_identity and handler fields, add NULL for exclude.
      
      From-SVN: r255699
      Jakub Jelinek committed
    • [PR C++/59930] template friend classes & default args · 0cf4820d
      https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01055.html
      	PR c++/59930
      	* decl.c (xref_tag_1): Correct comments about template friends and
      	default args.
      	* friend.c (make_friend_class): Move comments concerning
      	self-friendliness to code dealing with such.
      	* pt.c (check_default_tmpl_args): Deal with template friend
      	classes too.
      	(push_template_decl_real): Check default args for non-function
      	template friends.
      
      	PR c++/59930
      	* g++.dg/cpp0x/temp_default4.C: Adjust diagnostic.
      	* g++.old-deja/g++.pt/friend23.C: Likewise.
      	* g++.old-deja/g++.pt/friend24.C: Delete.
      
      From-SVN: r255698
      Nathan Sidwell committed
    • re PR tree-optimization/83269 (Wrong constant folding) · e7425c18
      	PR tree-optimization/83269
      	* fold-const.c (fold_binary_loc): Perform (-A) - B -> (-B) - A
      	subtraction in arg0's type if type is signed and arg0 is unsigned.
      	Formatting fix.
      
      	* gcc.c-torture/execute/pr83269.c: New test.
      
      From-SVN: r255697
      Jakub Jelinek committed