gcc.git
6 years agopoly_int: dump routines
Richard Sandiford [Wed, 20 Dec 2017 12:51:57 +0000 (12:51 +0000)]
poly_int: dump routines

2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* dumpfile.h (dump_dec): Declare.
* dumpfile.c (dump_dec): New function.
* pretty-print.h (pp_wide_integer): Turn into a function and
declare a poly_int version.
* pretty-print.c (pp_wide_integer): New function for poly_ints.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255864

6 years agopoly_int: tree constants
Richard Sandiford [Wed, 20 Dec 2017 12:51:50 +0000 (12:51 +0000)]
poly_int: tree constants

This patch adds a tree representation for poly_ints.  Unlike the
rtx version, the coefficients are INTEGER_CSTs rather than plain
integers, so that we can easily access them as poly_widest_ints
and poly_offset_ints.

The patch also adjusts some places that previously
relied on "constant" meaning "INTEGER_CST".  It also makes
sure that the TYPE_SIZE agrees with the TYPE_SIZE_UNIT for
vector booleans, given the existing:

/* Several boolean vector elements may fit in a single unit.  */
if (VECTOR_BOOLEAN_TYPE_P (type)
    && type->type_common.mode != BLKmode)
  TYPE_SIZE_UNIT (type)
    = size_int (GET_MODE_SIZE (type->type_common.mode));
else
  TYPE_SIZE_UNIT (type) = int_const_binop (MULT_EXPR,
   TYPE_SIZE_UNIT (innertype),
   size_int (nunits));

2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* doc/generic.texi (POLY_INT_CST): Document.
* tree.def (POLY_INT_CST): New tree code.
* treestruct.def (TS_POLY_INT_CST): New tree layout.
* tree-core.h (tree_poly_int_cst): New struct.
(tree_node): Add a poly_int_cst field.
* tree.h (POLY_INT_CST_P, POLY_INT_CST_COEFF): New macros.
(wide_int_to_tree, force_fit_type): Take a poly_wide_int_ref
instead of a wide_int_ref.
(build_int_cst, build_int_cst_type): Take a poly_int64 instead
of a HOST_WIDE_INT.
(build_int_cstu, build_array_type_nelts): Take a poly_uint64
instead of an unsigned HOST_WIDE_INT.
(build_poly_int_cst, tree_fits_poly_int64_p, tree_fits_poly_uint64_p)
(ptrdiff_tree_p): Declare.
(tree_to_poly_int64, tree_to_poly_uint64): Likewise.  Provide
extern inline implementations if the target doesn't use POLY_INT_CST.
(poly_int_tree_p): New function.
(wi::unextended_tree): New class.
(wi::int_traits <unextended_tree>): New override.
(wi::extended_tree): Add a default constructor.
(wi::extended_tree::get_tree): New function.
(wi::widest_extended_tree, wi::offset_extended_tree): New typedefs.
(wi::tree_to_widest_ref, wi::tree_to_offset_ref): Use them.
(wi::tree_to_poly_widest_ref, wi::tree_to_poly_offset_ref)
(wi::tree_to_poly_wide_ref): New typedefs.
(wi::ints_for): Provide overloads for extended_tree and
unextended_tree.
(poly_int_cst_value, wi::to_poly_widest, wi::to_poly_offset)
(wi::to_wide): New functions.
(wi::fits_to_boolean_p, wi::fits_to_tree_p): Handle poly_ints.
* tree.c (poly_int_cst_hasher): New struct.
(poly_int_cst_hash_table): New variable.
(tree_node_structure_for_code, tree_code_size, simple_cst_equal)
(valid_constant_size_p, add_expr, drop_tree_overflow): Handle
POLY_INT_CST.
(initialize_tree_contains_struct): Handle TS_POLY_INT_CST.
(init_ttree): Initialize poly_int_cst_hash_table.
(build_int_cst, build_int_cst_type, build_invariant_address): Take
a poly_int64 instead of a HOST_WIDE_INT.
(build_int_cstu, build_array_type_nelts): Take a poly_uint64
instead of an unsigned HOST_WIDE_INT.
(wide_int_to_tree): Rename to...
(wide_int_to_tree_1): ...this.
(build_new_poly_int_cst, build_poly_int_cst): New functions.
(force_fit_type): Take a poly_wide_int_ref instead of a wide_int_ref.
(wide_int_to_tree): New function that takes a poly_wide_int_ref.
(ptrdiff_tree_p, tree_to_poly_int64, tree_to_poly_uint64)
(tree_fits_poly_int64_p, tree_fits_poly_uint64_p): New functions.
* lto-streamer-out.c (DFS::DFS_write_tree_body, hash_tree): Handle
TS_POLY_INT_CST.
* tree-streamer-in.c (lto_input_ts_poly_tree_pointers): Likewise.
(streamer_read_tree_body): Likewise.
* tree-streamer-out.c (write_ts_poly_tree_pointers): Likewise.
(streamer_write_tree_body): Likewise.
* tree-streamer.c (streamer_check_handled_ts_structures): Likewise.
* asan.c (asan_protect_global): Require the size to be an INTEGER_CST.
* cfgexpand.c (expand_debug_expr): Handle POLY_INT_CST.
* expr.c (expand_expr_real_1, const_vector_from_tree): Likewise.
* gimple-expr.h (is_gimple_constant): Likewise.
* gimplify.c (maybe_with_size_expr): Likewise.
* print-tree.c (print_node): Likewise.
* tree-data-ref.c (data_ref_compare_tree): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-address.c (addr_for_mem_ref): Likewise.
* tree-vect-data-refs.c (dr_group_sort_cmp): Likewise.
* tree-vrp.c (compare_values_warnv): Likewise.
* tree-ssa-loop-ivopts.c (determine_base_object, constant_multiple_of)
(get_loop_invariant_expr, add_candidate_1, get_computation_aff_1)
(force_expr_to_var_cost): Likewise.
* tree-ssa-loop.c (for_each_index): Likewise.
* fold-const.h (build_invariant_address, size_int_kind): Take a
poly_int64 instead of a HOST_WIDE_INT.
* fold-const.c (fold_negate_expr_1, const_binop, const_unop)
(fold_convert_const, multiple_of_p, fold_negate_const): Handle
POLY_INT_CST.
(size_binop_loc): Likewise.  Allow int_const_binop_1 to fail.
(int_const_binop_2): New function, split out from...
(int_const_binop_1): ...here.  Handle POLY_INT_CST.
(size_int_kind): Take a poly_int64 instead of a HOST_WIDE_INT.
* expmed.c (make_tree): Handle CONST_POLY_INT_P.
* gimple-ssa-strength-reduction.c (slsr_process_add)
(slsr_process_mul): Check for INTEGER_CSTs before using them
as candidates.
* stor-layout.c (bits_from_bytes): New function.
(bit_from_pos): Use it.
(layout_type): Likewise.  For vectors, multiply the TYPE_SIZE_UNIT
by BITS_PER_UNIT to get the TYPE_SIZE.
* tree-cfg.c (verify_expr, verify_types_in_gimple_reference): Allow
MEM_REF and TARGET_MEM_REF offsets to be a POLY_INT_CST.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255863

6 years agopoly_int: rtx constants
Richard Sandiford [Wed, 20 Dec 2017 12:51:36 +0000 (12:51 +0000)]
poly_int: rtx constants

This patch adds an rtl representation of poly_int values.
There were three possible ways of doing this:

(1) Add a new rtl code for the poly_ints themselves and store the
    coefficients as trailing wide_ints.  This would give constants like:

      (const_poly_int [c0 c1 ... cn])

    The runtime value would be:

      c0 + c1 * x1 + ... + cn * xn

(2) Like (1), but use rtxes for the coefficients.  This would give
    constants like:

      (const_poly_int [(const_int c0)
                       (const_int c1)
                       ...
                       (const_int cn)])

    although the coefficients could be const_wide_ints instead
    of const_ints where appropriate.

(3) Add a new rtl code for the polynomial indeterminates,
    then use them in const wrappers.  A constant like c0 + c1 * x1
    would then look like:

      (const:M (plus:M (mult:M (const_param:M x1)
                               (const_int c1))
                       (const_int c0)))

There didn't seem to be that much to choose between them.  The main
advantage of (1) is that it's a more efficient representation and
that we can refer to the cofficients directly as wide_int_storage.

2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* doc/rtl.texi (const_poly_int): Document.  Also document the
rtl sharing behavior.
* gengenrtl.c (excluded_rtx): Return true for CONST_POLY_INT.
* rtl.h (const_poly_int_def): New struct.
(rtx_def::u): Add a cpi field.
(CASE_CONST_UNIQUE, CASE_CONST_ANY): Add CONST_POLY_INT.
(CONST_POLY_INT_P, CONST_POLY_INT_COEFFS): New macros.
(wi::rtx_to_poly_wide_ref): New typedef
(const_poly_int_value, wi::to_poly_wide, rtx_to_poly_int64)
(poly_int_rtx_p): New functions.
(trunc_int_for_mode): Declare a poly_int64 version.
(plus_constant): Take a poly_int64 instead of a HOST_WIDE_INT.
(immed_wide_int_const): Take a poly_wide_int_ref rather than
a wide_int_ref.
(strip_offset): Declare.
(strip_offset_and_add): New function.
* rtl.def (CONST_POLY_INT): New rtx code.
* rtl.c (rtx_size): Handle CONST_POLY_INT.
(shared_const_p): Use poly_int_rtx_p.
* emit-rtl.h (gen_int_mode): Take a poly_int64 instead of a
HOST_WIDE_INT.
(gen_int_shift_amount): Likewise.
* emit-rtl.c (const_poly_int_hasher): New class.
(const_poly_int_htab): New variable.
(init_emit_once): Initialize it when NUM_POLY_INT_COEFFS > 1.
(const_poly_int_hasher::hash): New function.
(const_poly_int_hasher::equal): Likewise.
(gen_int_mode): Take a poly_int64 instead of a HOST_WIDE_INT.
(immed_wide_int_const): Rename to...
(immed_wide_int_const_1): ...this and make static.
(immed_wide_int_const): New function, taking a poly_wide_int_ref
instead of a wide_int_ref.
(gen_int_shift_amount): Take a poly_int64 instead of a HOST_WIDE_INT.
(gen_lowpart_common): Handle CONST_POLY_INT.
* cse.c (hash_rtx_cb, equiv_constant): Likewise.
* cselib.c (cselib_hash_rtx): Likewise.
* dwarf2out.c (const_ok_for_output_1): Likewise.
* expr.c (convert_modes): Likewise.
* print-rtl.c (rtx_writer::print_rtx, print_value): Likewise.
* rtlhash.c (add_rtx): Likewise.
* explow.c (trunc_int_for_mode): Add a poly_int64 version.
(plus_constant): Take a poly_int64 instead of a HOST_WIDE_INT.
Handle existing CONST_POLY_INT rtxes.
* expmed.h (expand_shift): Take a poly_int64 instead of a
HOST_WIDE_INT.
* expmed.c (expand_shift): Likewise.
* rtlanal.c (strip_offset): New function.
(commutative_operand_precedence): Give CONST_POLY_INT the same
precedence as CONST_DOUBLE and put CONST_WIDE_INT between that
and CONST_INT.
* rtl-tests.c (const_poly_int_tests): New struct.
(rtl_tests_c_tests): Use it.
* simplify-rtx.c (simplify_const_unary_operation): Handle
CONST_POLY_INT.
(simplify_const_binary_operation): Likewise.
(simplify_binary_operation_1): Fold additions of symbolic constants
and CONST_POLY_INTs.
(simplify_subreg): Handle extensions and truncations of
CONST_POLY_INTs.
(simplify_const_poly_int_tests): New struct.
(simplify_rtx_c_tests): Use it.
* wide-int.h (storage_ref): Add default constructor.
(wide_int_ref_storage): Likewise.
(trailing_wide_ints): Use GTY((user)).
(trailing_wide_ints::operator[]): Add a const version.
(trailing_wide_ints::get_precision): New function.
(trailing_wide_ints::extra_size): Likewise.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255862

6 years agoAdd a gen_int_shift_amount helper function
Richard Sandiford [Wed, 20 Dec 2017 12:51:22 +0000 (12:51 +0000)]
Add a gen_int_shift_amount helper function

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, a 64-bit mode,
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 a 64-bit mode, but with a ??? comment.

2017-12-20  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: r255861

6 years agoFix multiple_p for two non-poly_ints
Richard Sandiford [Wed, 20 Dec 2017 12:50:35 +0000 (12:50 +0000)]
Fix multiple_p for two non-poly_ints

Fix a stupid inversion.  This function is very rarely used and was
mostly to help split patches up, which is why it didn't get picked
up during initial testing.

2017-12-20  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* poly-int.h (multiple_p): Fix handling of two non-poly_ints.

gcc/testsuite/
* gcc.dg/plugin/poly-int-tests.h (test_nonpoly_multiple_p): New
function.
(test_nonpoly_type): Call it.

From-SVN: r255860

6 years ago[arm][doc] Document accepted -march=armv8.3-a extension options
Kyrylo Tkachov [Wed, 20 Dec 2017 10:34:37 +0000 (10:34 +0000)]
[arm][doc] Document accepted -march=armv8.3-a extension options

I noticed that we helpfully list the extensions that are accepted
by the -march options on arm but we were missing the information
for 'armv8.3-a'.

This patchlet corrects that.
Built the documentation and it looked ok.

* doc/invoke.texi (ARM Options): Document accepted extension options
for -march=armv8.3-a.

From-SVN: r255859

6 years ago[arm] PR target/83105: Minor change of default CPU for arm-linux-gnueabi
Richard Earnshaw [Wed, 20 Dec 2017 10:30:00 +0000 (10:30 +0000)]
[arm] PR target/83105: Minor change of default CPU for arm-linux-gnueabi

When GCC for ARM/linux is configured with --with-float=hard, or
--with-float=softfp the compiler will now die when trying to build the
support libraries because the baseline architecture is too old to
support VFP (older versions of GCC just emitted the VFP instructions
anyway, even though they wouldn't run on that version of the
architecture; but we're now more prickly about it).

This patch fixed the problem by raising the default architecture
(actually the default CPU) to ARMv5te (ARM10e) when we need to generate
HW floating-point code.

PR target/83105
* config.gcc (arm*-*-linux*): When configured with --with-float=hard
or --with-float=softfp, set the default CPU to arm10e.

From-SVN: r255858

6 years ago[aarch64][libstdc++] Use __ARM_BIG_ENDIAN instead of __AARCH64EB__ in opt_random.h
Kyrylo Tkachov [Wed, 20 Dec 2017 10:28:13 +0000 (10:28 +0000)]
[aarch64][libstdc++] Use __ARM_BIG_ENDIAN instead of __AARCH64EB__ in opt_random.h

As has been spotted at https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01289.html
we check the __AARCH64EB__ macro for aarch64 big-endian
detection in config/cpu/aarch64/opt/ext/opt_random.h.
That works just fine with GCC but the standardised ACLE[1] macro
for that purpose is __ARM_BIG_ENDIAN so there is a possibility
that non-GCC compilers that include this header are not aware
of this predefine.

So this patch changes the use of __AARCH64EB__ to
the more portable __ARM_BIG_ENDIAN.

Tested on aarch64-none-elf and aarch64_be-none-elf.

Preapproved by Jeff at https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01326.html

* config/cpu/aarch64/opt/ext/opt_random.h (__VEXT): Check
__ARM_BIG_ENDIAN instead of __AARCH64EB__.

From-SVN: r255857

6 years agoconstraints.md (J, K, L): Use IN_RANGE macro.
Eric Botcazou [Wed, 20 Dec 2017 09:52:15 +0000 (09:52 +0000)]
constraints.md (J, K, L): Use IN_RANGE macro.

* config/visium/constraints.md (J, K, L): Use IN_RANGE macro.
* config/visium/predicates.md (const_shift_operand): Likewise.
* config/visium/visium.c (visium_legitimize_address): Fix oversight.
(visium_legitimize_reload_address): Likewise.

From-SVN: r255856

6 years ago2017-12-20 Paolo Carlini <paolo.carlini@oracle.com>
Paolo Carlini [Wed, 20 Dec 2017 09:47:05 +0000 (09:47 +0000)]
2017-12-20  Paolo Carlini  <paolo.carlini@oracle.com>

* Committing ChangeLog entry.

From-SVN: r255855

6 years agotrans.c (Loop_Statement_to_gnu): Use IN_RANGE macro.
Eric Botcazou [Wed, 20 Dec 2017 09:38:47 +0000 (09:38 +0000)]
trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro.

* gcc-interface/trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro.
* gcc-interface/misc.c (gnat_get_array_descr_info): Likewise.
(default_pass_by_ref): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity): Likewise.

From-SVN: r255854

6 years ago[arm] PR target/82975: Guard against reg_renumber being NULL in arm.h
Kyrylo Tkachov [Wed, 20 Dec 2017 09:29:13 +0000 (09:29 +0000)]
[arm] PR target/82975: Guard against reg_renumber being NULL in arm.h

Commit missing hunk to arm.h TEST_REGNO comment.

PR target/82975
* config/arm/arm.h (TEST_REGNO): Adjust comment as expected in
r255830.

From-SVN: r255853

6 years agore PR c++/83490 (ICE in find_call_stack_args, at dce.c:392)
Jakub Jelinek [Wed, 20 Dec 2017 09:12:09 +0000 (10:12 +0100)]
re PR c++/83490 (ICE in find_call_stack_args, at dce.c:392)

PR c++/83490
* calls.c (compute_argument_addresses): Ignore TYPE_EMPTY_P arguments.

* g++.dg/abi/empty29.C: New test.

From-SVN: r255852

6 years agoAdd two test-cases for (PR middle-end/82404).
Martin Liska [Wed, 20 Dec 2017 08:50:56 +0000 (09:50 +0100)]
Add two test-cases for (PR middle-end/82404).

2017-12-20  Martin Liska  <mliska@suse.cz>

PR middle-end/82404
* g++.dg/pr82404.C: New test.
* gcc.dg/pr82404.c: New test.

From-SVN: r255851

6 years agoEnable VPCLMULQDQ support
Julia Koval [Wed, 20 Dec 2017 06:20:44 +0000 (07:20 +0100)]
Enable VPCLMULQDQ support

gcc/
* common/config/i386/i386-common.c (OPTION_MASK_ISA_VPCLMULQDQ_SET,
OPTION_MASK_ISA_VPCLMULQDQ_UNSET): New.
(ix86_handle_option): Handle -mvpclmulqdq, move cx6 to flags2.
* config.gcc: Include vpclmulqdqintrin.h.
* config/i386/cpuid.h: Handle bit_VPCLMULQDQ.
* config/i386/driver-i386.c (host_detect_local_cpu): Handle -mvpclmulqdq.
* config/i386/i386-builtin.def (__builtin_ia32_vpclmulqdq_v2di,
__builtin_ia32_vpclmulqdq_v4di, __builtin_ia32_vpclmulqdq_v8di): New.
* config/i386/i386-c.c (__VPCLMULQDQ__): New.
* config/i386/i386.c (isa2_opts): Add -mcx16.
(isa_opts): Add -mpclmulqdq, remove -mcx16.
(ix86_option_override_internal): Move mcx16 to flags2.
(ix86_valid_target_attribute_inner_p): Add vpclmulqdq.
(ix86_expand_builtin): Handle OPTION_MASK_ISA_VPCLMULQDQ.
* config/i386/i386.h (TARGET_VPCLMULQDQ, TARGET_VPCLMULQDQ_P): New.
* config/i386/i386.opt: Add mvpclmulqdq, move mcx16 to flags2.
* config/i386/immintrin.h: Include vpclmulqdqintrin.h.
* config/i386/sse.md (vpclmulqdq_<mode>): New pattern.
* config/i386/vpclmulqdqintrin.h (_mm512_clmulepi64_epi128,
_mm_clmulepi64_epi128, _mm256_clmulepi64_epi128): New intrinsics.
* doc/invoke.texi: Add -mvpclmulqdq.

gcc/testsuite/
* gcc.target/i386/avx-1.c: Handle new intrinsics.
* gcc.target/i386/sse-13.c: Ditto.
* gcc.target/i386/sse-23.c: Ditto.
* gcc.target/i386/avx512-check.h: Handle bit_VPCLMULQDQ.
* gcc.target/i386/avx512f-vpclmulqdq-2.c: New test.
* gcc.target/i386/avx512vl-vpclmulqdq-2.c: Ditto.
* gcc.target/i386/vpclmulqdq.c: Ditto.
* gcc.target/i386/i386.exp (check_effective_target_vpclmulqdq): New.

From-SVN: r255850

6 years agoDon't call targetm.calls.static_chain in non-static function
Tom de Vries [Wed, 20 Dec 2017 00:46:38 +0000 (00:46 +0000)]
Don't call targetm.calls.static_chain in non-static function

2017-12-20  Tom de Vries  <tom@codesourcery.com>

PR middle-end/83423
* config/i386/i386.c (ix86_static_chain): Move DECL_STATIC_CHAIN test ...
* calls.c (rtx_for_static_chain): ... here.  New function.
* calls.h (rtx_for_static_chain): Declare.
* builtins.c (expand_builtin_setjmp_receiver): Use rtx_for_static_chain
instead of targetm.calls.static_chain.
* df-scan.c (df_get_entry_block_def_set): Same.

From-SVN: r255849

6 years agoDaily bump.
GCC Administrator [Wed, 20 Dec 2017 00:16:17 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r255848

6 years agore PR c++/82593 (Internal compiler error: in process_init_constructor_array, at cp...
Paolo Carlini [Tue, 19 Dec 2017 22:14:59 +0000 (22:14 +0000)]
re PR c++/82593 (Internal compiler error: in process_init_constructor_array, at cp/typeck2.c:1294)

/cp
2017-12-19  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/82593
* decl.c (check_array_designated_initializer): Not static.
* cp-tree.h (check_array_designated_initializer): Declare.
* typeck2.c (process_init_constructor_array): Call the latter.
* parser.c (cp_parser_initializer_list): Check the return value
of require_potential_rvalue_constant_expression.

/testsuite
2017-12-19  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/82593
* g++.dg/cpp0x/desig2.C: New.
* g++.dg/cpp0x/desig3.C: Likewise.
* g++.dg/cpp0x/desig4.C: Likewise.

From-SVN: r255845

6 years agoPR c++/83394 - always_inline vs. noinline no longer diagnosed
Martin Sebor [Tue, 19 Dec 2017 22:09:00 +0000 (22:09 +0000)]
PR c++/83394 - always_inline vs. noinline no longer diagnosed

PR c++/83394 - always_inline vs. noinline no longer diagnosed
PR c++/83322 - ICE: tree check: expected class ‘type’, have ‘exceptional’

gcc/cp/ChangeLog:

PR c++/83394
PR c++/83322
* decl2.c (cplus_decl_attributes): Look up member functions
in the scope of their class.

gcc/testsuite/ChangeLog:

PR c++/83394
* g++.dg/Wattributes-3.C: New test.
* g++.dg/Wattributes-4.C: New test.
* g++.dg/Wattributes-5.C: New test.

From-SVN: r255844

6 years agore PR target/82975 (ICE in baseness at rtlanal.c:6220)
Jakub Jelinek [Tue, 19 Dec 2017 21:55:23 +0000 (22:55 +0100)]
re PR target/82975 (ICE in baseness at rtlanal.c:6220)

PR target/82975
* gcc.dg/pr82975.c: Only add -mtune=cortex-a57 on arm*/aarch64*
targets.

From-SVN: r255843

6 years agoFix sharing in translate_isl_ast_node_for
Tom de Vries [Tue, 19 Dec 2017 21:49:20 +0000 (21:49 +0000)]
Fix sharing in translate_isl_ast_node_for

2017-12-19  Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/83493
* graphite-isl-ast-to-gimple.c (translate_isl_ast_node_for): Unshare ub
and lb.

From-SVN: r255842

6 years agoFix last ChangeLog entry date.
François Dumont [Tue, 19 Dec 2017 21:24:30 +0000 (21:24 +0000)]
Fix last ChangeLog entry date.

From-SVN: r255841

6 years agogimple-ssa-sprintf.c (format_directive): Use inform_n instead of inform with hardcode...
Jakub Jelinek [Tue, 19 Dec 2017 21:06:04 +0000 (22:06 +0100)]
gimple-ssa-sprintf.c (format_directive): Use inform_n instead of inform with hardcoded english plural handling.

* gimple-ssa-sprintf.c (format_directive): Use inform_n instead of
inform with hardcoded english plural handling.

From-SVN: r255840

6 years agore PR c++/82231 (ICE when deducing non-type template parameter value whose type depen...
Marek Polacek [Tue, 19 Dec 2017 20:44:19 +0000 (20:44 +0000)]
re PR c++/82231 (ICE when deducing non-type template parameter value whose type depends on a non-type `auto` template parameter from function arguments)

PR c++/82231
* g++.dg/cpp1z/nontype-auto14.C: New test.

From-SVN: r255839

6 years agore PR middle-end/83477 (Wrong code w/ -O1)
Jeff Law [Tue, 19 Dec 2017 20:13:04 +0000 (13:13 -0700)]
re PR middle-end/83477 (Wrong code w/ -O1)

PR tree-optimization/83477
* tree-ssa-threadedge.c (record_temporary_equivalences_from_phis): For
a non-virtual PHI, always push a new range.

PR tree-optimization/83477
* gcc.c-torture/execute/pr83477.c: New test.

From-SVN: r255837

6 years agoPR middle-end/77608 - missing protection on trivially detectable runtime buffer overflow
Martin Sebor [Tue, 19 Dec 2017 19:14:57 +0000 (12:14 -0700)]
PR middle-end/77608 - missing protection on trivially detectable runtime buffer overflow

gcc/ChangeLog:

PR middle-end/77608
* builtins.c (compute_objsize): Handle non-constant offsets.

gcc/testsuite/ChangeLog:

PR middle-end/77608
* gcc.dg/Wstringop-overflow.c: New test.
* gcc/testsuite/c-c++-common/Warray-bounds-3.c: Adjust.

From-SVN: r255836

6 years agore PR tree-optimization/83444 (missing strlen optimization on a member array of a...
Jakub Jelinek [Tue, 19 Dec 2017 18:10:04 +0000 (19:10 +0100)]
re PR tree-optimization/83444 (missing strlen optimization on a member array of a local struct)

PR tree-optimization/83444
* tree-ssa-strlen.c (strlen_check_and_optimize_stmt): For the
character load case, if get_stridx on MEM_REF's operand doesn't
look usable, retry with get_addr_stridx.

* gcc.dg/strlenopt-38.c: New test.

From-SVN: r255835

6 years agoSFN: don't drop markers for skipping var-tracking
Alexandre Oliva [Tue, 19 Dec 2017 17:50:54 +0000 (17:50 +0000)]
SFN: don't drop markers for skipping var-tracking

Although debug markers are more useful when bind stmts are placed
among them, there is value in keeping them even when VTA limits are
exceeded.

for  gcc/ChangeLog

PR debug/83422
* var-tracking.c (vt_debug_insns_local): Do not drop markers.
(variable_tracking_main_1): Keep markers even when VTA fails.

for  gcc/testsuite/ChangeLog

PR debug/83422
* gcc.dg/pr83422.c: New.

From-SVN: r255834

6 years ago[SFN] start rtl block with label, then markers
Alexandre Oliva [Tue, 19 Dec 2017 17:50:31 +0000 (17:50 +0000)]
[SFN] start rtl block with label, then markers

Emitting markers before labels turned out to not be worth the trouble.
The markers outside BBs confuse the ebb scheduler, and they don't add
any useful information.  I'll arrange for markers to be moved past
labels, even in gimple, but for now this will fix the two remaining
known problems on ia64.

for  gcc/ChangeLog

PR bootstrap/83396
* cfgexpand.c (expand_gimple_basic_block): Expand label first,
even if there are markers before it.
* cfgrtl.c (rtl_verify_bb_layout): Reject DEBUG_INSNs outside BBs.

From-SVN: r255833

6 years agore PR testsuite/83454 (FAIL: gcc.dg/tree-ssa/cswtch-4.c and cswtch-5.c)
Jakub Jelinek [Tue, 19 Dec 2017 17:12:41 +0000 (18:12 +0100)]
re PR testsuite/83454 (FAIL: gcc.dg/tree-ssa/cswtch-4.c and cswtch-5.c)

PR testsuite/83454
* gcc.dg/tree-ssa/cswtch-4.c: Require nonpic effective target.
* gcc.dg/tree-ssa/cswtch-5.c: Likewise.

From-SVN: r255832

6 years agoread-rtl.c (parse_reg_note_name): Replace Yoda conditions with typical order conditions.
Jakub Jelinek [Tue, 19 Dec 2017 17:11:57 +0000 (18:11 +0100)]
read-rtl.c (parse_reg_note_name): Replace Yoda conditions with typical order conditions.

* read-rtl.c (parse_reg_note_name): Replace Yoda conditions with
typical order conditions.
* sel-sched.c (extract_new_fences_from): Likewise.
* config/visium/constraints.md (J, K, L): Likewise.
* config/visium/predicates.md (const_shift_operand): Likewise.
* config/visium/visium.c (visium_legitimize_address,
visium_legitimize_reload_address): Likewise.
* config/m68k/m68k.c (output_reg_adjust, emit_reg_adjust): Likewise.
* config/arm/arm.c (arm_block_move_unaligned_straight): Likewise.
* config/avr/constraints.md (Y01, Ym1, Y02, Ym2): Likewise.
* config/avr/avr-log.c (avr_vdump, avr_log_set_avr_log,
SET_DUMP_DETAIL): Likewise.
* config/avr/predicates.md (const_8_16_24_operand): Likewise.
* config/avr/avr.c (STR_PREFIX_P, avr_popcount_each_byte,
avr_is_casesi_sequence, avr_casei_sequence_check_operands,
avr_set_core_architecture, avr_set_current_function,
avr_legitimize_reload_address, avr_asm_len, avr_print_operand,
output_movqi, output_movsisf, avr_out_plus, avr_out_bitop,
avr_out_fract, avr_adjust_insn_length, avr_encode_section_info,
avr_2word_insn_p, output_reload_in_const, avr_has_nibble_0xf,
avr_map_decompose, avr_fold_builtin): Likewise.
* config/avr/driver-avr.c (avr_devicespecs_file): Likewise.
* config/avr/gen-avr-mmcu-specs.c (str_prefix_p, print_mcu): Likewise.
* config/i386/i386.c (ix86_parse_stringop_strategy_string): Likewise.
* config/m32c/m32c-pragma.c (m32c_pragma_memregs): Likewise.
* config/m32c/m32c.c (m32c_conditional_register_usage,
m32c_address_cost): Likewise.
* config/m32c/predicates.md (shiftcount_operand,
longshiftcount_operand): Likewise.
* config/iq2000/iq2000.c (iq2000_expand_prologue): Likewise.
* config/nios2/nios2.c (nios2_handle_custom_fpu_insn_option,
can_use_cdx_ldstw): Likewise.
* config/nios2/nios2.h (CDX_REG_P): Likewise.
* config/cr16/cr16.h (RETURN_ADDR_RTX, REGNO_MODE_OK_FOR_BASE_P):
Likewise.
* config/cr16/cr16.md (*mov<mode>_double): Likewise.
* config/cr16/cr16.c (cr16_create_dwarf_for_multi_push): Likewise.
* config/h8300/h8300.c (h8300_rtx_costs, get_shift_alg): Likewise.
* config/vax/constraints.md (U06, U08, U16, CN6, S08, S16): Likewise.
* config/vax/vax.c (adjacent_operands_p): Likewise.
* config/ft32/constraints.md (L, b, KA): Likewise.
* config/ft32/ft32.c (ft32_load_immediate, ft32_expand_prologue):
Likewise.
* cfgexpand.c (expand_stack_alignment): Likewise.
* gcse.c (insert_expr_in_table): Likewise.
* print-rtl.c (rtx_writer::print_rtx_operand_codes_E_and_V): Likewise.
* cgraphunit.c (cgraph_node::expand): Likewise.
* ira-build.c (setup_min_max_allocno_live_range_point): Likewise.
* emit-rtl.c (add_insn): Likewise.
* input.c (dump_location_info): Likewise.
* passes.c (NEXT_PASS): Likewise.
* read-rtl-function.c (parse_note_insn_name,
function_reader::read_rtx_operand_r, function_reader::parse_mem_expr):
Likewise.
* sched-rgn.c (sched_rgn_init): Likewise.
* diagnostic-show-locus.c (layout::show_ruler): Likewise.
* combine.c (find_split_point, simplify_if_then_else, force_to_mode,
if_then_else_cond, simplify_shift_const_1, simplify_comparison): Likewise.
* explow.c (eliminate_constant_term): Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* cfgrtl.c (print_rtl_with_bb): Likewise.
* genhooks.c (emit_init_macros): Likewise.
* poly-int.h (maybe_ne, maybe_le, maybe_lt): Likewise.
* tree-data-ref.c (conflict_fn): Likewise.
* selftest.c (assert_streq): Likewise.
* expr.c (store_constructor_field, expand_expr_real_1): Likewise.
* fold-const.c (fold_range_test, extract_muldiv_1, fold_truth_andor,
fold_binary_loc, multiple_of_p): Likewise.
* reload.c (push_reload, find_equiv_reg): Likewise.
* et-forest.c (et_nca, et_below): Likewise.
* dbxout.c (dbxout_symbol_location): Likewise.
* reorg.c (relax_delay_slots): Likewise.
* dojump.c (do_compare_rtx_and_jump): Likewise.
* gengtype-parse.c (type): Likewise.
* simplify-rtx.c (simplify_gen_ternary, simplify_gen_relational,
simplify_const_relational_operation): Likewise.
* reload1.c (do_output_reload): Likewise.
* dumpfile.c (get_dump_file_info_by_switch): Likewise.
* gengtype.c (type_for_name): Likewise.
* gimple-ssa-sprintf.c (format_directive): Likewise.
ada/
* gcc-interface/trans.c (Loop_Statement_to_gnu): Replace Yoda
conditions with typical order conditions.
* gcc-interface/misc.c (gnat_get_array_descr_info,
default_pass_by_ref): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity): Likewise.
* adaint.c (__gnat_tmp_name): Likewise.
c-family/
* known-headers.cc (get_stdlib_header_for_name): Replace Yoda
conditions with typical order conditions.
c/
* c-typeck.c (comptypes_internal, function_types_compatible_p,
perform_integral_promotions, digest_init): Replace Yoda conditions
with typical order conditions.
* c-decl.c (check_bitfield_type_and_width): Likewise.
cp/
* name-lookup.c (get_std_name_hint): Replace Yoda conditions with
typical order conditions.
* class.c (check_bitfield_decl): Likewise.
* pt.c (convert_template_argument): Likewise.
* decl.c (duplicate_decls): Likewise.
* typeck.c (commonparms): Likewise.
fortran/
* scanner.c (preprocessor_line): Replace Yoda conditions with typical
order conditions.
* dependency.c (check_section_vs_section): Likewise.
* trans-array.c (gfc_conv_expr_descriptor): Likewise.
jit/
* jit-playback.c (get_type, playback::compile_to_file::copy_file,
playback::context::acquire_mutex): Replace Yoda conditions with
typical order conditions.
* libgccjit.c (gcc_jit_context_new_struct_type,
gcc_jit_struct_set_fields, gcc_jit_context_new_union_type,
gcc_jit_context_new_function, gcc_jit_timer_pop): Likewise.
* jit-builtins.c (matches_builtin): Likewise.
* jit-recording.c (recording::compound_type::set_fields,
recording::fields::write_reproducer, recording::rvalue::set_scope,
recording::function::validate): Likewise.
* jit-logging.c (logger::decref): Likewise.

From-SVN: r255831

6 years ago[arm] PR target/82975: Guard against reg_renumber being NULL in arm.h
Kyrylo Tkachov [Tue, 19 Dec 2017 16:58:22 +0000 (16:58 +0000)]
[arm] PR target/82975: Guard against reg_renumber being NULL in arm.h

In this bug we ICE when checking REGNO_OK_FOR_INDEX_P on arm during pre-IRA scheduling.
This is because REGNO_OK_FOR_INDEX_P ends up checking the reg_renumber array.
Before IRA reg_renumber is NULL and thus we segfault.

The fix is to guard the use of reg_renumber in the logic in TEST_REGNO in arm.h.
On aarch64, for example, we also guard against the reg_renumber == NULL case.
This fixes the ICE. I also remove the part of the comment that muses on when reg_renumber
is available as with this patch it should now be safe to use at any point.

Bootstrapped and tested on arm-none-linux-gnueabihf.

PR target/82975
* config/arm/arm.h (TEST_REGNO): Check reg_renumber is set before
accessing it.  Adjust comment.

* gcc.dg/pr82975.c: New test.

From-SVN: r255830

6 years agore PR middle-end/81914 (gcc 7.1 generates branch for code which was branchless in...
Jakub Jelinek [Tue, 19 Dec 2017 16:43:04 +0000 (17:43 +0100)]
re PR middle-end/81914 (gcc 7.1 generates branch for code which was branchless in earlier gcc version)

PR middle-end/81914
* predict.c (zero_one_minusone): New function.
(apply_return_prediction): Avoid return prediction for functions
returning only -1, 0 and 1 values, unless they only return -1 and 0
or 0 and 1.

From-SVN: r255829

6 years ago[ARC][COMMITTED] Clean up build warnings.
Claudiu Zissulescu [Tue, 19 Dec 2017 15:11:20 +0000 (16:11 +0100)]
[ARC][COMMITTED] Clean up build warnings.

2017-12-19  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.c (legitimate_scaled_address_p): Clean
fall-through warning.
(arc_compute_frame_size): Remove unused variables.
(arc_print_operand): Fix fprintif format.
(arc_can_follow_jump): Clean fall-through warning.

From-SVN: r255827

6 years agoFix a file name.
Marek Polacek [Tue, 19 Dec 2017 15:06:18 +0000 (15:06 +0000)]
Fix a file name.

From-SVN: r255826

6 years agoFix PR numbers.
Marek Polacek [Tue, 19 Dec 2017 15:03:33 +0000 (15:03 +0000)]
Fix PR numbers.

From-SVN: r255825

6 years agore PR c++/83490 (ICE in find_call_stack_args, at dce.c:392)
Marek Polacek [Tue, 19 Dec 2017 14:58:17 +0000 (14:58 +0000)]
re PR c++/83490 (ICE in find_call_stack_args, at dce.c:392)

PR c++/83490
* config/i386/i386.c (init_cumulative_args): Don't check TYPE_EMPTY_P
on an error node.

* g++.dg/abi/pr83490.C: New test.

From-SVN: r255824

6 years agocommit_message
Claudiu Zissulescu [Tue, 19 Dec 2017 14:31:03 +0000 (15:31 +0100)]
commit_message

From-SVN: r255823

6 years agoAdd a tetst for PR middle-end/83471
H.J. Lu [Tue, 19 Dec 2017 13:38:29 +0000 (13:38 +0000)]
Add a tetst for PR middle-end/83471

PR middle-end/83471
* g++.dg/torture/pr83471.C: New test.

From-SVN: r255821

6 years ago[PATCH] -fdump-tree, -save-temps=obj & subdirs
Nathan Sidwell [Tue, 19 Dec 2017 13:27:55 +0000 (13:27 +0000)]
[PATCH] -fdump-tree, -save-temps=obj & subdirs

https://gcc.gnu.org/ml/gcc-patches/2017-12/msg00377.html
* opts.c (finish_options): Don't prefix dump_base_name if it
already contains directories.

From-SVN: r255820

6 years agoFix another failing test-case.
Martin Liska [Tue, 19 Dec 2017 13:21:07 +0000 (14:21 +0100)]
Fix another failing test-case.

2017-12-19  Martin Liska  <mliska@suse.cz>

* gcc.dg/tree-prof/switch-case-1.c: Scan IPA profile dump
file instead of expand in order to not mix it with expanded
tree decision tree for the switch statement.

From-SVN: r255819

6 years agoFix off by one error in loop-unroll.c (PR rtl-optimization/82675).
Martin Liska [Tue, 19 Dec 2017 13:20:07 +0000 (14:20 +0100)]
Fix off by one error in loop-unroll.c (PR rtl-optimization/82675).

2017-12-19  Martin Liska  <mliska@suse.cz>

PR rtl-optimization/82675
* loop-unroll.c (unroll_loop_constant_iterations): Allocate one
more element in sbitmap.

From-SVN: r255818

6 years agore PR c++/83482 (internal compiler error: Segmentation fault)
Marek Polacek [Tue, 19 Dec 2017 11:12:35 +0000 (11:12 +0000)]
re PR c++/83482 (internal compiler error: Segmentation fault)

PR tree-optimization/83482
* g++.dg/torture/pr83482.C: New test.

From-SVN: r255817

6 years agogimplify.c (gimplify_expr): Use error_operand_p.
Paolo Carlini [Tue, 19 Dec 2017 10:54:20 +0000 (10:54 +0000)]
gimplify.c (gimplify_expr): Use error_operand_p.

2017-12-19  Paolo Carlini  <paolo.carlini@oracle.com>

* gimplify.c (gimplify_expr): Use error_operand_p.

From-SVN: r255816

6 years agocp-tree.h: Fix typo in comment.
Paolo Carlini [Tue, 19 Dec 2017 10:49:03 +0000 (10:49 +0000)]
cp-tree.h: Fix typo in comment.

2017-12-19  Paolo Carlini  <paolo.carlini@oracle.com>

* cp-tree.h: Fix typo in comment.

From-SVN: r255815

6 years agoAdded testcase for PR 83329
Martin Jambor [Tue, 19 Dec 2017 10:43:00 +0000 (11:43 +0100)]
Added testcase for PR 83329

2017-12-19  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/83329
* gcc.dg/tree-ssa/pr83329.c: New test

From-SVN: r255814

6 years agore PR c++/79490 (ICE when using -fsyntax-only with CATCH unit testing framework header)
Paolo Carlini [Tue, 19 Dec 2017 09:26:39 +0000 (09:26 +0000)]
re PR c++/79490 (ICE when using -fsyntax-only with CATCH unit testing framework header)

2017-12-19  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/79490
* g++.dg/other/fsyntax-only2.C: New.

From-SVN: r255812

6 years agore PR ada/66205 (gnatbind generates invalid code when finalization is enabled in...
Arnaud Charlet [Tue, 19 Dec 2017 08:43:49 +0000 (08:43 +0000)]
re PR ada/66205 (gnatbind generates invalid code when finalization is enabled in restricted runtime)

PR ada/66205
* bindgen.adb (Gen_AdaFinal): Revert previous change.

From-SVN: r255811

6 years agoRTEMS/PowerPC: Remove 64-bit soft-float multilib
Sebastian Huber [Tue, 19 Dec 2017 08:16:34 +0000 (08:16 +0000)]
RTEMS/PowerPC: Remove 64-bit soft-float multilib

gcc/
PR target/83387
* config/rs6000/t-rtems (MULTILIB_REQUIRED): Remove 64-bit soft-float
multilib.

From-SVN: r255809

6 years agoSPARC: Make sure that jump is to a label in errata workaround
Daniel Cederman [Tue, 19 Dec 2017 08:04:52 +0000 (08:04 +0000)]
SPARC: Make sure that jump is to a label in errata workaround

In some cases the jump could be to a return instruction and in those cases the
next_active_insn() function tries to follow an invalid pointer which leads to a
crash. This error did not manifest when using a 32-bit version of GCC which is
why I did not detect it before.

gcc/
* config/sparc/sparc.c (sparc_do_work_around_errata): Make sure
the jump is to a label.

From-SVN: r255807

6 years agore PR tree-optimization/83444 (missing strlen optimization on a member array of a...
Jakub Jelinek [Tue, 19 Dec 2017 07:44:07 +0000 (08:44 +0100)]
re PR tree-optimization/83444 (missing strlen optimization on a member array of a local struct)

PR tree-optimization/83444
* tree-ssa-strlen.c (strlen_check_and_optimize_stmt): Optimize
character loads.

* gcc.dg/strlenopt-38.c: New test.

From-SVN: r255806

6 years agore PR ipa/82801 (Internal compiler error with Eigen and __attribute__((always_inline...
Jakub Jelinek [Tue, 19 Dec 2017 07:41:30 +0000 (08:41 +0100)]
re PR ipa/82801 (Internal compiler error with Eigen and __attribute__((always_inline, flatten)))

PR ipa/82801
PR ipa/83346
* ipa-inline.c (flatten_remove_node_hook): New function.
(ipa_inline): Keep only nodes with flatten attribute at the end of
the array in the order from ipa_reverse_postorder, only walk that
portion of array for flattening, if there is more than one such
node, temporarily register a removal hook and ignore removed nodes.

* g++.dg/ipa/pr82801.C: New test.

From-SVN: r255805

6 years agore PR tree-optimization/80631 (Compiling with -O3 -mavx2 gives wrong code)
Jakub Jelinek [Tue, 19 Dec 2017 07:39:24 +0000 (08:39 +0100)]
re PR tree-optimization/80631 (Compiling with -O3 -mavx2 gives wrong code)

PR tree-optimization/80631
* tree-vect-loop.c (vect_create_epilog_for_reduction): Compare
induc_code against MAX_EXPR or MIN_EXPR instead of reduc_fn against
IFN_REDUC_MAX or IFN_REDUC_MIN.

From-SVN: r255804

6 years agotree-ssa-dom.c (record_equivalences_from_phis): Do not record symbolic equivalences...
Jeff Law [Tue, 19 Dec 2017 05:04:55 +0000 (22:04 -0700)]
tree-ssa-dom.c (record_equivalences_from_phis): Do not record symbolic equivalences from backedges in the CFG.

* tree-ssa-dom.c (record_equivalences_from_phis): Do not
record symbolic equivalences from backedges in the CFG.

From-SVN: r255803

6 years agoRevert
Jeff Law [Tue, 19 Dec 2017 04:35:59 +0000 (21:35 -0700)]
Revert
2017-11-19  Jeff Law  <law@redhat.com>

* tree-ssa-dom.c (record_equivalences_from_phis): Fix handling
of degenerates resulting from ignoring an edge.

From-SVN: r255802

6 years agoDaily bump.
GCC Administrator [Tue, 19 Dec 2017 00:16:18 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r255795

6 years agoPR middle-end/83373 - False positive reported by -Wstringop-overflow
Martin Sebor [Mon, 18 Dec 2017 22:49:57 +0000 (22:49 +0000)]
PR middle-end/83373 - False positive reported by -Wstringop-overflow

PR middle-end/83373 - False positive reported by -Wstringop-overflow
PR tree-optimization/78450 - strlen(s) return value can be assumed to be less than the size of s

gcc/ChangeLog:

PR middle-end/83373
PR tree-optimization/78450
* tree-ssa-strlen.c (maybe_set_strlen_range): New function.
(handle_builtin_strlen): Call it.

gcc/testsuite/ChangeLog:

PR middle-end/83373
PR tree-optimization/78450
* gcc.dg/pr83373.c: New test.
* gcc.dg/strlenopt-36.c: New test.
* gcc.dg/strlenopt-37.c: New test.

From-SVN: r255790

6 years agore PR libstdc++/80761 (std::set<T,C,A>::insert_return_type uses wrong iterator type)
François Dumont [Mon, 18 Dec 2017 21:59:17 +0000 (21:59 +0000)]
re PR libstdc++/80761 (std::set<T,C,A>::insert_return_type uses wrong iterator type)

2017-11-20  François Dumont  <fdumont@gcc.gnu.org>

PR libstdc++/80761
* include/debug/map.h
(std::__debug::map<>::insert_return_type): Define using
_Node_insert_return.
* include/debug/set.h (std::__debug::set<>::insert_return_type):
Likewise.
* include/debug/unordered_map:
(std::__debug::unordered_map<>::insert_return_type): Likewise.
* include/debug/unordered_set:
(std::__debug::unordered_set<>::insert_return_type): Likewise.

From-SVN: r255789

6 years agore PR c++/83116 (Statement with no effect causes wrong code of static object constexp...
Marek Polacek [Mon, 18 Dec 2017 21:25:16 +0000 (21:25 +0000)]
re PR c++/83116 (Statement with no effect causes wrong code of static object constexpr method)

PR c++/83116
* constexpr.c (cxx_eval_call_expression): Only look into
constexpr_call_table if ctx->strict.

* g++.dg/cpp1y/constexpr-83116.C: New test.

From-SVN: r255788

6 years agortlanal: dead_or_set_regno_p should handle CLOBBER (PR83424)
Segher Boessenkool [Mon, 18 Dec 2017 20:16:19 +0000 (21:16 +0100)]
rtlanal: dead_or_set_regno_p should handle CLOBBER (PR83424)

In PR83424 combine's move_deaths puts a REG_DEAD note in the wrong place
because dead_or_set_regno_p does not account for CLOBBER insns.  This
fixes it.

PR rtl-optimization/83424
* rtlanal.c (dead_or_set_regno_p): Handle CLOBBER just like SET.

gcc/testsuite/
PR rtl-optimization/83424
* gcc.dg/pr83424.c: New testsuite.

From-SVN: r255787

6 years agotestsuite: add coverage for diagnostics relating to inlining (PR tree-optimization...
David Malcolm [Mon, 18 Dec 2017 19:23:30 +0000 (19:23 +0000)]
testsuite: add coverage for diagnostics relating to inlining (PR tree-optimization/83336)

In theory, the diagnostics subsystem can print context information on
code inlining when diagnostics are emitted by the middle-end, describing
the chain of inlined callsites that led to a particular warning,
but PR tree-optimization/83336 describes various issues with this.

An underlying issue is that we have very little automated testing for
this code: gcc.dg/tm/pr52141.c has a test, but in general, prune.exp
filters out the various "inlined from" lines.

The following patch adds test coverage for it for C and C++ via a new
testsuite plugin, which emits a warning from the middle-end; the test
cases use dg-regexp to verify that the "inlined from" lines are
emitted correctly, with the correct function names and source locations.

Doing so requires a change to prune.exp: the dg-regexp lines have to
be handled *before* the "inlined from" lines are stripped.

gcc/testsuite/ChangeLog:
PR tree-optimization/83336
* g++.dg/cpp0x/missing-initializer_list-include.C: Update for
changes to prune.exp's handling of dg-regexp.
* g++.dg/plugin/diagnostic-test-inlining-1.C: New test case.
* g++.dg/plugin/plugin.exp (plugin_test_list): Add it, via
gcc.dg's plugin/diagnostic_plugin_test_inlining.c.
* gcc.dg/plugin/diagnostic-test-inlining-1.c: New test case.
* gcc.dg/plugin/diagnostic-test-inlining-2.c: Likewise.
* gcc.dg/plugin/diagnostic-test-inlining-3.c: Likewise.
* gcc.dg/plugin/diagnostic-test-inlining-4.c: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_inlining.c: New test
plugin.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add them.
* lib/prune.exp (prune_gcc_output): Move call to handle-dg-regexps
to before the various text stripping regsup invocations,
in particular, to before the stripping of "inlined from".

From-SVN: r255786

6 years agore PR libstdc++/68430 (std::is_constructible<T>::value == true for unconstructible...
Ville Voutilainen [Mon, 18 Dec 2017 18:46:30 +0000 (20:46 +0200)]
re PR libstdc++/68430 (std::is_constructible<T>::value == true for unconstructible type T)

PR libstdc++/68430

* testsuite/20_util/is_constructible/68430.cc: New.

From-SVN: r255785

6 years agore PR middle-end/83460 (FAIL: g++.dg/pr79095-4.C)
Jeff Law [Mon, 18 Dec 2017 18:13:20 +0000 (11:13 -0700)]
re PR middle-end/83460 (FAIL: g++.dg/pr79095-4.C)

PR middle-end/83460
* g++.dg/pr79095-4.C: Remove compromised test.

From-SVN: r255784

6 years agore PR c++/83300 (Segmentation fault with template and __attribute__((vector_size...
Jakub Jelinek [Mon, 18 Dec 2017 17:52:13 +0000 (18:52 +0100)]
re PR c++/83300 (Segmentation fault with template and __attribute__((vector_size (sizeof(int) * N)));)

PR c++/83300
* decl2.c (save_template_attributes): Add flags argument, if
not ATTR_FLAG_TYPE_IN_PLACE, *decl_p is a type and we want to
modify TYPE_ATTRIBUTES, add them on type attribute variant.

* g++.dg/ext/vector33.C: New test.

From-SVN: r255783

6 years agoc-warn.c (warn_logical_operator): Return early if -Wlogical-op is not in effect.
Marek Polacek [Mon, 18 Dec 2017 16:49:59 +0000 (16:49 +0000)]
c-warn.c (warn_logical_operator): Return early if -Wlogical-op is not in effect.

* c-warn.c (warn_logical_operator): Return early if -Wlogical-op is
not in effect.

From-SVN: r255782

6 years agore PR middle-end/83463 (ICE: tree check: expected integer_type or enumeral_type or...
Marek Polacek [Mon, 18 Dec 2017 16:44:35 +0000 (16:44 +0000)]
re PR middle-end/83463 (ICE: tree check: expected integer_type or enumeral_type or boolean_type or real_type or fixed_point_type, have pointer_type in builtin_memr ef, at gimple-ssa-warn-restrict.c:297)

PR middle-end/83463
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref):
Check if TYPE is INTEGRAL_TYPE_P before accessing its min/max
values.

* gcc.dg/pr83463.c: New test.

From-SVN: r255781

6 years ago[PR c++/59930] template friend injection
Nathan Sidwell [Mon, 18 Dec 2017 16:30:58 +0000 (16:30 +0000)]
[PR c++/59930] template friend injection

https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01168.html
PR c++/59930
* name-lookup.c (name_lookup::search_unqualified): Don't search
parent namespace when looking for hidden things.
* pt.c (tsubst_friend_class): Always push to friend scope, drop
unneeded self-friend check. Inject new hidden friend into correct
scope.

PR c++/59930
* g++.dg/parse/pr81247-c.C: Adjust.
* g++.dg/template/pr59930-[123].C: New.

From-SVN: r255780

6 years ago[ARC] Update (u)maddsidi patterns.
Claudiu Zissulescu [Mon, 18 Dec 2017 15:26:47 +0000 (16:26 +0100)]
[ARC] Update (u)maddsidi patterns.

The accumulator registers are freely used by the compiler. However,
there are a number of instructions which are having an intrinsic use
of these registers. Update patterns to inform the compiler which ones.

gcc/
2017-09-19  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.md (maddsidi4, maddsidi4_split): Update pattern.
(umaddsidi4,umaddsidi4): Likewise.

gcc/testsuite
2017-09-19  Claudiu Zissulescu  <claziss@synopsys.com>

* gcc.target/arc/tumaddsidi4.c: New test.

From-SVN: r255779

6 years ago[ARC] Update legitimate constant hook.
Claudiu Zissulescu [Mon, 18 Dec 2017 15:26:35 +0000 (16:26 +0100)]
[ARC] Update legitimate constant hook.

Make sure we check the constants in all cases.

gcc/
2017-10-14  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.c (arc_legitimate_constant_p): Always check all
constants.

testsuite/
2017-10-14  Claudiu Zissulescu  <claziss@synopsys.com>

* gcc.target/arc/tls-1.c: New test.

From-SVN: r255778

6 years agoS/390: PR83420: Improve hotpatch option parsing.
Andreas Krebbel [Mon, 18 Dec 2017 11:31:06 +0000 (11:31 +0000)]
S/390: PR83420: Improve hotpatch option parsing.

With the attached patch we get rid of the following build failure:

/home/andreas/build/../gcc/gcc/config/s390/s390.c: In function ‘void
s390_option_override()’:
/home/andreas/build/../gcc/gcc/config/s390/s390.c:15361:16: error: ‘char*
strncpy(char*, const char*, size_t)’ specified bound 256 equals destination
size [-Werror=stringop-truncation]
        strncpy (s, opt->arg, 256);
        ~~~~~~~~^~~~~~~~~~~~~~~~~~

gcc/ChangeLog:

2017-12-18  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

PR target/83420
* config/s390/s390.c (s390_option_override): Avoid strncpy.

From-SVN: r255777

6 years agore PR ipa/81877 (Incorrect results with lto and -fipa-cp and -fipa-cp-clone)
Richard Biener [Mon, 18 Dec 2017 08:35:23 +0000 (08:35 +0000)]
re PR ipa/81877 (Incorrect results with lto and -fipa-cp and -fipa-cp-clone)

2017-12-18  Richard Biener  <rguenther@suse.de>

PR tree-optimization/81877
* tree-ssa-loop-im.c (ref_indep_loop_p): Remove safelen parameters.
(outermost_indep_loop): Adjust.
(ref_indep_loop_p_1): Likewise.  Remove safelen handling again.
(can_sm_ref_p): Adjust.

* g++.dg/torture/pr81877.C: New testcase.
* g++.dg/vect/pr70729.cc: XFAIL.
* g++.dg/vect/pr70729-nest.cc: XFAIL.

From-SVN: r255776

6 years agore PR tree-optimization/77291 (False positive for -Warray-bounds)
Richard Biener [Mon, 18 Dec 2017 08:33:26 +0000 (08:33 +0000)]
re PR tree-optimization/77291 (False positive for -Warray-bounds)

2017-12-18  Richard Biener  <rguenther@suse.de>

PR middle-end/77291
* tree.c (array_at_struct_end_p): Return true if the underlying
object has space for at least one element in excess of what
the array domain specifies.

* gcc.dg/Warray-bounds-26.c: New testcase.

From-SVN: r255775

6 years agoextend.texi (x86 Function Attributes): Reformat nocf_check example to avoid overfull...
Sandra Loosemore [Mon, 18 Dec 2017 05:38:59 +0000 (00:38 -0500)]
extend.texi (x86 Function Attributes): Reformat nocf_check example to avoid overfull hbox.

2017-12-17  Sandra Loosemore  <sandra@codesourcery.com>

gcc/
* doc/extend.texi (x86 Function Attributes): Reformat nocf_check
example to avoid overfull hbox.
* doc/invoke.texi (Option Summary): Add missing @gol.
(C++ Dialect Options): Reformat -Wnoexcept-type example to avoid
overfull hbox.

From-SVN: r255774

6 years agoinvoke.texi (Option Summary): Add -mverbose-cost-dump to AArch64 and ARM lists, plus...
Sandra Loosemore [Mon, 18 Dec 2017 04:02:47 +0000 (23:02 -0500)]
invoke.texi (Option Summary): Add -mverbose-cost-dump to AArch64 and ARM lists, plus missing -mflip-thumb for ARM.

2017-12-17  Sandra Loosemore  <sandra@codesourcery.com>
    Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

gcc/
* doc/invoke.texi (Option Summary): Add -mverbose-cost-dump
to AArch64 and ARM lists, plus missing -mflip-thumb for ARM.
(AArch64 Options): Document -mverbose-cost-dump.
(ARM Options): Likewise, plus -mflip-thumb.

Co-Authored-By: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
From-SVN: r255773

6 years agoPR bootstrap/83446 - Bootstrap failed on i686
Martin Sebor [Mon, 18 Dec 2017 03:31:05 +0000 (03:31 +0000)]
PR bootstrap/83446 - Bootstrap failed on i686

gcc/testsuite/ChangeLog:

PR bootstrap/83446
* c-c++-common/Warray-bounds-3.c: Adjust.
* gcc.dg/Warray-bounds-25.c: New test.

gcc/ChangeLog:

PR bootstrap/83446
* gimple-ssa-warn-restrict.c
(builtin_memref::offset_out_of_bounds): Correct the handling of
anti-ranges.

From-SVN: r255772

6 years agoDaily bump.
GCC Administrator [Mon, 18 Dec 2017 00:16:20 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r255771

6 years agoinvoke.texi (ARC Options): Add missing -mlra entry.
Sandra Loosemore [Sun, 17 Dec 2017 23:58:27 +0000 (18:58 -0500)]
invoke.texi (ARC Options): Add missing -mlra entry.

2017-12-17  Sandra Loosemore  <sandra@codesourcery.com>

gcc/
* doc/invoke.texi (ARC Options): Add missing -mlra entry.

From-SVN: r255768

6 years agoc-attribs.c (common_handle_aligned_attribute): Avoid issuing an error for attribute...
Martin Sebor [Sun, 17 Dec 2017 23:23:28 +0000 (23:23 +0000)]
c-attribs.c (common_handle_aligned_attribute): Avoid issuing an error for attribute warn_if_not_aligned.

gcc/c-family/ChangeLog:

* c-attribs.c (common_handle_aligned_attribute): Avoid issuing
an error for attribute warn_if_not_aligned.

From-SVN: r255767

6 years agoRevert hunk with debug code that was comitted by mistake
Andi Kleen [Sun, 17 Dec 2017 20:41:59 +0000 (20:41 +0000)]
Revert hunk with debug code that was comitted by mistake

From-SVN: r255766

6 years agoguality.h (guality_check): Cast %lli arguments inf fprintf statements to long long...
Uros Bizjak [Sun, 17 Dec 2017 20:22:36 +0000 (21:22 +0100)]
guality.h (guality_check): Cast %lli arguments inf fprintf statements to long long int.

* gcc.dg/guality/guality.h (guality_check): Cast %lli arguments
inf fprintf statements to long long int.

From-SVN: r255765

6 years agopa.c (pa_som_asm_init_sections): Fix comment.
John David Anglin [Sun, 17 Dec 2017 18:36:50 +0000 (18:36 +0000)]
pa.c (pa_som_asm_init_sections): Fix comment.

* config/pa/pa.c (pa_som_asm_init_sections): Fix comment.

From-SVN: r255764

6 years agoSupport -std=f2018
Janne Blomqvist [Sun, 17 Dec 2017 16:28:08 +0000 (18:28 +0200)]
Support -std=f2018

The Fortran committee has decided to rename the upcoming Fortran 2015
standard to Fortran 2018.  This is not a reflection of a three year
delay in the process, but rather they are following other standards in
adopting the year of publication for the name. For more details see
N2144.

This patch renames GFC_STD_F2015 to GFC_STD_F2018, and makes it a
separate flag rather than an alias for GFC_STD_GNU. Also, it adds a
-std=f2018 argument, and documents it.

Regtested on x86_64-pc-linux-gnu.

gcc/fortran/ChangeLog:

2017-12-17  Janne Blomqvist  <jb@gcc.gnu.org>

* decl.c (gfc_match_implicit_none): Use GFC_STD_F2018 instead of
GFC_STD_F2015.
* error.c (gfc_notify_std): Add GFC_STD_F2018{_DEL,_OBS} to
switch.
* gfortran.texi: Document -std=f2018.
* interface.c (compare_parameter): Fix comment.
* invoke.texi: Document -std=f2018.
* lang.opt: Add -std=f2018 argumnet.
* libgfortran.h (GFC_STD_F2015): Rename to GFC_STD_F0218, use
separate flag bit.
(GFC_STD_F2018_DEL): New macro.
(GFC_STD_F2018_OBS): Likewise.
* match.c (gfc_match_stopcode): Use GFC_STD_F2018.
* options.c (set_default_std_flags): Add F2018 flags to defaults.
(gfc_handle_option): Set options for -std=f2018.

gcc/testsuite/ChangeLog:

2017-12-17  Janne Blomqvist  <jb@gcc.gnu.org>

* gfortran.dg/error_stop_3.f90: Update -std= option, fix comments.
* gfortran.dg/error_stop_4.f90: Update error message.
* gfortran.dg/implicit_14.f90: Likewise.
* gfortran.dg/spellcheck-procedure_2.f90: Don't warn for F2018
features.

From-SVN: r255761

6 years agoCorrect imul (r64) latency for modern Intel CPUs
Markus Trippelsdorf [Sun, 17 Dec 2017 12:01:25 +0000 (12:01 +0000)]
Correct imul (r64) latency for modern Intel CPUs

Since Sandybridge the 64bit multiplication latency is three cycles, not
four. So update the costs to reflect reality.

* x86-tune-costs.h (skylake_cost, core_cost): Decrease r64 multiply
latencies.

* gcc.target/i386/wmul-3.c: New test.

From-SVN: r255760

6 years agoinvoke.texi: Fix some typos.
Sandra Loosemore [Sun, 17 Dec 2017 06:21:50 +0000 (01:21 -0500)]
invoke.texi: Fix some typos.

2017-12-16  Sandra Loosemore  <sandra@codesourcery.com>

gcc/
* doc/invoke.texi: Fix some typos.

From-SVN: r255759

6 years agoDaily bump.
GCC Administrator [Sun, 17 Dec 2017 00:16:12 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r255758

6 years agoPR tree-optimization/78918 - missing -Wrestrict on memcpy copying over self
Martin Sebor [Sat, 16 Dec 2017 23:58:34 +0000 (23:58 +0000)]
PR tree-optimization/78918 - missing -Wrestrict on memcpy copying over self

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

6 years agoPR tree-optimization/83239 - False positive from -Wstringop-overflow
Martin Sebor [Sat, 16 Dec 2017 22:37:22 +0000 (22:37 +0000)]
PR tree-optimization/83239 - False positive from -Wstringop-overflow

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

6 years agore PR libfortran/81937 (stack-buffer-overflow on memcpy in libgfortran/io/unix.c...
Jerry DeLisle [Sat, 16 Dec 2017 19:50:42 +0000 (19:50 +0000)]
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

6 years agore PR target/82767 (gcc.target/i386/pr71321.c scan-assembler-times fail)
Sebastian Peryt [Sat, 16 Dec 2017 16:21:23 +0000 (17:21 +0100)]
re PR target/82767 (gcc.target/i386/pr71321.c scan-assembler-times fail)

PR testsuite/82767
 * gcc.target/i386/pr71321.c: Test with -mtune=generic

From-SVN: r255749

6 years agore PR rtl-optimization/82849 (ICE on valid code since r254379)
Jan Hubicka [Sat, 16 Dec 2017 16:01:26 +0000 (17:01 +0100)]
re PR rtl-optimization/82849 (ICE on valid code since r254379)

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

6 years agopoly_int: mode query functions
Richard Sandiford [Sat, 16 Dec 2017 14:26:43 +0000 (14:26 +0000)]
poly_int: mode query functions

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

6 years agoRevert accidental commit
Richard Sandiford [Sat, 16 Dec 2017 14:23:38 +0000 (14:23 +0000)]
Revert accidental commit

From-SVN: r255746

6 years agoAdd a gen_int_shift_amount helper function
Richard Sandiford [Sat, 16 Dec 2017 14:14:18 +0000 (14:14 +0000)]
Add a gen_int_shift_amount helper function

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

6 years agopoly_int: MACRO_MODE
Richard Sandiford [Sat, 16 Dec 2017 14:13:03 +0000 (14:13 +0000)]
poly_int: MACRO_MODE

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

6 years agopoly_int: IN_TARGET_CODE
Richard Sandiford [Sat, 16 Dec 2017 14:10:55 +0000 (14:10 +0000)]
poly_int: IN_TARGET_CODE

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

6 years agoMinor vn_reference_lookup_3 tweak
Richard Sandiford [Sat, 16 Dec 2017 14:09:04 +0000 (14:09 +0000)]
Minor vn_reference_lookup_3 tweak

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

6 years agoAdd VEC_SERIES_EXPR and associated optab
Richard Sandiford [Sat, 16 Dec 2017 14:04:46 +0000 (14:04 +0000)]
Add VEC_SERIES_EXPR and associated optab

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

6 years agoAdd VEC_DUPLICATE_EXPR and associated optab
Richard Sandiford [Sat, 16 Dec 2017 14:03:30 +0000 (14:03 +0000)]
Add VEC_DUPLICATE_EXPR and associated optab

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

6 years agore PR target/83358 (division not converted with Intel tuning since r253934)
Markus Trippelsdorf [Sat, 16 Dec 2017 04:28:08 +0000 (04:28 +0000)]
re PR target/83358 (division not converted with Intel tuning since r253934)

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

6 years agoos: pass -s to hostname on AIX
Ian Lance Taylor [Sat, 16 Dec 2017 01:49:54 +0000 (01:49 +0000)]
os: pass -s to hostname on AIX

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

From-SVN: r255738