Commit Graph

29557 Commits

Author SHA1 Message Date
Michael Collison f15dbadbf6 zero_bits_compound-2.c: Fix test for aarch64.
2016-11-30  Michael Collison  <michael.collison@arm.com>

	* gcc.dg/zero_bits_compound-2.c: Fix test for aarch64.

From-SVN: r244348
2017-01-12 08:12:02 +00:00
Julia Koval 73e32c4743 i386-common.c (OPTION_MASK_ISA_SGX_UNSET): New.
* common/config/i386/i386-common.c (OPTION_MASK_ISA_SGX_UNSET): New.
	(OPTION_MASK_ISA_SGX_SET): New.
	(ix86_handle_option): Handle OPT_msgx.
	* config.gcc: Added sgxintrin.h.
	* config/i386/driver-i386.c (host_detect_local_cpu): Detect sgx.
	* config/i386/i386-c.c (ix86_target_macros_internal): Define __SGX__.
	* config/i386/i386.c (ix86_target_string): Add -msgx.
	(PTA_SGX): New.
	(ix86_option_override_internal): Handle new options.
	(ix86_valid_target_attribute_inner_p): Add sgx.
	* config/i386/i386.h (TARGET_SGX, TARGET_SGX_P): New.
	* config/i386/i386.opt: Add msgx.
	* config/i386/sgxintrin.h: New file.
	* config/i386/x86intrin.h: Add sgxintrin.h.

testsuite/ChangeLog:

	* gcc.target/i386/sgx.c New test.
	* gcc.target/i386/sse-12.c: Add -msgx.
	* gcc.target/i386/sse-13.c: Ditto.
	* gcc.target/i386/sse-14.c: Ditto.
	* gcc.target/i386/sse-22.c: Ditto.
	* gcc.target/i386/sse-23.c: Ditto.
	* g++.dg/other/i386-2.C: Ditto.
	* g++.dg/other/i386-3.C: Ditto.


Co-Authored-By: Uros Bizjak <ubizjak@gmail.com>

From-SVN: r244339
2017-01-11 22:41:13 +01:00
Martin Sebor 3594adc7b0 PR c++/24511 - [DR 470] explicit instantiation/extern template unsats
PR c++/24511 - [DR 470] explicit instantiation/extern template unsats
// on symbols defined later

gcc/testsuite/ChangeLog:
	* g++.dg/template/explicit9.C: New test.

From-SVN: r244337
2017-01-11 14:02:46 -07:00
Nathan Sidwell 01bfd25762 re PR c++/77812 (incorrectly rejects valid C++ code that uses enum in template instantiation)
cp/
	PR c++/77812
	* name-lookup.c (set_namespace_binding_1): An overload of 1 decl
	is a new overload.

	testsuite/
	PR c++/77812
	* g++.dg/pr77812.C: New.

From-SVN: r244335
2017-01-11 20:37:16 +00:00
Jakub Jelinek eae63d784c re PR c++/71537 (GCC rejects consetxpr boolean conversions and comparisons on the result of pointer arithmetic.)
PR c++/71537
	* fold-const.c (maybe_nonzero_address): Return 1 for function
	local objects.
	(tree_single_nonzero_warnv_p): Don't handle function local objects
	here.

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

From-SVN: r244333
2017-01-11 21:10:36 +01:00
Jakub Jelinek 88df7964b5 flatten-3.c: Add quotation marks around dg-options argument.
* gcc.dg/tree-ssa/flatten-3.c: Add quotation marks around dg-options
	argument.

From-SVN: r244332
2017-01-11 20:48:56 +01:00
Martin Sebor 960ecba4bf PR c/47931 - missing -Waddress warning for comparison with NULL
gcc/testsuite/ChangeLog:
	* c-c++-common/Waddress-2.c: New test.

From-SVN: r244331
2017-01-11 11:33:13 -07:00
Jakub Jelinek 1f258a55a9 re PR c++/78341 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in cp_parser_std_attribute_spec, at cp/parser.c:24597))
PR c++/78341
	* parser.c (cp_parser_std_attribute_spec): Remove over-eager
	assertion.  Formatting fix.

	* g++.dg/cpp0x/pr78341.C: New test.

From-SVN: r244329
2017-01-11 19:09:58 +01:00
Martin Sebor bf5fbf465d PR c/78768 - -Walloca-larger-than and -Wformat-length warnings disabled by -flto
gcc/ChangeLog:
	* c.opt (-Walloca-larger-than, -Wformat-length, -Wformat-truncation):
	Also enable for LTO.

gcc/testsuite/ChangeLog:
	PR c/78768
	* gcc.dg/pr78768.c: New test.

From-SVN: r244326
2017-01-11 10:28:52 -07:00
David Malcolm 19ff0049cd Offer suggestions for unrecognized sanitizer options (PR driver/78877)
gcc/ChangeLog:
	PR driver/78877
	* opts.c: Include "spellcheck.h"
	(struct string_fragment): New struct.
	(struct edit_distance_traits<const string_fragment &>): New
	struct.
	(get_closest_sanitizer_option): New function.
	(parse_sanitizer_options): Offer suggestions for unrecognized arguments.

gcc/testsuite/ChangeLog:
	PR driver/78877
	* gcc.dg/spellcheck-options-14.c: New test case.
	* gcc.dg/spellcheck-options-15.c: New test case.
	* gcc.dg/spellcheck-options-16.c: New test case.
	* gcc.dg/spellcheck-options-17.c: New test case.

From-SVN: r244325
2017-01-11 17:25:40 +00:00
Martin Liska c86e9f03ab Fix flatten-3.c test-case.
2017-01-11  Martin Liska  <mliska@suse.cz>

	* gcc.dg/tree-ssa/flatten-3.c: Add -fno-ipa-icf to dg-options.

From-SVN: r244313
2017-01-11 12:17:27 +00:00
Jakub Jelinek 947f51d61b decomp4.C (test): Use 2 identifier decomposition instead of just 1 for the decomposition from...
* g++.dg/cpp1z/decomp4.C (test): Use 2 identifier decomposition
	instead of just 1 for the decomposition from struct C.

From-SVN: r244312
2017-01-11 12:47:30 +01:00
Eric Botcazou 849fccf831 re PR rtl-optimization/79032 (unaligned memory access generated with LRA and optimization)
PR rtl-optimization/79032
	* lra-constraints.c (simplify_operand_subreg): In the MEM case, test
	the alignment of the adjusted memory reference against that of MODE,
	instead of the alignment of the original memory reference.

From-SVN: r244311
2017-01-11 11:27:43 +00:00
Richard Biener 80c74722bc tree-vrp.c (evrp_dom_walker::before_dom_children): Also set range/nonnull info for PHI results.
2017-01-11  Richard Biener  <rguenther@suse.de>

	* tree-vrp.c (evrp_dom_walker::before_dom_children): Also
	set range/nonnull info for PHI results.  Do not set it on
	stmts marked for removal.

	* gcc.dg/tree-ssa/pr61743-1.c: Adjust.

From-SVN: r244305
2017-01-11 09:06:29 +00:00
Jakub Jelinek 4c4b47031d re PR middle-end/50199 (wrong code with -flto -fno-merge-constants)
PR middle-end/50199
	* lto-lang.c (lto_post_options): Force flag_merge_constants = 1
	if it was 0.

	* gcc.dg/lto/pr50199_0.c: New test.

From-SVN: r244304
2017-01-11 09:40:59 +01:00
Martin Sebor 664b1a6b29 PR testsuite/78960 - FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test
PR testsuite/78960 - FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test
PR testsuite/78959 - FAIL: gcc.c-torture/execute/pr78622.c 
PR testsuite/78133 - Commit r241489 adds printf specifiers not supported by newlib

gcc/testsuite/ChangeLog:
	PR testsuite/78960
	PR testsuite/78959
	PR testsuite/78133
	* gcc.dg/tree-ssa/builtin-sprintf.c: Require C99 runtime.
	* gcc.dg/tree-ssa/pr78622.c: Ditto.

From-SVN: r244298
2017-01-10 15:45:52 -07:00
Martin Sebor fefd30867d PR middle-end/78138 - missing warnings on buffer overflow with non-constant source length
gcc/testsuite/ChangeLog:

	PR middle-end/78138
	* gcc.dg/pr78138.c: New test.

From-SVN: r244297
2017-01-10 15:35:22 -07:00
Martin Sebor 5a50f6bbed PR middle-end/78245 - missing -Wformat-length on an overflow of a dynamically allocated buffer
gcc/testsuite/ChangeLog:

	PR middle-end/78245
	* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Add tests.

gcc/ChangeLog:

	PR middle-end/78245
	* gimple-ssa-sprintf.c (get_destination_size): Call
	{init,fini}object_sizes.
	* tree-object-size.c (addr_object_size): Adjust.
	(pass_through_call): Adjust.
	(pass_object_sizes::execute): Adjust.
	* tree-object-size.h (fini_object_sizes): Declare.

From-SVN: r244294
2017-01-10 14:56:44 -07:00
David Malcolm b9f4757f8e Fix issues with unrepresentable column numbers (PR c++/77949)
PR c++/77949 identifies an ICE when the C++ frontend attempts to emit a
fix-it hint inserting a missing semicolon at column 4097 of a source file.

This column value exceeds LINE_MAP_MAX_COLUMN_NUMBER and hence isn't
representable using a location_t.

Attempting to do so leads to these problems, which this patch fixes:

(a) when encountering a column number > LINE_MAP_MAX_COLUMN_NUMBER we
create a new linemap with m_column_and_range_bits == 0, but
linemap_position_for_column doesn't check for this, and hence can emit
a bogus location_t value that's calculated relative to the previous
linemap start, but which will be decoded relative to the new linemap,
leading to very large incorrect line values.

(b) when encountering a column number that can't be represented, and
for which the linemap was pre-existing, the code would hit this assertion:
  if (linemap_assert_fails (column < (1u << map->m_column_and_range_bits)))
around a bail-out condition.  The patch replaces this assertion with a
simple conditional, to stop the ICE when this occurs, and fixes the
bit count (effective column bits, vs column+range bits)

(c) the C++ frontend wasn't checking for failure of
linemap_position_for_loc_and_offset when considering emitting the fix-it
hint.  The patch adds a conditional, so that no fix-it hint is emitted
if the location is bogus.

gcc/cp/ChangeLog:
	PR c++/77949
	* parser.c (cp_parser_class_specifier_1): Only suggest inserting
	a missing semicolon if we have a valid insertion location for
	the fix-it hint.

gcc/ChangeLog:
	PR c++/77949
	* input.c (selftest::test_accessing_ordinary_linemaps): Verify
	that we correctly handle column numbers greater than
	LINE_MAP_MAX_COLUMN_NUMBER.

gcc/testsuite/ChangeLog:
	PR c++/77949
	* g++.dg/diagnostic/pr77949.C: New test case.

libcpp/ChangeLog:
	PR c++/77949
	* line-map.c (linemap_position_for_column): When calling
	linemap_start_line, detect if a new linemap was created with
	0 column bits, and bail out early if this is the case.
	(linemap_position_for_loc_and_offset): Replace overzealous
	linemap_assert_fails with a simple conditional; use correct
	bit count.

From-SVN: r244292
2017-01-10 21:54:09 +00:00
Martin Sebor c16880eff0 PR tree-optimization/78775 - [7 Regression] ICE in maybe_warn_alloc_args_overflow
gcc/ChangeLog:

	PR tree-optimization/78775
	* builtins.c (get_size_range): Move...
	* calls.c: ...to here.
	(alloc_max_size): Accept zero argument.
	(operand_signed_p): Remove.
	(maybe_warn_alloc_args_overflow): Call get_size_range.
	* calls.h (get_size_range): Declare.

gcc/testsuite/ChangeLog:

	PR tree-optimization/78775
	* gcc.dg/attr-alloc_size-4.c: Add test cases.
	* gcc.dg/attr-alloc_size-10.c: New test.
	* gcc.dg/attr-alloc_size-11.c: New test.
	* gcc.dg/builtin-stringop-chk-7.c: New test.
	* gcc.dg/pr78775.c: New test.
	* gcc.dg/pr78973-2.c: New test.
	* gcc.dg/pr78973.c: New test.

From-SVN: r244290
2017-01-10 14:02:07 -07:00
Jeff Law 5363d9d949 re PR middle-end/77766 (wrong code at -O2 and -O3 in 64-bit mode on x86_64-linux-gnu (executable hangs))
PR tree-optimization/77766
	PR tree-optimization/78856
	* gcc.c-torture/execute/pr77766.c: New test.

From-SVN: r244287
2017-01-10 13:55:59 -07:00
Richard Biener aae23693f8 re PR tree-optimization/79034 (error: missing PHI def in verify_gimple_in_cfg)
2016-01-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/79034
	* tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds):
	Propagate out degenerate PHIs in the joiner.

	* g++.dg/torture/pr79034.C: New testcase.

From-SVN: r244274
2017-01-10 14:50:32 +00:00
Martin Liska a0843aedb8 IPA ICF: make algorithm stable to survive -fcompare-debug
2017-01-10  Martin Liska  <mliska@suse.cz>

	* gcc.dg/ipa/ipa-icf-1.c: Change scanned pattern.
	* gcc.dg/ipa/ipa-icf-10.c: Likewise.
	* gcc.dg/ipa/ipa-icf-11.c: Likewise.
	* gcc.dg/ipa/ipa-icf-12.c: Likewise.
	* gcc.dg/ipa/ipa-icf-13.c: Likewise.
	* gcc.dg/ipa/ipa-icf-16.c: Likewise.
	* gcc.dg/ipa/ipa-icf-18.c: Likewise.
	* gcc.dg/ipa/ipa-icf-2.c: Likewise.
	* gcc.dg/ipa/ipa-icf-20.c: Likewise.
	* gcc.dg/ipa/ipa-icf-21.c: Likewise.
	* gcc.dg/ipa/ipa-icf-23.c: Likewise.
	* gcc.dg/ipa/ipa-icf-25.c: Likewise.
	* gcc.dg/ipa/ipa-icf-26.c: Likewise.
	* gcc.dg/ipa/ipa-icf-27.c: Likewise.
	* gcc.dg/ipa/ipa-icf-3.c: Likewise.
	* gcc.dg/ipa/ipa-icf-35.c: Likewise.
	* gcc.dg/ipa/ipa-icf-36.c: Likewise.
	* gcc.dg/ipa/ipa-icf-37.c: Likewise.
	* gcc.dg/ipa/ipa-icf-5.c: Likewise.
	* gcc.dg/ipa/ipa-icf-7.c: Likewise.
	* gcc.dg/ipa/ipa-icf-8.c: Likewise.
	* gcc.dg/ipa/pr64307.c: Likewise.
	* gcc.dg/ipa/pr77653.c: Likewise.
2017-01-10  Martin Liska  <mliska@suse.cz>

	* ipa-icf.c (sort_sem_items_by_decl_uid): New function.
	(sort_congruence_classes_by_decl_uid): Likewise.
	(sort_congruence_class_groups_by_decl_uid): Likewise.
	(sem_item_optimizer::merge_classes): Sort class, groups in these
	classes and members in the groups by DECL_UID of declarations.
	This would make merge operations stable.

From-SVN: r244273
2017-01-10 14:39:33 +00:00
Andrew Senkevich 79fc8ffe6c Enable AVX-512 VPOPCNTD/VPOPCNTQ instructions.
gcc/
	* common/config/i386/i386-common.c (OPTION_MASK_ISA_AVX512VPOPCNTDQ_SET,
	OPTION_MASK_ISA_AVX512VPOPCNTDQ_UNSET): New.
	* config.gcc: Add avx512vpopcntdqintrin.h.
	* config/i386/avx512vpopcntdqintrin.h: New.
	* config/i386/cpuid.h (bit_AVX512VPOPCNTDQ): New.
	* config/i386/i386-builtin-types.def: Add new types.
	* config/i386/i386-builtin.def (__builtin_ia32_vpopcountd_v16si,
	__builtin_ia32_vpopcountd_v16si_mask, __builtin_ia32_vpopcountq_v8di,
	__builtin_ia32_vpopcountq_v8di_mask): New.
	* config/i386/i386-c.c (ix86_target_macros_internal): Define
	__AVX512VPOPCNTDQ__.
	* config/i386/i386.c (ix86_target_string): Add -mavx512vpopcntdq.
	(PTA_AVX512VPOPCNTDQ): Define.
	* config/i386/i386.h (TARGET_AVX512VPOPCNTDQ,
	TARGET_AVX512VPOPCNTDQ_P): Define.
	* config/i386/i386.opt: Add mavx512vpopcntdq.
	* config/i386/immintrin.h: Include avx512vpopcntdqintrin.h.
	* config/i386/sse.md (define_insn "vpopcount<mode><mask_name>"): New.

libgcc/
	* config/i386/cpuinfo.h (processor_features): Add
	FEATURE_AVX512VPOPCNTDQ.
	* config/i386/cpuinfo.c (get_available_features): Habdle new
	feature.

gcc/testsuite/
	* g++.dg/other/i386-2.C: Add -mavx512vpopcntdq.
	* g++.dg/other/i386-3.C: Ditto.
	* gcc.target/i386/sse-12.c: Ditto.
	* gcc.target/i386/sse-13.c: Ditto.
	* gcc.target/i386/sse-22.c: Ditto.
	* gcc.target/i386/sse-23.c: Ditto.
	* gcc.target/i386/builtin_target.c: Handle new option.
	* gcc.target/i386/funcspec-56.inc: Test new attributes.
	* gcc.target/i386/avx512vpopcntdq-vpopcntd.c: New test.
	* gcc.target/i386/avx512vpopcntdq-vpopcntq.c: Ditto.

From-SVN: r244263
2017-01-10 12:55:41 +00:00
Martin Sebor dfa6951fdc PR testsuite/79036 - gcc.dg/tree-ssa/builtin-sprintf.c fails starting with r244037
PR testsuite/79036 - gcc.dg/tree-ssa/builtin-sprintf.c fails starting with r244037
gcc/testsuite/ChangeLog:
	* gcc.dg/tree-ssa/builtin-sprintf.c: Handle extended formats
	with different precisions.

From-SVN: r244250
2017-01-09 16:31:38 -07:00
Eric Botcazou a271e41561 expr.c (store_field): In the bitfield case...
* expr.c (store_field): In the bitfield case, if the value comes from
	a function call and is of an aggregate type returned in registers, do
	not modify the field mode; extract the value in all cases if the mode
	is BLKmode and the size is not larger than a word.

From-SVN: r244249
2017-01-09 22:17:17 +00:00
Jakub Jelinek bd2c62704b re PR translation/79019 (translatable string typo in cif-code.def:141)
PR translation/79019
	PR translation/79020
	* params.def (PARAM_INLINE_MIN_SPEEDUP,
	PARAM_IPA_CP_SINGLE_CALL_PENALTY,
	PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD): Fix typos
	in descriptions.
	* config/avr/avr.opt (maccumulate-args): Likewise.
	* config/msp430/msp430.opt (mwarn-mcu): Likewise.
	* common.opt (freport-bug): Likewise.
	* cif-code.def (CIF_FINAL_ERROR): Likewise.
	* doc/invoke.texi (ipa-cp-single-call-penalty): Likewise.
	* config/s390/s390.c (s390_invalid_binary_op): Fix spelling in
	translatable string.
	* config/i386/i386.c (function_value_32): Likewise.
	* config/nios2/nios2.c (nios2_valid_target_attribute_rec): Likewise.
	* config/msp430/msp430.c (msp430_option_override, msp430_attr):
	Likewise.
	* config/msp430/driver-msp430.c (msp430_select_hwmult_lib): Likewise.
	* common/config/msp430/msp430-common.c (msp430_handle_option):
	Likewise.
	* symtab.c (symtab_node::verify_base): Likewise.
	* opts.c (set_debug_level): Likewise.
	* tree.c (verify_type_variant): Likewise.  Fix typo in comment.
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add
	missing whitespace to translatable strings.
	* config/avr/avr.md (bswapsi2): Fix typo in comment.
	* config/sh/superh.h: Likewise.
	* config/i386/xopintrin.h: Likewise.
	* config/i386/znver1.md: Likewise.
	* config/rs6000/rs6000.c (struct rs6000_opt_mask): Likewise.
	* ipa-inline-analysis.c (compute_inline_parameters): Likewise.
	* double-int.h (struct double_int): Likewise.
	* double-int.c (div_and_round_double): Likewise.
	* wide-int.cc: Likewise.
	* tree-ssa.c (non_rewritable_mem_ref_base): Likewise.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
	* cfgcleanup.c (crossjumps_occured): Renamed to ...
	(crossjumps_occurred): ... this.
	(try_crossjump_bb, try_head_merge_bb, try_optimize_cfg, cleanup_cfg):
	Adjust all uses.
cp/
	* semantics.c (finish_omp_clauses): Add missing whitespace to
	translatable strings.
	* cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
lto/
	* lto-symtab.c (lto_symtab_merge_symbols): Fix comment typo.
fortran/
	* decl.c (attr_decl1): Fix spelling in translatable string.
	* intrinsic.texi: Fix spelling - invokation -> invocation.
	* lang.opt (faggressive-function-elimination, gfc_convert): Fix
	typos in descriptions.
	* openmp.c (resolve_omp_clauses): Add missing whitespace to
	translatable strings.
c-family/
	* c.opt (Wnormalized=): Fix typo in description.
testsuite/
	* c-c++-common/goacc/host_data-2.c (f): Adjust expected spelling of
	diagnostics.
	* gfortran.dg/initialization_17.f90: Likewise.

From-SVN: r244245
2017-01-09 22:48:33 +01:00
Dominique d'Humieres 1c1d8e7506 re PR testsuite/79026 (The tests changed by revision r244006 now fail on darwin)
testsuite/ChangeLog:

	PR testsuite/79026
	* gcc.target/i386/pr78904-2.c: Require nonpic targets.
	* gcc.target/i386/pr78904-4.c: Likewise.
	* gcc.target/i386/pr78904-6.c: Likewise.
	* gcc.target/i386/pr78967-2.c: Likewise.

From-SVN: r244244
2017-01-09 22:41:02 +01:00
Jakub Jelinek cb330ba582 re PR tree-optimization/78899 (Vestorized loop with optmized mask stores motion is completely deleted after r242520.)
PR tree-optimization/78899
	* tree-if-conv.c (version_loop_for_if_conversion): Instead of
	returning bool return struct loop *, NULL for failure and the new
	loop on success.
	(versionable_outer_loop_p): Don't version outer loop if it has
	dont_vectorized bit set.
	(tree_if_conversion): When versioning outer loop, ensure
	tree_if_conversion is performed also on the inner loop of the
	non-vectorizable outer loop copy.
	* tree-vectorizer.c (set_uid_loop_bbs): Formatting fix.  Fold
	LOOP_VECTORIZED in inner loop of the scalar outer loop and
	prevent vectorization of it.
	(vectorize_loops): For outer + inner LOOP_VECTORIZED, ensure
	the outer loop vectorization of the non-scalar version is attempted
	before vectorization of the inner loop in scalar version.  If
	outer LOOP_VECTORIZED guarded loop is not vectorized, prevent
	vectorization of its inner loop.
	* tree-vect-loop-manip.c (rename_variables_in_bb): If outer_loop
	has 2 inner loops, rename also on edges from bb whose single pred
	is outer_loop->header.  Fix typo in function comment.

	* gcc.target/i386/pr78899.c: New test.
	* gcc.dg/pr71077.c: New test.

From-SVN: r244238
2017-01-09 21:10:23 +01:00
Martin Jambor a5e14a42da [PR 78365] Prudent type handling in IPA VR-prop
2017-01-09  Martin Jambor  <mjambor@suse.cz>

	PR ipa/78365
	PR ipa/78599
	* ipa-prop.h (ipa_jump_func): Swap positions of vr_known and m_vr.
	* ipa-cp.c (ipa_vr_operation_and_type_effects): New function.
	(propagate_vr_accross_jump_function): Use the above function for all
	value range computations for pass-through jump functions and type
	converasion from explicit value range values.
        (ipcp_propagate_stage): Do not attempt to deduce types of formal
        parameters from TYPE_ARG_TYPES.
	* ipa-prop.c (ipa_write_jump_function): Remove trailing whitespace.
	(ipa_write_node_info): Stream type of the actual argument.
	(ipa_read_node_info): Likewise. Also remove trailing whitespace.

testsuite/
	* gcc.dg/torture/pr78365.c: New test.

From-SVN: r244232
2017-01-09 19:26:37 +01:00
Jakub Jelinek dc59e50a5e re PR c++/78948 ([C++17] constexpr if instantiating too eagerly)
PR c++/78948
	* g++.dg/cpp1z/constexpr-if10.C: Fix PR number in comment.
	(main): Use int* instead of long long.

From-SVN: r244228
2017-01-09 17:24:19 +01:00
Jakub Jelinek 01216d27de re PR tree-optimization/78938 (ICE in expand_vec_cond_expr, at optabs.c:5636 w/ -mavx512bw -ftree-loop-vectorize -O1)
PR tree-optimization/78938
	* tree-vect-stmts.c (vectorizable_condition): For non-masked COND_EXPR
	where comp_vectype is VECTOR_BOOLEAN_TYPE_P, use
	BIT_{NOT,XOR,AND,IOR}_EXPR on the comparison operands instead of
	{EQ,NE,GE,GT,LE,LT}_EXPR directly inside of VEC_COND_EXPR.  Formatting
	fixes.

	* gcc.dg/vect/pr78938.c: New test.

From-SVN: r244223
2017-01-09 12:44:52 +01:00
Kyrylo Tkachov c0d4fec75c [tree-ssa-address] Avoid creating non-canonical RTL in gen_addr_rtx
* tree-ssa-address.c (gen_addr_rtx): Don't handle index if it
	is const0_rtx.

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

From-SVN: r244219
2017-01-09 09:42:10 +00:00
Richard Biener 7b1b0cc127 re PR tree-optimization/78997 (ICE on valid code at -O3 on x86_64-linux-gnu: verify_gimple failed)
2017-01-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78997
	* tree-vect-slp.c (vect_mask_constant_operand_p): Handle SSA
	name condition properly.

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

From-SVN: r244218
2017-01-09 08:25:13 +00:00
Richard Biener 813b9c0d3a re PR debug/79000 (ICE: in gen_member_die, at dwarf2out.c:23995)
2017-01-09  Richard Biener  <rguenther@suse.de>

	PR debug/79000
	* dwarf2out.c (is_cxx): New overload with context.
	(is_naming_typedef_decl): Use it.

	* g++.dg/lto/pr79000_0.C: New testcase.
	* g++.dg/lto/pr79000_1.c: Likewise.

From-SVN: r244217
2017-01-09 08:22:58 +00:00
Martin Sebor efcc8d387f PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf

gcc/ChangeLog:

	PR middle-end/77708
	* doc/invoke.texi (Warning Options): Document -Wformat-truncation.
	* gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt):
	New member functions.
	(format_directive): Used them.
	(add_bytes): Same.
	(pass_sprintf_length::handle_gimple_call): Same.
	* graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size
	to avoid truncation for any argument.
	(extract_affine_mul): Same.
	* tree.c (get_file_function_name): Same.

gcc/c-family/ChangeLog:

	PR middle-end/77708
	* c.opt (-Wformat-truncation): New option.

gcc/fortran/ChangeLog:

	PR tree-optimization/78913
	PR middle-end/77708
	* trans-common.c (build_equiv_decl): Increase buffer size to avoid
	truncation for any argument.
	* trans-types.c (gfc_build_logical_type): Same.

gcc/testsuite/ChangeLog:

	PR middle-end/77708
	* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test.
	* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing
	due to bug 78969.
	* gcc.dg/format/pr78569.c: Adjust.

From-SVN: r244210
2017-01-08 16:42:09 -07:00
David Malcolm 5ccf1d8d10 Fix linemap corruption after very wide source lines (PR c++/72803)
PR c++/72803 describes an issue where a fix-it hint is to be emitted at
column 512 of a 511-column source line, leading to an ICE.

The root cause is a bug in linemap_line_start, when transitioning from
lines >= 512 in width to narrow lines.

The wide line in the reproducer has a line map with:
  m_column_and_range_bits = 15, m_range_bits = 5
giving 10 effective bits for representing columns, so that columns <= 1023
can be represented.

When parsing the following line,
  linemap_line_start (..., ..., max_column_hint=0);
is called.  This leads to the "add_map" logic, due to this condition:
      || (max_column_hint <= 80 && effective_column_bits >= 10)
i.e. the new line is sufficiently narrower than the old one to
potentially use a new linemap (so as to conserve values within the
location_t space).

It then attempts to avoid allocating a new line map.  Part of the logic
to determine if we really need a new line map is this condition:
   SOURCE_COLUMN (map, highest) >= (1U << column_bits)
The above condition is incorrect: we need to determine if the highest
column we've handed out will fit within the proposed *effective* column
bits, but "column_bits" here is the column plus the range bits, rather
than just the column bits.

Hence in this case linemap_line_start erroneously decides that we don't
need a new line map, and updates the column bits within the existing
line map, so any location_t values we've already handed out within it
that are offset from the start by
  >= (1<<new_column_and_range_bits)
effectively change meaning, leading to incorrect line&column information
when decoding them, and various "interesting" ways for the linemap
code to fail.

The fix is to use the effective column bits in the above conditional.

gcc/ChangeLog:
	PR c++/72803
	* input.c (selftest::test_accessing_ordinary_linemaps): Verify
	that the transition from a max line width >= 1<<10 to narrower
	lines works correctly.

gcc/testsuite/ChangeLog:
	PR c++/72803
	* g++.dg/diagnostic/pr72803.C: New test case.

libcpp/ChangeLog:
	PR c++/72803
	* line-map.c (linemap_line_start): When determining if the highest
	column given out so far will fit into a proposed change to the
	current map, use the effective number of column bits, rather than
	the total number of column + range bits.

From-SVN: r244199
2017-01-07 21:33:59 +00:00
Martin Sebor 42002dfec3 attr-alloc_size-3.c: Remove regex made redundant by r243461.
gcc/testsuite/ChangeLog:

	* gcc.dg/attr-alloc_size-3.c: Remove regex made redundant by r243461.
	* gcc.dg/attr-alloc_size-4.c: Same.

From-SVN: r244197
2017-01-07 12:45:33 -07:00
Andre Vehreschild de91486c74 re PR fortran/78781 ([Coarray] ICE in gfc_deallocate_scalar_with_status, at fortran/trans.c:1588)
gcc/fortran/ChangeLog:

2017-01-07  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78781
	PR fortran/78935
	* expr.c (gfc_check_pointer_assign): Return the same error message for
	rewritten coarray pointer assignments like for plain ones.
	* gfortran.h: Change prototype.
	* primary.c (caf_variable_attr): Set attributes used ones only only
	ones.  Add setting of pointer_comp attribute.
	(gfc_caf_attr): Add setting of pointer_comp attribute.
	* trans-array.c (gfc_array_allocate): Add flag that the component to
	allocate is not an ultimate coarray component.  Add allocation of
	pointer arrays.
	(structure_alloc_comps): Extend nullify to treat pointer components in
	coarrays correctly.  Restructure nullify to remove redundant code.
	(gfc_nullify_alloc_comp): Allow setting caf_mode flags.
	* trans-array.h: Change prototype of gfc_nullify_alloc_comp ().
	* trans-decl.c (generate_coarray_sym_init): Call nullify_alloc_comp for
	derived type coarrays with pointer components.
	* trans-expr.c (gfc_trans_structure_assign): Also treat pointer
	components.
	(trans_caf_token_assign): Handle assignment of token of scalar pointer
	components.
	(gfc_trans_pointer_assignment): Call above routine.
	* trans-intrinsic.c (conv_expr_ref_to_caf_ref): Add treating pointer
	components.
	(gfc_conv_intrinsic_caf_get): Likewise.
	(conv_caf_send): Likewise.
	* trans-stmt.c (gfc_trans_allocate): After allocating a derived type in
	a coarray pre-register the tokens.
	(gfc_trans_deallocate): Simply determining the coarray type (scalar or
	array) and deregistering it correctly.
	* trans-types.c (gfc_typenode_for_spec): Replace in_coarray flag by the
	actual codim to allow lookup of array types in the cache.
	(gfc_build_array_type): Likewise.
	(gfc_get_array_descriptor_base): Likewise.
	(gfc_get_array_type_bounds): Likewise.
	(gfc_get_derived_type): Likewise.
	* trans-types.h: Likewise.
	* trans.c (gfc_deallocate_with_status): Enable deregistering of all kind
	of coarray components.
	(gfc_deallocate_scalar_with_status): Use free() in fcoarray_single mode
	instead of caf_deregister.

libgfortran/ChangeLog:

2017-01-07  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78781
	PR fortran/78935
	* caf/single.c (send_by_ref): Fix addressing of non-allocatable scalar
	destination components.

gcc/testsuite/ChangeLog:

2017-01-07  Andre Vehreschild  <vehre@gcc.gnu.org>

	* gfortran.dg/coarray/ptr_comp_1.f08: New test.
	* gfortran.dg/coarray/ptr_comp_2.f08: New test.
	* gfortran.dg/coarray/ptr_comp_3.f08: New test.
	* gfortran.dg/coarray/ptr_comp_4.f08: New test.
	* gfortran.dg/coarray_ptr_comp_1.f08: New test.
	* gfortran.dg/coarray_ptr_comp_2.f08: New test.
	* gfortran.dg/coarray_ptr_comp_3.f08: New test.

From-SVN: r244196
2017-01-07 18:26:58 +01:00
Aaron Sawdey f55a925e02 memcmp-1.c: New.
2017-01-06  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
	* gcc.dg/memcmp-1.c: New.
	* gcc.dg/strncmp-1.c: New.
New testcases to check that builtin expansion of memcmp and strncmp works properly.

From-SVN: r244177
2017-01-06 12:06:35 -06:00
Andre Vieira f3caa11824 [ARM] Implement support for ACLE Coprocessor MCRR and MRRC intrinsics
gcc/ChangeLog:
2017-01-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* config/arm/arm.md (<mcrr>): New.
	(<mrrc>): New.
	* config/arm/arm.c (arm_arch5te): New.
	(arm_option_override): Set arm_arch5te.
	(arm_coproc_builtin_available): Add support for mcrr, mcrr2, mrrc
	and mrrc2.
	* config/arm/arm-builtins.c (MCRR_QUALIFIERS): Define to...
	(arm_mcrr_qualifiers): ... this. New.
	(MRRC_QUALIFIERS): Define to...
	(arm_mrrc_qualifiers): ... this. New.
	* config/arm/arm_acle.h (__arm_mcrr, __arm_mcrr2, __arm_mrrc,
	__arm_mrrc2): New.
	* config/arm/arm_acle_builtins.def (mcrr, mcrr2, mrrc, mrrc2): New.
	* config/arm/iterators.md (MCRRI, mcrr, MCRR): New.
	(MRRCI, mrrc, MRRC): New.
	* config/arm/unspecs.md (VUNSPEC_MCRR, VUNSPEC_MCRR2, VUNSPEC_MRRC,
	VUNSPEC_MRRC2): New.

gcc/testsuite/ChangeLog:
2017-01-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* gcc.target/arm/acle/mcrr: New.
	* gcc.target/arm/acle/mcrr2: New.
	* gcc.target/arm/acle/mrrc: New.
	* gcc.target/arm/acle/mrrc2: New.

From-SVN: r244175
2017-01-06 17:49:12 +00:00
Andre Vieira ecc9a25b97 [ARM] Implement support for ACLE Coprocessor MCR and MRC intrinsics
gcc/ChangeLog:
2017-01-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* config/arm/arm.md (<mcr>): New.
	(<mrc>): New.
	* config/arm/arm.c (arm_coproc_builtin_available): Add
	support for mcr, mrc, mcr2 and mrc2.
	* config/arm/arm-builtins.c (MCR_QUALIFIERS): Define to...
	(arm_mcr_qualifiers): ... this. New.
	(MRC_QUALIFIERS): Define to ...
	(arm_mrc_qualifiers): ... this. New.
	(MCR_QUALIFIERS): Define to ...
	(arm_mcr_qualifiers): ... this. New.
	* config/arm/arm_acle.h (__arm_mcr, __arm_mrc, __arm_mcr2,
	__arm_mrc2): New.
	* config/arm/arm_acle_builtins.def (mcr, mcr2, mrc, mrc2): New.
	* config/arm/iterators.md (MCRI, mcr, MCR, MRCI, mrc, MRC): New.
	* config/arm/unspecs.md (VUNSPEC_MCR, VUNSPEC_MCR2, VUNSPEC_MRC,
	VUNSPEC_MRC2): New.

gcc/testsuite/ChangeLog:
2017-01-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* gcc.target/arm/acle/mcr.c: New.
	* gcc.target/arm/acle/mrc.c: New.
	* gcc.target/arm/acle/mcr2.c: New.
	* gcc.target/arm/acle/mrc2.c: New.

From-SVN: r244174
2017-01-06 17:40:50 +00:00
Andre Vieira 3811581f8b [ARM] Implement support for ACLE Coprocessor LDC and STC intrinsics
gcc/ChangeLog:
2017-01-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* config/arm/arm.md (*ldc): New.
	(*stc): New.
	(<ldc>): New.
	(<stc>): New.
	* config/arm/arm.c (arm_coproc_builtin_available): Add
	support for ldc,ldcl,stc,stcl,ldc2,ldc2l,stc2 and stc2l.
	(arm_coproc_ldc_stc_legitimate_address): New.
	* config/arm/arm-builtins.c (arm_type_qualifiers): Add
	'qualifier_const_pointer'.
	(LDC_QUALIFIERS): Define to...
	(arm_ldc_qualifiers): ... this. New.
	(STC_QUALIFIERS): Define to...
	(arm_stc_qualifiers): ... this. New.
	* config/arm/arm-protos.h
	(arm_coproc_ldc_stc_legitimate_address): New.
	* config/arm/arm_acle.h (__arm_ldc, __arm_ldcl, __arm_stc,
	__arm_stcl, __arm_ldc2, __arm_ldc2l, __arm_stc2, __arm_stc2l): New.
	* config/arm/arm_acle_builtins.def (ldc, ldc2, ldcl, ldc2l, stc,
	stc2, stcl, stc2l): New.
	* config/arm/constraints.md (Uz): New.
	* config/arm/iterators.md (LDCI, STCI, ldc, stc, LDC STC): New.
	* config/arm/unspecs.md (VUNSPEC_LDC, VUNSPEC_LDC2, VUNSPEC_LDCL,
	VUNSPEC_LDC2L, VUNSPEC_STC, VUNSPEC_STC2, VUNSPEC_STCL,
	VUNSPEC_STC2L): New.

gcc/testsuite/ChangeLog:
2017-01-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* gcc.target/arm/acle/ldc: New.
	* gcc.target/arm/acle/ldc2: New.
	* gcc.target/arm/acle/ldcl: New.
	* gcc.target/arm/acle/ldc2l: New.
	* gcc.target/arm/acle/stc: New.
	* gcc.target/arm/acle/stc2: New.
	* gcc.target/arm/acle/stcl: New.
	* gcc.target/arm/acle/stc2l: New.

From-SVN: r244173
2017-01-06 17:37:39 +00:00
Andre Vieira d57daa0c9d [ARM] Implement support for ACLE Coprocessor CDP intrinsics
gcc/ChangeLog:
2017-01-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* config/arm/arm.md (<cdp>): New.
	* config/arm/arm.c (neon_const_bounds): Rename this ...
	(arm_const_bounds): ... this.
	(arm_coproc_builtin_available): New.
	* config/arm/arm-builtins.c (SIMD_MAX_BUILTIN_ARGS): Increase.
	(arm_type_qualifiers): Add 'qualifier_unsigned_immediate'.
	(CDP_QUALIFIERS): Define to...
	(arm_cdp_qualifiers): ... this. New.
	(void_UP): Define.
	(arm_expand_builtin_args): Add case for 6 arguments.
	* config/arm/arm-protos.h (neon_const_bounds): Rename this ...
	(arm_const_bounds): ... this.
	(arm_coproc_builtin_available): New.
	* config/arm/arm_acle.h (__arm_cdp): New.
	(__arm_cdp2): New.
	* config/arm/arm_acle_builtins.def (cdp): New.
	(cdp2): New.
	* config/arm/iterators.md (CDPI,CDP,cdp): New.
	* config/arm/neon.md: Rename all 'neon_const_bounds' to
	'arm_const_bounds'.
	* config/arm/types.md (coproc): New.
	* config/arm/unspecs.md (VUNSPEC_CDP, VUNSPEC_CDP2): New.
	* gcc/doc/extend.texi (ACLE): Add a mention of Coprocessor intrinsics.
	* gcc/doc/sourcebuild.texi (arm_coproc1_ok, arm_coproc2_ok,
	arm_coproc3_ok, arm_coproc4_ok): Document new effective targets.

gcc/testsuite/ChangeLog:
2017-01-06  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* gcc.target/arm/acle/acle.exp: Run tests for different options
	and make sure fat-lto-objects is used such that we can still do
	assemble scans.
	* gcc.target/arm/acle/cdp.c: New.
	* gcc.target/arm/acle/cdp2.c: New.
	* lib/target-supports.exp (check_effective_target_arm_coproc1_ok): New.
	(check_effective_target_arm_coproc1_ok_nocache): New.
	(check_effective_target_arm_coproc2_ok): New.
	(check_effective_target_arm_coproc2_ok_nocache): New.
	(check_effective_target_arm_coproc3_ok): New.
	(check_effective_target_arm_coproc3_ok_nocache): New.
	(check_effective_target_arm_coproc4_ok): New.
	(check_effective_target_arm_coproc4_ok_nocache): New.

From-SVN: r244172
2017-01-06 17:35:23 +00:00
Martin Sebor 8a123229ae PR middle-end/78605 - bogus -Wformat-length=1 with %f
gcc/testsuite/ChangeLog:
	* gcc.dg/tree-ssa/pr78605.c: New test.

From-SVN: r244164
2017-01-06 08:45:42 -07:00
Martin Sebor 5b8999d67e PR tree-optimization/78910 - Wrong print-return-value for a negative number
gcc/ChangeLog:

	PR tree-optimization/78910
	* gimple-ssa-sprintf.c (tree_digits): Add an argument.
	(format_integer): Correct off-by-one error in the handling
	of precision with negative numbers in signed conversions..

gcc/testsuite/ChangeLog:

	PR tree-optimization/78910
	* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: Adjust text of expected
	diagnostics.
	* gcc.dg/tree-ssa/builtin-sprintf.c: Add test cases.
	* gcc.dg/tree-ssa/pr78910.c: New test.

From-SVN: r244116
2017-01-05 15:32:09 -07:00
Eric Botcazou 4e89adf970 invoke.texi (C Dialect Options): Document it.
* doc/invoke.texi (C Dialect Options): Document it.
c-family/
        * c.opt (fsso-struct): Add 'native' value.

From-SVN: r244115
2017-01-05 21:20:16 +00:00
Jakub Jelinek cfd719e776 re PR tree-optimization/71016 (Redundant sign extension with conditional __builtin_clzl)
PR tree-optimization/71016
	* tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Pass cond_stmt to
	factor_out_conditional_conversion.  Formatting fix.
	(factor_out_conditional_conversion): Add cond_stmt argument.
	If arg1 is INTEGER_CST, punt if new_arg0 is not any operand of
	cond_stmt and if arg0_def_stmt is not the only stmt in its bb.
	Formatting fix.

	* gcc.target/i386/pr71016.c: New test.
	* gcc.target/aarch64/pr71016.c: New test.
	* gcc.dg/tree-ssa/pr66726-3.c: New test.

From-SVN: r244114
2017-01-05 22:14:19 +01:00
Jakub Jelinek 26f203712b re PR c++/78931 (ICE on C++17 structured bindings from struct with reference member)
PR c++/78931
	* decl.c (cp_finish_decomp): Remove probe variable, if tt is
	REFERENCE_REF_P, set tt to its operand.

	* g++.dg/cpp1z/decomp19.C: New test.

From-SVN: r244113
2017-01-05 22:13:09 +01:00
Jakub Jelinek 962c5679b3 re PR c++/78890 (ICE on invalid reference type in union)
PR c++/78890
	* class.c (check_field_decls): Diagnose REFERENCE_TYPE fields in
	unions even for C++11 and later.

	* g++.dg/init/ref14.C: Expect error even in C++11 and later.
	* g++.dg/init/union1.C: Likewise.
	* g++.dg/cpp0x/union6.C: Expect errors.
	* g++.dg/cpp0x/union8.C: New test.
	* g++.dg/cpp0x/pr78890-1.C: New test.
	* g++.dg/cpp0x/pr78890-2.C: New test.

From-SVN: r244112
2017-01-05 22:12:02 +01:00
David Edelsohn 8c15f541f3 pr71670.c: Require p9vector.
* gcc.target/powerpc/pr71670.c: Require p9vector.
        * gcc.target/powerpc/p9-novsx.c: Same.

From-SVN: r244111
2017-01-05 15:10:55 -05:00
David Malcolm 51b861137e Introduce RTL function reader
This is the combination of these patches:
- [8a/9] Introduce class function_reader (v8)
- Add ASSERT_RTX_PTR_EQ
- [8b/9] Add target-independent selftests of RTL function reader (v2)
- [8c/9] Add aarch64-specific selftests for RTL function reader (v2)
- [8d/9] Add x86_64-specific selftests for RTL function reader (v2)

gcc/ChangeLog:
	* Makefile.in (OBJS): Add read-md.o, read-rtl.o,
	read-rtl-function.o, and selftest-rtl.o.
	* config/aarch64/aarch64.c: Include selftest.h and
	selftest-rtl.h.
	(selftest::aarch64_test_loading_full_dump): New function.
	(selftest::aarch64_run_selftests): New function.
	(TARGET_RUN_TARGET_SELFTESTS): Wire it up to
	selftest::aarch64_run_selftests.
	* config/i386/i386.c
	(selftest::ix86_test_loading_dump_fragment_1): New function.
	(selftest::ix86_test_loading_call_insn): New function.
	(selftest::ix86_test_loading_full_dump): New function.
	(selftest::ix86_test_loading_unspec): New function.
	(selftest::ix86_run_selftests): Call the new functions.
	* emit-rtl.c (maybe_set_max_label_num): New function.
	* emit-rtl.h (maybe_set_max_label_num): New decl.
	* function.c (instantiate_decls): Guard call to
	instantiate_decls_1 with if (DECL_INITIAL (fndecl)).
	* function-tests.c (selftest::verify_three_block_rtl_cfg): Remove
	"static".
	* gensupport.c (gen_reader::gen_reader): Pass "false"
	for new "compact" param of rtx_reader.
	* print-rtl.c (rtx_writer::print_rtx_operand): Print "(nil)"
	rather than an empty string for NULL strings.
	* read-md.c: Potentially include config.h rather than bconfig.h.
	Wrap include of errors.h with #ifdef GENERATOR_FILE.
	(have_error): New global, copied from errors.c.
	(md_reader::read_name): Rename to...
	(md_reader::read_name_1): ...this, adding "out_loc" param,
	and converting "missing name or number" to returning false, rather
	than failing.
	(md_reader::read_name): Reimplement in terms of read_name_1.
	(md_reader::read_name_or_nil): New function.
	(md_reader::read_string): Handle "(nil)" by returning NULL.
	(md_reader::md_reader): Add new param "compact".
	(md_reader::read_md_files): Wrap with #ifdef GENERATOR_FILE.
	(md_reader::read_file): New method.
	* read-md.h (md_reader::md_reader): Add new param "compact".
	(md_reader::read_file): New method.
	(md_reader::is_compact): New accessor.
	(md_reader::read_name): Convert return type from void to
	file_location.
	(md_reader::read_name_or_nil): New decl.
	(md_reader::read_name_1): New decl.
	(md_reader::m_compact): New field.
	(noop_reader::noop_reader): Pass "false" for new "compact" param
	of rtx_reader.
	(rtx_reader::rtx_reader): Add new "compact" param.
	(rtx_reader::read_rtx_operand): Make virtual and convert return
	type from void to rtx.
	(rtx_reader::read_until): New decl.
	(rtx_reader::handle_any_trailing_information): New virtual
	function.
	(rtx_reader::postprocess): New virtual function.
	(rtx_reader::finalize_string): New virtual function.
	(rtx_reader::m_in_call_function_usage): New field.
	(rtx_reader::m_reuse_rtx_by_id): New field.
	* read-rtl-function.c: New file.
	* selftest-rtl.c (selftest::assert_rtx_ptr_eq_at): New function.
	* selftest-rtl.h (ASSERT_RTX_PTR_EQ): New macro.
	(selftest::verify_three_block_rtl_cfg): New decl.
	* read-rtl-function.h: New file.
	* read-rtl.c: Potentially include config.h rather than bconfig.h.
	For host, include function.h, memmodel.h, and emit-rtl.h.
	(one_time_initialization): New function.
	(struct compact_insn_name): New struct.
	(compact_insn_names): New array.
	(find_code): Handle insn codes in compact dumps.
	(apply_subst_iterator): Wrap with #ifdef GENERATOR_FILE.
	(bind_subst_iter_and_attr): Likewise.
	(add_condition_to_string): Likewise.
	(add_condition_to_rtx): Likewise.
	(apply_attribute_uses): Likewise.
	(add_current_iterators): Likewise.
	(apply_iterators): Likewise.
	(initialize_iterators): Guard usage of apply_subst_iterator with
	#ifdef GENERATOR_FILE.
	(read_conditions): Wrap with #ifdef GENERATOR_FILE.
	(md_reader::read_mapping): Likewise.
	(add_define_attr_for_define_subst): Likewise.
	(add_define_subst_attr): Likewise.
	(read_subst_mapping): Likewise.
	(check_code_iterator): Likewise.
	(rtx_reader::read_rtx): Likewise.  Move one-time initialization
	logic to...
	(one_time_initialization): New function.
	(rtx_reader::read_until): New method.
	(read_flags): New function.
	(parse_reg_note_name): New function.
	(rtx_reader::read_rtx_code): Initialize "iterator" to NULL.
	Handle reuse_rtx ids.
	Wrap iterator lookup within #ifdef GENERATOR_FILE.
	Add parsing support for RTL dumps, mirroring the special-cases in
	print_rtx, by calling read_flags, reading REG_NOTE names, INSN_UID
	values, and calling handle_any_trailing_information.
	(rtx_reader::read_rtx_operand): Convert return type from void
	to rtx, returning return_rtx.  Handle case 'e'.  Call
	finalize_string on XSTR and XTMPL fields.
	(rtx_reader::read_nested_rtx):  Handle dumps in which trailing
	 "(nil)" values were omitted.  Call the postprocess vfunc on the
	return_rtx.
	(rtx_reader::rtx_reader): Add new "compact" param and pass to base
	class ctor.  Initialize m_in_call_function_usage.  Call
	one_time_initialization.
	* rtl-tests.c (selftest::test_uncond_jump): Call
	set_new_first_and_last_insn.
	* rtl.h (read_rtx): Wrap decl with #ifdef GENERATOR_FILE.
	* selftest-rtl.c: New file.
	* selftest-rtl.h (class selftest::rtl_dump_test): New class.
	(selftest::get_insn_by_uid): New decl.
	* selftest-run-tests.c (selftest::run_tests): Call
	read_rtl_function_c_tests.
	* selftest.h  (selftest::read_rtl_function_c_tests): New decl.
	* tree-dfa.c (ssa_default_def): Return NULL_TREE for rtl function
	dumps.

gcc/testsuite/ChangeLog:
	* selftests/asr_div1.rtl: New file.
	* selftests/aarch64: New subdirectory.
	* selftests/aarch64/times-two.rtl: New file.
	* selftests/bb-index.rtl: New file.
	* selftests/cfg-test.rtl: New file.
	* selftests/const-int.rtl: New file.
	* selftests/example-labels.rtl: New file.
	* selftests/insn-with-mode.rtl: New file.
	* selftests/jump-to-label-ref.rtl: New file.
	* selftests/jump-to-return.rtl: New file.
	* selftests/jump-to-simple-return.rtl: New file.
	* selftests/mem.rtl: New file.
	* selftests/note-insn-deleted.rtl: New file.
	* selftests/note_insn_basic_block.rtl: New file.
	* selftests/simple-cse.rtl: New file.
	* selftests/symbol-ref.rtl: New file.
	* selftests/x86_64: New subdirectory.
	* selftests/x86_64/call-insn.rtl: New file.
	* selftests/x86_64/copy-hard-reg-into-frame.rtl: New file.
	* selftests/x86_64/times-two.rtl: New file.
	* selftests/x86_64/unspec.rtl: New file.

From-SVN: r244110
2017-01-05 19:32:09 +00:00
Nathan Sidwell dc7650cc6d re PR c++/78765 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in cp_build_addr_expr_1, at cp/typeck.c:5708))
cp/
	PR c++/78765
	* pt.c (convert_nontype_argument): Don't try and see if integral
	or enum expressions are constants prematurely.

	testsuite/
	PR c++/78765
	* g++.dg/cpp0x/pr78765.C: New.

From-SVN: r244101
2017-01-05 12:30:26 +00:00
Dominik Vogt 3db705650b S/390: Additional memset/memcpy runtime tests.
These were provided by Dominik to check more of the corner case in our
memset/memcpy inline code.

gcc/testsuite/ChangeLog:

2017-01-05  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* gcc.target/s390/memcpy-2.c: New test.
	* gcc.target/s390/memset-2.c: New test.

From-SVN: r244099
2017-01-05 10:05:47 +00:00
Andreas Krebbel f5a537e390 S/390: Unroll mvc loop for memcpy with small constant lengths.
See the memset unrolling patch.  The very same applies to memcpys with
constant lengths.

2017-01-05  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* config/s390/s390.c (s390_expand_movmem): Unroll MVC loop for
	small constant length operands.

gcc/testsuite/ChangeLog:

2017-01-05  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* gcc.target/s390/memcpy-1.c: New test.

From-SVN: r244098
2017-01-05 10:03:01 +00:00
Jeff Law d80c6d02fd re PR rtl-optimization/78812 (Wrong code generation due to hoisting memory load across function call)
PR tree-optimizatin/78812
	* rtl.h (contains_mem_rtx_p): Prototype.
	* ifcvt.c (containts_mem_rtx_p): Move from here to...
	* rtlanal.c (contains_mem_rtx_p): Here and remvoe static linkage.
	* gcse.c (prune_expressions): Use contains_mem_rtx_p to discover
	and prune MEMs that are not at the toplevel of a SET_SRC rtx.  Look
	through ZERO_EXTEND and SIGN_EXTEND when trying to avoid pruning
	MEMs.

	PR tree-optimization/78812
	* g++.dg/torture/pr78812.C: New test.

From-SVN: r244093
2017-01-05 00:38:48 -07:00
Michael Meissner 08edc32002 Fix ChangeLog date
From-SVN: r244085
2017-01-05 00:44:22 +00:00
Michael Meissner fba4b86109 re PR target/71977 (powerpc64: Use VSR when operating on float and integer)
[gcc]
2017-01-04  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/71977
	PR target/70568
	PR target/78823
	* config/rs6000/predicates.md (sf_subreg_operand): New predicate.
	(altivec_register_operand): Do not return true if the operand
	contains a SUBREG mixing SImode and SFmode.
	(vsx_register_operand): Likewise.
	(vsx_reg_sfsubreg_ok): New predicate.
	(vfloat_operand): Do not return true if the operand contains a
	SUBREG mixing SImode and SFmode.
	(vint_operand): Likewise.
	(vlogical_operand): Likewise.
	(gpc_reg_operand): Likewise.
	(int_reg_operand): Likewise.
	* config/rs6000/rs6000-protos.h (valid_sf_si_move): Add
	declaration.
	* config/rs6000/rs6000.c (valid_sf_si_move): New function to
	determine if a MOVSI or MOVSF operation contains SUBREGs that mix
	SImode and SFmode.
	(rs6000_emit_move_si_sf_subreg): New helper function.
	(rs6000_emit_move): Call rs6000_emit_move_si_sf_subreg to possbily
	fixup SUBREGs involving SImode and SFmode.
	* config/rs6000/vsx.md (SFBOOL_*): New constants that are operand
	numbers for the new peephole2 optimization.
	(peephole2 for SFmode unions): New peephole2 to optimize cases in
	the GLIBC math library that do AND/IOR/XOR operations on single
	precision floating point.
	* config/rs6000/rs6000.h (TARGET_NO_SF_SUBREG): New internal
	target macros to say whether we need to avoid SUBREGs mixing
	SImode and SFmode.
	(TARGET_ALLOW_SF_SUBREG): Likewise.
	* config/rs6000/rs6000.md (UNSPEC_SF_FROM_SI): New unspecs.
	(UNSPEC_SI_FROM_SF): Likewise.
	(iorxor): Change spacing.
	(and_ior_xor): New iterator for AND, IOR, and XOR.
	(movsi_from_sf): New insns for SImode/SFmode SUBREG support.
	(movdi_from_sf_zero_ext): Likewise.
	(mov<mode>_hardfloat, FMOVE32 iterator): Use register_operand
	instead of gpc_reg_operand.  Add SImode/SFmode SUBREG support.
	(movsf_from_si): New insn for SImode/SFmode SUBREG support.
	(fma<mode>4): Use gpc_reg_operand instead of register_operand.
	(fms<mode>4): Likewise.
	(fnma<mode>4): Likewise.
	(fnms<mode>4): Likewise.
	(nfma<mode>4): Likewise.
	(nfms<mode>4): Likewise.

[gcc/testsuite]
2017-01-04  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/71977
	PR target/70568
	PR target/78823
	* gcc.target/powerpc/pr71977-1.c: New tests to check whether on
	64-bit VSX systems with direct move, whether we optimize common
	code sequences in the GLIBC math library for float math functions.
	* gcc.target/powerpc/pr71977-2.c: Likewise.

From-SVN: r244084
2017-01-05 00:43:53 +00:00
Marek Polacek a9342885b1 re PR c++/64767 (Could GCC warn when a pointer is compared against '\0'?)
PR c++/64767
	* c.opt (Wpointer-compare): New option.

	* c-parser.c (c_parser_postfix_expression): Mark zero character
	constants by setting original_type in c_expr.
	* c-typeck.c (parser_build_binary_op): Warn when a pointer is compared
	with a zero character constant.
	(char_type_p): New function.

	* typeck.c (cp_build_binary_op): Warn when a pointer is compared with
	a zero character literal.

	* doc/invoke.texi: Document -Wpointer-compare.

	* c-c++-common/Wpointer-compare-1.c: New test.

From-SVN: r244076
2017-01-04 21:47:04 +00:00
Jakub Jelinek abec4284a6 re PR c++/78949 (incorrect "unused variable" warning with SSE2)
PR c++/78949
	* typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
	vector type.

	* c-c++-common/Wunused-var-16.c: New test.

From-SVN: r244075
2017-01-04 22:34:27 +01:00
Jakub Jelinek 26c43e2744 re PR c++/78693 (Bogus 'inconsistent deduction for ‘auto’' error when having a dependent initializer and a nondependent one in the same declaration)
PR c++/78693
	* parser.c (cp_parser_simple_declaration): Only complain about
	inconsistent auto deduction if auto_result doesn't use auto.

	* g++.dg/cpp0x/pr78693.C: New test.

From-SVN: r244074
2017-01-04 22:30:35 +01:00
Jakub Jelinek fc73e60cde re PR driver/78957 (ICE: SIGSEGV with -fno-sso-struct=web)
PR driver/78957
	* c.opt (fsso-struct=): Add RejectNegative.

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

From-SVN: r244072
2017-01-04 21:25:13 +01:00
Jakub Jelinek c9cf3863bd parser.c (cp_parser_simple_declaration): Diagnose function declaration among more than one init-declarators with auto...
* parser.c (cp_parser_simple_declaration): Diagnose function
	declaration among more than one init-declarators with auto
	specifier.

	* g++.dg/cpp1y/auto-fn34.C: New test.

From-SVN: r244071
2017-01-04 21:13:14 +01:00
Jakub Jelinek 066435fe10 re PR c++/71182 (parser.c cp_lexer_previous_token sanitizer detects member call on null pointer)
PR c++/71182
	* parser.c (cp_lexer_previous_token): Use vec_safe_address in the
	assertion, as lexer->buffer may be NULL.

	* g++.dg/cpp0x/pr71182.C: New test.

From-SVN: r244070
2017-01-04 21:05:14 +01:00
Kelvin Nilsen 598bd6878a re PR target/78056 (build failure on Power7)
gcc/testsuite/ChangeLog:

2017-01-04  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/78056
	* gcc.target/powerpc/pr78056-1.c: New test.
	* gcc.target/powerpc/pr78056-2.c: New test.
	* gcc.target/powerpc/pr78056-3.c: New test.
	* gcc.target/powerpc/pr78056-4.c: New test.
	* gcc.target/powerpc/pr78056-5.c: New test.
	* gcc.target/powerpc/pr78056-6.c: New test.
	* gcc.target/powerpc/pr78056-7.c: New test.
	* gcc.target/powerpc/pr78056-8.c: New test.
	* lib/target-supports.exp
	(check_effective_target_powerpc_popcntb_ok): New procedure to test
	whether the effective target supports the popcntb instruction.

gcc/ChangeLog:

2017-01-04  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/78056
	* doc/sourcebuild.texi (PowerPC-specific attributes): Add
	documentation of the powerpc_popcntb_ok attribute.
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Add
	code to issue warning messages if a requested CPU configuration is
	not supported by the binary (assembler and loader) toolchain.
	(spe_init_builtins): Add two assertions to prevent ICE if attempt is
	made to define a built-in function that has been disabled.
	(paired_init_builtins): Add assertion to prevent ICE if attempt is
	made to define a built-in function that has been disabled.
	(altivec_init_builtins): Add comment explaining why definition
	of the DST built-in functions is not preceded by an assertion
	check.  Add assertions to prevent ICE if attempts are made to
	define an altivec predicate or an abs* built-in function that has
	been disabled.
	(htm_init_builtins): Add comment explaining why definition of the
	htm built-in functions is not preceded by an assertion check.

From-SVN: r244068
2017-01-04 20:03:00 +00:00
Jeff Law 8194635af7 re PR tree-optimization/67955 (tree-dse does not use pointer info)
PR tree-optimizatin/67955
	* tree-ssa-alias.c (same_addr_size_stores_p): Check offsets first.
	Allow any SSA_VAR_P as the base objects.  Use integer_zerop.  Verify
	the points-to solution does not include pt_null.  Use DECL_PT_UID
	unconditionally.

	PR tree-optimization/67955
	* gcc.dg/tree-ssa/ssa-dse-28.c: New test.

From-SVN: r244067
2017-01-04 12:22:44 -07:00
Marek Polacek baf9ebc8cc re PR c++/77545 (ICE on valid C++11 code: in potential_constant_expression_1, at cp/constexpr.c:5480)
PR c++/77545
	PR c++/77284
	* constexpr.c (potential_constant_expression_1): Handle CLEANUP_STMT.

	* g++.dg/cpp0x/range-for32.C: New test.
	* g++.dg/cpp0x/range-for33.C: New test.

From-SVN: r244062
2017-01-04 17:47:04 +00:00
David Malcolm 5dd9a9d0c9 C FE: implement fix-it hint for -Wmissing-braces
gcc/c/ChangeLog:
	* c-parser.c (c_parser_declaration_or_fndef): Create a
	rich_location at init_loc and parse it to start_init.
	(last_init_list_comma): New global.
	(c_parser_braced_init): Update last_init_list_comma when parsing
	commas.  Pass it to pop_init_level.  Pass location of closing
	brace to pop_init_level.
	(c_parser_postfix_expression_after_paren_type): Create a
	rich_location at type_loc and parse it to start_init.
	(c_parser_omp_declare_reduction): Likewise for loc.
	* c-tree.h (start_init): Add rich_location * param.
	(pop_init_level): Add location_t param.
	* c-typeck.c (struct initializer_stack): Add field
	"missing_brace_richloc".
	(start_init): Add richloc param, use it to initialize
	the stack node's missing_brace_richloc.
	(last_init_list_comma): New decl.
	(finish_implicit_inits): Pass last_init_list_comma to
	pop_init_level.
	(push_init_level): When finding missing open braces, add fix-it
	hints to the richloc.
	(pop_init_level): Add "insert_before" param and pass it
	when calling pop_init_level.  Add fixits about missing
	close braces to any richloc.  Use the richloc for the
	-Wmissing-braces warning.
	(set_designator): Pass last_init_list_comma to pop_init_level.
	(process_init_element): Likewise.

gcc/testsuite/ChangeLog:
	* gcc.dg/Wmissing-braces-fixits.c: New test case.

From-SVN: r244061
2017-01-04 17:40:59 +00:00
Nathan Sidwell 4bf07f3f5f re PR c++/66735 ([C++14] lambda init-capture fails for const references)
cp/
	PR c++/66735
	* cp-tree.h (DECLTYPE_FOR_REF_CAPTURE): New.
	(lambda_capture_field_type): Update prototype.
	* lambda.c (lambda_capture_field_type): Add is_reference parm.
	Add referenceness here.
	(add_capture): Adjust lambda_capture_field_type call, refactor
	error checking.
	* pt.c (tsubst): Adjust lambda_capture_field_type call.

	testsuite/
	PR c++/66735
	* g++.dg/cpp1y/pr66735.C: New.

From-SVN: r244056
2017-01-04 15:23:40 +00:00
Jakub Jelinek 165ba2e9c7 re PR tree-optimization/71563 (Regression in GCC-7.0.0's optimizer.)
PR tree-optimization/71563
	* match.pd: Simplify X << Y into X if Y is known to be 0 or
	out of range value - has low bits known to be zero.

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

From-SVN: r244050
2017-01-04 10:07:33 +01:00
Janne Blomqvist 4567f969b2 PR 78796 Modify testcases due to gfc_trans_string_copy change
As r244011 had to be reverted, this change adds back the testcase
changes that are needed due to r244003.

2017-01-04  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78534
	PR fortran/78976
	* gfortran.dg/dependency_49.f90: Change scan-tree-dump-times
	due to gfc_trans_string_copy change to avoid -Wstringop-overflow.
	* gfortran.dg/transfer_intrinsic_1.f90: Change
	scan-tree-dump-times due to gfc_trans_string_copy change to
	avoid -Wstringop-overflow.

From-SVN: r244048
2017-01-04 10:06:54 +02:00
Jeff Law 1c06f07f71 re PR tree-optimization/78856 (wrong code at -O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes))
PR tree-optimizatin/78856
	* tree-ssa-threadupdate.c: Include tree-vectorizer.h.
	(mark_threaded_blocks): Remove code to truncate thread paths that
	cross multiple loop headers.  Instead invalidate the cached loop
	iteration information and handle case of a thread path walking
	into an irreducible region.

	PR tree-optimization/78856
	* gcc.c-torture/execute/pr78856.c: New test.

From-SVN: r244045
2017-01-03 22:31:23 -07:00
Michael Meissner 60fb638f9c re PR target/78900 (ICE in gcc.target/powerpc/signbit-3.c)
[gcc]
2016-12-30  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/78900
	* config/rs6000/rs6000.c (rs6000_split_signbit): Change some
	assertions.  Add support for doing the signbit if the IEEE 128-bit
	floating point value is in a GPR.
	* config/rs6000/rs6000.md (Fsignbit): Delete.
	(signbit<mode>2_dm): Delete using <Fsignbit> and just use "wa".
	Update the length attribute if the value is in a GPR.
	(signbit<mode>2_dm_<su>ext): Add combiner pattern to eliminate
	the sign or zero extension instruction, since the value is always
	0/1.
	(signbit<mode>2_dm2): Delete using <Fsignbit>.

2017-01-03  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/78953
	* config/rs6000/vsx.md (vsx_extract_<mode>_store_p9): If we are
	extracting SImode to a GPR register so that we can generate a
	store, limit the vector to be in a traditional Altivec register
	for the vextuwrx instruction.

[gcc/testsuite]
2017-01-03  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/78953
	* gcc.target/powerpc/pr78953.c: New test.

From-SVN: r244044
2017-01-04 04:32:48 +00:00
Ian Lance Taylor e4d02f5277 godump.c (go_format_type): Treat ENUMERAL_TYPE like INTEGER_TYPE.
gcc/:
	* godump.c (go_format_type): Treat ENUMERAL_TYPE like
	INTEGER_TYPE.
gcc/testsuite/:
	* gcc.misc-tests/godump-1.c: Update for accurate representation of
	enums.

From-SVN: r244041
2017-01-04 00:58:34 +00:00
Martin Sebor 5b4f088d0d PR tree-optimization/78696 - [7 Regression] -fprintf-return-value misoptimizes %.Ng where N is greater than 10
gcc/ChangeLog:

	PR tree-optimization/78696
	* gimple-ssa-sprintf.c (format_floating): Correct handling of
	precision.  Use MPFR for %f for greater fidelity.  Correct handling
	of %g.
	(pass_sprintf_length::compute_format_length): Set width and precision
	specified by asrerisk to void_node for vararg functions.
	(try_substitute_return_value): Adjust dump output.

gcc/testsuite/ChangeLog:

	PR tree-optimization/78696
	* gcc.dg/tree-ssa/builtin-sprintf-5.c: Remove incorrect test cases.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: Correct off-by-1 errors.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-9.c: New test.
	* gcc.dg/tree-ssa/builtin-sprintf.c: Add test cases.

From-SVN: r244037
2017-01-03 16:14:44 -07:00
Janne Blomqvist 84aff3c2d4 PR 78534 Revert r244011
r244011 caused regressions on 32-bit hosts.

From-SVN: r244027
2017-01-03 20:01:30 +02:00
David Malcolm 8b66e61133 gcc-dg.exp: support more than one digit in relative line number notation
gcc/testsuite/ChangeLog:
	* gcc.dg/dg-test-1.c: Add tests of relative line specifications
	with more than one digit.
	* lib/gcc-dg.exp (process-message): Support more than one digit
	in relative line specifications.

From-SVN: r244024
2017-01-03 16:25:31 +00:00
Jakub Jelinek 51ad5d5ba3 re PR tree-optimization/78965 (Invalid -fprintf-return-value optimization)
PR tree-optimization/78965
	* gimple-ssa-sprintf.c (pass_sprintf_length::compute_format_length):
	Change first argument from const call_info & to call_info &.  For %n
	set info.nowrite to false.

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

From-SVN: r244014
2017-01-03 08:23:11 +01:00
Jakub Jelinek cd123354c5 re PR middle-end/78901 (ICE: verify_gimple failed (error: statement marked for throw in middle of block))
PR middle-end/78901
	* gimple-ssa-sprintf.c (try_substitute_return_value): Don't change
	possibly throwing calls.

	* g++.dg/opt/pr78901.C: New test.

From-SVN: r244013
2017-01-03 08:20:04 +01:00
Janne Blomqvist 994e4aca2c PR 78534 Change character length from int to size_t
In order to handle large character lengths on (L)LP64 targets, switch
the GFortran character length from an int to a size_t.

This is an ABI change, as procedures with character arguments take
hidden arguments with the character length.

I also changed the _size member in vtables from int to size_t, as
there were some cases where character lengths and sizes were
apparently mixed up and caused regressions otherwise. Although I
haven't tested, this might enable very large derived types as well.

Also, as there are some places in the frontend were negative character
lengths are used as special flag values, in the frontend the character
length is handled as a signed variable of the same size as a size_t,
although in the runtime library it really is size_t.

I haven't changed the character length variables for the co-array
intrinsics, as this is something that may need to be synchronized with
OpenCoarrays.

This is v3 of the patch. All the issues pointed out by FX's review of
v2 have been fixed. In particular, there are now new functions
gfc_mpz_get_hwi and gfc_mpz_set_hwi, similar to the GMP functions
mpz_get_si and mpz_set_si, except that they get/set a HOST_WIDE_INT
instead of a long value. Similarly, gfc_get_int_expr now takes a
HOST_WIDE_INT instead of a long, gfc_extract_long is replaced by
gfc_extract_hwi. Also, the preliminary work to handle
gfc_charlen_type_node being unsigned has been removed.

Regtested on x86_64-pc-linux-gnu.

frontend:

2017-01-03  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78534
	PR fortran/66310
	* class.c (gfc_find_derived_vtab): Use gfc_size_kind instead of
	hardcoded kind.
	(find_intrinsic_vtab): Likewise.
	* expr.c (gfc_get_character_expr): Length parameter of type
	gfc_charlen_t.
	(gfc_get_int_expr): Value argument of type HOST_WIDE_INT.
	(gfc_extract_hwi): New function.
	(simplify_const_ref): Make string_len of type gfc_charlen_t.
	(gfc_simplify_expr): Use HOST_WIDE_INT for substring refs.
	* gfortran.h (gfc_mpz_get_hwi): New prototype.
	(gfc_mpz_set_hwi): Likewise.
	(gfc_charlen_t): New typedef.
	(gfc_expr): Use gfc_charlen_t for character lengths.
	(gfc_size_kind): New extern variable.
	(gfc_extract_hwi): New prototype.
	(gfc_get_character_expr): Use gfc_charlen_t for character length.
	(gfc_get_int_expr): Use HOST_WIDE_INT type for value argument.
	* iresolve.c (gfc_resolve_repeat): Pass string length directly without
	temporary, use gfc_charlen_int_kind.
	* match.c (select_intrinsic_set_tmp): Use HOST_WIDE_INT for charlen.
	* misc.c (gfc_mpz_get_hwi): New function.
	(gfc_mpz_set_hwi): New function.
	* module.c (atom_int): Change type from int to HOST_WIDE_INT.
	(parse_integer): Don't complain about large integers.
	(write_atom): Use HOST_WIDE_INT for integers.
	(mio_integer): Handle integer type mismatch.
	(mio_hwi): New function.
	(mio_intrinsic_op): Use HOST_WIDE_INT.
	(mio_array_ref): Likewise.
	(mio_expr): Likewise.
	* resolve.c (resolve_select_type): Use HOST_WIDE_INT for charlen,
	use snprintf.
	(resolve_charlen): Use mpz_sgn to determine sign.
	* simplify.c (gfc_simplify_repeat): Use HOST_WIDE_INT/gfc_charlen_t
	instead of long.
	* target-memory.c (size_character): Length argument of type
	gfc_charlen_t.
	(gfc_encode_character): Likewise.
	(gfc_interpret_character): Use gfc_charlen_t.
	* target-memory.h (gfc_encode_character): Modify prototype.
	* trans-array.c (get_array_ctor_var_strlen): Use
	gfc_conv_mpz_to_tree_type.
	* trans-const.c (gfc_conv_mpz_to_tree_type): New function.
	* trans-const.h (gfc_conv_mpz_to_tree_type): New prototype.
	* trans-expr.c (gfc_class_len_or_zero_get): Build const of type
	gfc_charlen_type_node.
	(gfc_conv_intrinsic_to_class): Use gfc_charlen_int_kind instead of
	4, fold_convert to correct type.
	(gfc_conv_class_to_class): Build const of type size_type_node for
	size.
	(gfc_copy_class_to_class): Likewise.
	(gfc_conv_string_length): Use same type in expression.
	(gfc_conv_substring): Likewise, use HOST_WIDE_INT for charlen.
	(gfc_conv_string_tmp): Make sure len is of the right type.
	(gfc_conv_concat_op): Use same type in expression.
	(gfc_conv_procedure_call): Likewise.
	(alloc_scalar_allocatable_for_subcomponent_assignment):
	fold_convert to right type.
	(gfc_trans_subcomponent_assign): Likewise.
	(trans_class_vptr_len_assignment): Build const of correct type.
	(gfc_trans_pointer_assignment): Likewise.
	(alloc_scalar_allocatable_for_assignment): fold_convert to right
	type in expr.
	(trans_class_assignment): Build const of correct type.
	* trans-intrinsic.c (gfc_conv_associated): Likewise.
	(gfc_conv_intrinsic_repeat): Do calculation in sizetype.
	* trans-io.c (gfc_build_io_library_fndecls): Use
	gfc_charlen_type_node for character lengths.
	* trans-stmt.c (gfc_trans_label_assign): Build const of
	gfc_charlen_type_node.
	(gfc_trans_character_select): Likewise.
	(gfc_trans_allocate): Likewise, don't typecast strlen result.
	(gfc_trans_deallocate): Don't typecast strlen result.
	* trans-types.c (gfc_size_kind): New variable.
	(gfc_init_types): Determine gfc_charlen_int_kind and gfc_size_kind
	from size_type_node.

testsuite:

2017-01-03  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78534
	PR fortran/66310
	* gfortran.dg/dependency_49.f90: Change scan-tree-dump-times
          due to gfc_trans_string_copy change to avoid
          -Wstringop-overflow.
	* gfortran.dg/repeat_4.f90: Use integers of kind C_SIZE_T.
	* gfortran.dg/repeat_7.f90: New test for PR 66310.
	* gfortran.dg/scan_2.f90: Handle potential cast in assignment.
	* gfortran.dg/string_1.f90: Limit to ilp32 targets.
	* gfortran.dg/string_1_lp64.f90: New test.
	* gfortran.dg/string_3.f90: Limit to ilp32 targets.
	* gfortran.dg/string_3_lp64.f90: New test.
	* gfortran.dg/transfer_intrinsic_1.f90: Change
          scan-tree-dump-times due to gfc_trans_string_copy change to
          avoid -Wstringop-overflow.

libgfortran:

2017-01-03  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78534
	* intrinsics/args.c (getarg_i4): Use gfc_charlen_type.
	(get_command_argument_i4): Likewise.
	(get_command_i4): Likewise.
	* intrinsics/chmod.c (chmod_internal): Likewise.
	* intrinsics/env.c (get_environment_variable_i4): Likewise.
	* intrinsics/extends_type_of.c (struct vtype): Use size_t for size
	member.
	* intrinsics/gerror.c (gerror): Use gfc_charlen_type.
	* intrinsics/getlog.c (getlog): Likewise.
	* intrinsics/hostnm.c (hostnm_0): Likewise.
	* intrinsics/string_intrinsics_inc.c (string_len_trim): Rework to
	work if gfc_charlen_type is unsigned.
	(string_scan): Likewise.
	* io/transfer.c (transfer_character): Modify prototype.
	(transfer_character_write): Likewise.
	(transfer_character_wide): Likewise.
	(transfer_character_wide_write): Likewise.
	(transfer_array): Typecast to avoid signed-unsigned comparison.
	* io/unit.c (is_trim_ok): Use gfc_charlen_type.
	* io/write.c (namelist_write): Likewise.
	* libgfortran.h (gfc_charlen_type): Change typedef to size_t.

From-SVN: r244011
2017-01-03 09:04:01 +02:00
Uros Bizjak 8b7163c630 re PR target/78967 (inserts are not effective)
target/78967
	* config/i386/i386.md (UNSPEC_NOREX_MEM): New unspec.
	(*insvqi_1): New insn pattern.
	(*insvqi_1_mem_rex64): Ditto.
	(*insvqi_2): Ditto.
	(*insvqi_3): Rename from *insvqi.

	(*extzvqi_mem_rex64): Add UNSPEC_NOREX_MEM tag.

testsuite/ChangeLog:

	PR target/78967
	* gcc.target/i386/pr78967-1.c: New test.
	* gcc.target/i386/pr78967-2.c: Ditto.
	* gcc.target/i386/pr78967-3.c: Ditto.

	* gcc.target/i386/pr78904-2.c: Tighten scan-asm patterns.
	* gcc.target/i386/pr78904-4.c: Ditto.
	* gcc.target/i386/pr78904-6.c: Ditto.

From-SVN: r244006
2017-01-02 23:08:18 +01:00
Jan Hubicka e2940b9866 re PR ipa/77674 (ICE in binds_to_current_def_p with -fkeep-inline-functions)
PR middle-end/77674
	* symtab.c (symtab_node::binds_to_current_def_p): Fix handling of
	transparent aliases.

	PR middle-end/77674
	* g++.dg/torture/pr77674.C: New testcase.

From-SVN: r243997
2017-01-01 23:31:53 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Andrew Pinski a9788936a1 c11-atomic-exec-5.c: Lower ITER_COUNT to 100 for AARCH64.
2016-12-29  Andrew Pinski  <apinski@cavium.com>

        * gcc.dg/atomic/c11-atomic-exec-5.c: Lower ITER_COUNT to 100
        for AARCH64.

From-SVN: r243973
2016-12-29 20:24:40 -08:00
Uros Bizjak a455baa994 re PR target/78904 (zero-extracts are not effective)
PR target/78904
	* config/i386/i386.md (*extvqi): Remove insn pattern.
	(divmodqi4): Update expander to generate QImode zero-extract from AH.

testsuite/ChangeLog:


	PR target/78904
	* gcc.target/i386/pr78904-6.c: New test.

From-SVN: r243968
2016-12-29 22:41:07 +01:00
Jakub Jelinek f3d17b5e71 memcpy-1.c: Include mpx-check.h.
* gcc.target/i386/mpx/memcpy-1.c: Include mpx-check.h.
	(main): Renamed to ...
	(mpx_test): ... this.  Add argc and argv arguments.

From-SVN: r243965
2016-12-29 19:51:29 +01:00
Martin Liska d4a6c0ea4b Add RejectNegative for a c option.
PR c/78933
	* g++.dg/pr78933.C: New test.
	PR c/78933
	* c.opt (strong-eval-order): Add RejectNegative keyword.

From-SVN: r243960
2016-12-29 10:35:33 +00:00
Uros Bizjak 5c8617dce6 re PR target/78904 (zero-extracts are not effective)
PR target/78904
	* config/i386/constraints.md (Bn): New special memory constraint.
	* config/i386/predicates.md (norex_memory_operand): New predicate.
	* config/i386/i386.md (*extzvqi_mem_rex64): New insn pattern and
	corresponding peephole2 pattern.

testsuite/ChangeLog:

	PR target/78904
	* gcc.target/i386/pr78904-4.c: New test.
	* gcc.target/i386/pr78904-5.c: Ditto.

From-SVN: r243955
2016-12-28 16:16:26 +01:00
Michael Meissner df3aba14ab predicates.md (const_0_to_12_operand): Rename predicate and change test from 0..11 to 0..12 to match the semantics of...
[gcc]
2016-12-27  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config/rs6000/predicates.md (const_0_to_12_operand): Rename
	predicate and change test from 0..11 to 0..12 to match the
	semantics of the word extract/insert instructions.  Change all
	callers.
	(const_0_to_11_operand): Likewise.
	* config/rs6000/rs6000.c (altivec_expand_builtin): Likewise.
	* config/rs6000/vsx.md (vextract4b): Likewise.
	(vextract4b_internal): Likewise.
	(vinsert4b): Likewise.
	(vinsert4b_internal): Likewise.
	(vinsert4b_di): Likewise.
	(vinsert4b_di_internal): Likewise.
	* config/rs6000/rs6000.md (zero_extendsi<mode>2): Fix offset used
	in xxextractuw to zero extend the word in the vector registers.
	(lfiwzx): Likewise.

[gcc/testsuite]
2016-12-27  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* gcc.target/powerpc/p9-vinsert4b-2.c: Update test to test for 13
	being out of bounds instead of 12.

From-SVN: r243948
2016-12-27 23:19:15 +00:00
Alexander Ivchenko bffa6b6c62 libtool-version: New version.
libmpx/

2016-12-27  H.J. Lu  <hongjiu.lu@intel.com>
	    Alexander Ivchenko  <alexander.ivchenko@intel.com>

	* mpxwrap/libtool-version: New version.
	* mpxwrap/mpx_wrappers.c (__mpx_wrapper_realloc): Make it
	static with external alias.
	(__mpx_wrapper_bzero): Ditto.
	(mpx_wrapper_memcpy): Ditto.
	(__mpx_wrapper_mempcpy): Ditto.

From-SVN: r243942
2016-12-27 15:35:19 +00:00
Uros Bizjak 4b6d0c0eb4 re PR target/78904 (zero-extracts are not effective)
PR target/78904
	* config/i386/constraints.md (Bc): New special memory constraint.
	* config/i386/i386.md (*cmpqi_ext_1, *extvqi, *extzvqi): Use Bc
	constraint with nonimmediate_operand to allow constant memory operands.
	(*cmpqi_ext_3, insv<mode>_1, addqi_ext_1, *testqi_ext_1, andqi_ext_1)
	(*<any_or:code>qi_ext_1, *xorqi_ext_1_cc): Use Bc constraint
	with general_operand to allow constant memory operands.

testsuite/ChangeLog:

	PR target/78904
	* gcc.target/i386/pr78904-3.c: New test.

From-SVN: r243937
2016-12-27 15:20:19 +01:00
Alexander Ivchenko 8ba4f50639 c.opt (flag_chkp_flexible_struct_trailing_arrays): Add new option.
2016-12-27  Alexander Ivchenko  <alexander.ivchenko@intel.com>

* c-family/c.opt (flag_chkp_flexible_struct_trailing_arrays):
  Add new option.
  (fchkp-narrow-to-innermost-array): Fix typo.
* doc/cpp.texi (flag_chkp_flexible_struct_trailing_arrays): Ditto.
* tree-chkp.c (chkp_may_narrow_to_field ): Forbid
  narrowing when flag_chkp_flexible_struct_trailing_arrays is used
  and the field is the last array field in the structure.


2016-12-27  Alexander Ivchenko  <alexander.ivchenko@intel.com>

* gcc.target/i386/mpx/vla-trailing-1-lbv.c: New test.
* gcc.target/i386/mpx/vla-trailing-1-nov.c: Ditto.
* gcc.target/i386/mpx/vla-trailing-1-ubv.c: Ditto.

From-SVN: r243936
2016-12-27 13:31:43 +00:00
Uros Bizjak b1d3a450be re PR target/78904 (zero-extracts are not effective)
PR target/78904
	* config/i386/i386.md (*cmpqi_ext_1, *extvqi, *extzvqi): Use
	nonimmediate_operand instead of nonimmediate_x64nomem_operand.
	(*cmpqi_ext_3, insv<mode>_1, addqi_ext_1, *testqi_ext_1, andqi_ext_1)
	(*<any_or:code>qi_ext_1, *xorqi_ext_1_cc): Use general_operand
	instead of general_x64nomem_operand.
	* config/i386/predicates.md (nonimmediate_x64nomem_operand): Remove.
	(general_x64nomem_operand): Ditto.

testsuite/ChangeLog:

	PR target/78904
	* gcc.target/i386/pr78904-2.c: New test.

From-SVN: r243933
2016-12-27 09:59:04 +01:00
Uros Bizjak ecb1129654 re PR target/78904 (zero-extracts are not effective)
PR target/78904
	* config/i386/i386.md (addqi_ext_1): Canonicalize insn pattern w.r.t.
	zero_extract RTXes.
	(*addqi_ext_2): Ditto.
	(testqi_ext_ccno_0): Canonicalize expander w.r.t. zero_extract RTXes.
	(testqi_ext_1_ccno): Rename from testqi_ext_ccno_0.
	(*testqi_ext_0): Merge with *testqi_ext_1.
	(*testqi_ext_1): Canonicalize insn pattern w.r.t. zero_extract RTXes.
	Update corresponding splitter.
	(*testqi_ext_2): Canonicalize insn pattern w.r.t. zero_extract RTXes.
	(*andqi_ext_0): Merge with *andqi_ext_1.
	(andqi_ext_1): Canonicalize insn pattern w.r.t. zero_extract RTXes.
	Rename from *andqi_ext_1.  Update corresponding splitter and
	peephole2 patterns.
	(*andqi_ext_1_cc): Rename from *andqi_ext_0_cc.
	(*andqi_ext_2): Canonicalize insn pattern w.r.t. zero_extract RTXes.
	(*<any_or:code>qi_ext_0): Merge with *andqi_ext_1.
	(*<any_or:code>qi_ext_1): Canonicalize insn pattern w.r.t.
	zero_extract RTXes.  Update corresponding splitter.
	(*<any_or:code>qi_ext_2): Canonicalize insn pattern w.r.t.
	zero_extract RTXes.
	(xorqi_cc_ext_1): Canonicalize expander w.r.t. zero_extract RTXes.
	(xorqi_ext_1_cc): Rename from xorqi_cc_ext_1.
	(*xorqi_cc_ext_1): Canonicalize insn pattern w.r.t. zero_extract RTXes.
	Update corresponding splitter.
	(*xorqi_ext_1_cc): Rename from *xorqi_cc_ext_1.
	(isinfxf2): Update calls to renamed expanders.
	(isinf<mode>2): Ditto.
	* config/i386/i386.c (ix86_expand_fp_compare): Ditto.
	(ix86_emit_fp_unordered_jump): Ditto.
	(ix86_emit_i387_round): Ditto.

testsuite/ChangeLog:

	PR target/78904
	* gcc.target/i386/pr78904.c: New test.

From-SVN: r243929
2016-12-26 20:00:47 +01:00
Andre Vehreschild f19dd7b634 class_assign_1.f08: New test.
gcc/testsuite/ChangeLog:

2016-12-23  Andre Vehreschild  <vehre@gcc.gnu.org>

	* gfortran.dg/class_assign_1.f08: New test.


gcc/fortran/ChangeLog:

2016-12-23  Andre Vehreschild  <vehre@gcc.gnu.org>

	* trans-expr.c (trans_class_assignment): Allocate memory of _vptr->size
        before assigning an allocatable class object.
	(gfc_trans_assignment_1): Flag that (re-)alloc of the class object
	shall be done.

From-SVN: r243909
2016-12-23 11:26:47 +01:00
Toma Tabacu cca8d0b265 MIPS: Cleanup the forcing of assembly output in error tests.
gcc/testsuite

	* gcc.target/mips/oddspreg-2.c (dg-options): Remove dg-skip-if for
	-fno-fat-lto-objects and add the -ffat-lto-objects option, along with
	an explanation for its purpose.
	* gcc.target/mips/oddspreg-3.c (dg-options): Likewise.
	* gcc.target/mips/oddspreg-6.c (dg-options): Likewise.
	* gcc.target/mips/no-dsp-1.c: Add an explanation for the purpose of
	-ffat-lto-objects.
	* gcc.target/mips/pr54240.c: Likewise.
	* gcc.target/mips/r10k-cache-barrier-14.c: Likewise.
	* gcc.target/mips/soft-float-1.c: Likewise.

From-SVN: r243908
2016-12-23 09:52:43 +00:00
Prathamesh Kulkarni cb66382056 tree-pretty-print.c (dump_generic_node): Change dump format for REALPART_EXPR and IMAGPART_EXPR with TDF_GIMPLE.
2016-12-22  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	* tree-pretty-print.c (dump_generic_node): Change dump format for
	REALPART_EXPR and IMAGPART_EXPR with TDF_GIMPLE.

testsuite/
	* gcc.dg/gimplefe-20.c: New test-case.

From-SVN: r243898
2016-12-22 20:30:33 +00:00
Georg-Johann Lay 745b451267 re PR testsuite/52641 (Test cases fail for 16-bit int targets)
gcc/testsuite/
	PR testsuite/52641
	* gcc.dg/fold-and-rshift-2.c [int <= 2]: Use 32-bit int as needed.

From-SVN: r243889
2016-12-22 15:02:43 +00:00
Andreas Krebbel 8db9d05e0f varasm: Propagate litpool decl alignment to generated RTX.
When pushing a value into the literal pool the resulting decl might
get a higher alignment than the original expression depending on how a
target defines CONSTANT_ALIGNMENT.  Generating an RTX for the constant
pool access we currently use the alignment from the original
expression.  Changed with the attached patch.

This fixes a GCC 6 regression for S/390.  For arrays of string
constants as in the attached testcase encode_section_info is not able
to figure out that the constant pool slot is already properly aligned
since the mem_align field in the rtx is not set properly.

gcc/ChangeLog:

2016-12-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* varasm.c (build_constant_desc): Use the alignment of the var
	decl instead of the original expression.

gcc/testsuite/ChangeLog:

2016-12-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* gcc.target/s390/litpool-str-1.c: New test.

From-SVN: r243888
2016-12-22 14:50:29 +00:00
Dominik Vogt cbbb9dabbb Run tests only if the machine supports the instruction set.
gcc/ChangeLog:

2016-12-22  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Define
	__S390_ARCH_LEVEL__.

gcc/testsuite/ChangeLog:

2016-12-22  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* gcc.target/s390/md/setmem_long-1.c: Use "s390_useable_hw".
	* gcc.target/s390/md/rXsbg_mode_sXl.c: Likewise.
	* gcc.target/s390/md/andc-splitter-1.c: Likewise.
	* gcc.target/s390/md/andc-splitter-2.c: Likewise.
	* lib/gcc-dg.exp (gcc-dg-runtest): Export torture_current_flags.
	* gcc.target/s390/s390.exp: Import torture_current_flags.
	(check_effective_target_s390_useable_hw): New.
	(check_effective_target_s390_z900_hw): New.
	(check_effective_target_s390_z990_hw): New.
	(check_effective_target_s390_z9_ec_hw): New.
	(check_effective_target_s390_z10_hw): New.
	(check_effective_target_s390_z196_hw): New.
	(check_effective_target_s390_zEC12_hw): New.
	(check_effective_target_s390_z13_hw): New.
	(check_effective_target_z10_instructions): Removed.
	(torture tests): Add optimization level without -march=.
	Reorder torture tests for good cache usage.

From-SVN: r243887
2016-12-22 14:46:46 +00:00
Martin Liska a71dcca81e Fix tree-optimization/78886.
PR tree-optimization/78886
	* gcc.dg/tree-ssa/pr78886.c: New test.
	PR tree-optimization/78886
	* tree-ssa-strlen.c (handle_builtin_malloc): Return when LHS
	is equal to NULL.

From-SVN: r243886
2016-12-22 13:09:11 +00:00
Georg-Johann Lay 7fbb9b18cc re PR testsuite/52641 (Test cases fail for 16-bit int targets)
gcc/testsuite/
	PR testsuite/52641
	* gcc.dg/pr35258.c (main) <temp>: Use an integer value that has
	at least a size of 4.
	* gcc.dg/Walloca-1.c (foo1): Use alloca with 30000 (instead of 90000).
	* gcc.dg/graphite/pr46185.c: Require int32plus, size32plus.
	* gcc.dg/graphite/isl-ast-op-select.c: Same.
	* gcc.dg/graphite/pr42205-1.c: Require int32plus.
	* gcc.dg/graphite/pr42221.c: Same.
	* gcc.dg/tree-ssa/pr65136.c: Same.
	* gcc.dg/tree-ssa/sra-20.c: Same.
	* gcc.dg/graphite/scop-0.c: Require size32plus.
	* gcc.dg/graphite/scop-22.c: Same.
	* gcc.dg/graphite/scop-3.c: Same.
	* gcc.dg/graphite/scop-dsyr2k.c: Same.
	* gcc.dg/graphite/scop-dsyrk.c: Same.
	* gcc.dg/graphite/scop-mvt.c: Same.
	* gcc.dg/graphite/scop-sor.c: Same.
	* gcc.dg/tree-ssa/pr68529-3.c: Same.
	* gcc.dg/tree-ssa/pr66449.c [long != pointer]: Use intptr_t if.
	* gcc.dg/tree-ssa/pr70919.c [int <= 2]: Use 32-bit int as needed.
	* gcc.dg/tree-ssa/pr71408.c: Same.
	* gcc.dg/tree-ssa/ssa-dom-thread-8.c (f2) [long != pointer]: Use
	uintptr_t instead of long for int representation of address.
	* gcc.dg/tree-ssa/tailcall-7-run.c: Require trampolines.

From-SVN: r243885
2016-12-22 12:42:35 +00:00
Jakub Jelinek 35dddc5327 re PR middle-end/78858 (Bogus -Wnonnull warning involving strcmp with -fsanitize=undefined)
PR middle-end/78858
	* c-c++-common/ubsan/pr78858.c: New test.
	* gcc.dg/nonnull-5.c: New test.

From-SVN: r243884
2016-12-22 12:48:39 +01:00
Jakub Jelinek b5f8e89ed7 re PR c++/72707 (local anonymous union member hides names in the same scope)
PR c++/72707
	* name-lookup.c (pushdecl_maybe_friend_1): Do check shadowing of
	artificial x if it is an anonymous union variable.

	* g++.dg/warn/Wshadow-12.C: New test.

From-SVN: r243877
2016-12-21 23:49:59 +01:00
Vladimir Makarov bc13623efe re PR rtl-optimization/78580 (Segfault in gcc with multilib (-m32) and -ffixed-*)
2016-12-21  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/78580
	* ira-costs.c (find_costs_and_classes): Make regno_aclass
	translated into an allocno class.

2016-12-21  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/78580
	* gcc.target/i386/pr78580.c: New.

From-SVN: r243875
2016-12-21 22:20:11 +00:00
Jakub Jelinek bc2a38dff8 re PR c++/77830 (internal compiler error: in output_constructor_regular_field, at varasm.c:4968, when using constexpr (with testcase))
PR c++/77830
	* constexpr.c (cxx_eval_array_reference): Perform out of bounds
	verification even if lval is true, just allow one past the last
	element in that case.
	(cxx_eval_store_expression): Detect stores to out of bound
	ARRAY_REF.

	* g++.dg/cpp1y/pr77830.C: New test.
	* g++.dg/cpp0x/pr65398.C: Adjust expected diagnostics.

From-SVN: r243873
2016-12-21 22:58:23 +01:00
Bernd Schmidt d697acca12 re PR target/71321 (x86: worse code for uint8_t % 10 and / 10)
PR target/71321
	* config/i386/i386.md (lea<mode>_general_2b, lea<mode>_general_3b): New
	patterns.
	* config/i386/predicates.md (const123_operand): New.

	PR target/71321
	* gcc.target/i386/pr71321.c: New test.

From-SVN: r243861
2016-12-21 16:45:33 +00:00
Jakub Jelinek 4e2044d68d re PR fortran/78866 (ICE in gimplify_adjust_omp_clauses_1, at gimplify.c:8721)
PR fortran/78866
	* openmp.c (resolve_omp_clauses): Diagnose assumed size arrays in
	OpenMP map, to and from clauses.
	* trans-openmp.c: Include diagnostic-core.h, temporarily redefining
	GCC_DIAG_STYLE to __gcc_tdiag__.
	(gfc_omp_finish_clause): Diagnose implicitly mapped assumed size
	arrays.

	* gfortran.dg/gomp/map-1.f90: Add expected error.
	* gfortran.dg/gomp/pr78866-1.f90: New test.
	* gfortran.dg/gomp/pr78866-2.f90: New test.

From-SVN: r243860
2016-12-21 17:16:20 +01:00
David Edelsohn 5878034e03 costmodel-bb-slp-9a-pr63175.c: XFAIL lwz on AIX.
* gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c: XFAIL
        lwz on AIX.

From-SVN: r243859
2016-12-21 10:41:33 -05:00
Andre Vieira 2d44c551c2 [ARM] Updating testcase unsigned-extend-2.c
gcc/testsuite/ChangeLog:
2016-12-21  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* gcc.target/arm/unsigned-extend-2.c: Update testcase.

From-SVN: r243858
2016-12-21 15:16:53 +00:00
Martin Liska b0a3329db0 Do not suggest -fsanitize=all (PR driver/78863).
PR driver/78863
	* gcc.c (driver::build_option_suggestions): Do not add
	-fsanitize=all as a suggestion candidate.
	PR driver/78863
	* gcc.dg/spellcheck-options-13.c: New test.

From-SVN: r243857
2016-12-21 15:05:10 +00:00
Alexander Monakov 592e4d9459 nvptx: adjust testcase for 'shared' attribute
* gcc.target/nvptx/decl-shared.c (v_common): Add 'common' attribute to
	explicitly request the desired storage class.

From-SVN: r243856
2016-12-21 17:33:17 +03:00
Georg-Johann Lay adc86fa52f re PR testsuite/52641 (Test cases fail for 16-bit int targets)
gcc/testsuite/
	PR testsuite/52641
	* gcc.dg/builtin-object-size-16.c (ia0, ia1, ia9): Handle case
	where neither short nor int has a size of 4; use long.
	* gcc.dg/builtin-object-size-17.c: Same.
	* gcc.dg/builtin-stringop-chk-1.c (test2) <struct S>: Use int32_t
	for components as 4 components are supposed to occupy 16 bytes.
	* gcc.dg/pr78408-1.c: Require target size32plus.
	* gcc.dg/pr78408-2.c: Same.
	* gcc.dg/tree-ssa/pr78428.c. Require target int32plus.
	* gcc.dg/tree-ssa/tailcall-7.c: Require target trampolines.

From-SVN: r243854
2016-12-21 13:50:11 +00:00
Toma Tabacu db313371c7 MIPS: Relax instruction order check in msa-builtins.c.
gcc/testsuite

	* gcc.target/mips/msa-builtins.c (msa_insert_d): Tweak expected output.

From-SVN: r243848
2016-12-21 11:03:12 +00:00
Janne Blomqvist b528e42751 PR 78867 Function returning string ICE with -flto
The fix for PR 78757 was slightly too cautious, and covered only the
case of functions returning pointers to characters. By moving the
block above the if statement the DECL_EXPR is created also for
functions returning non-pointer characters.

Regtested on x86_64-pc-linux-gnu.

fortran ChangeLog:

2016-12-21  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78867
	* trans-expr.c (gfc_conv_procedure_call): Emit DECL_EXPR also for
	non-pointer character results.

testsuite ChangeLog:

2016-12-21  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/78867
	* gfortran.dg/string_length_4.f90: New test.

From-SVN: r243842
2016-12-21 11:41:25 +02:00
Georg-Johann Lay 84ab8b8ad5 mmcu: New folder for compile-tests with -mmcu=.
* gcc.target/avr/mmcu: New folder for compile-tests with -mmcu=.
	* gcc.target/avr/mmcu/avr-mmcu.exp: New file.
	* gcc.target/avr/pr58545.c: Move to gcc.target/avr/mmcu.
	* gcc.target/avr/tiny-caller-save.c: Dito.
	* gcc.target/avr/tiny-memx.c: Dito.

From-SVN: r243840
2016-12-21 09:20:12 +00:00
Naveen H.S 182f37c9ac match.pd (max:c @0 (plus@2 @0 INTEGER_CST@1)): New Pattern.
2016-12-22  Andrew Pinski  <apinski@cavium.com>
	    Naveen H.S <Naveen.Hurugalawadi@cavium.com>

gcc
        * match.pd (max:c @0 (plus@2 @0 INTEGER_CST@1)): New Pattern.
	(min:c @0 (plus@2 @0 INTEGER_CST@1)) : New Pattern.
gcc/testsuite
	* gcc.dg/max.c: New Testcase.
	* gcc.dg/min.c: New Testcase.

From-SVN: r243838
2016-12-21 08:37:47 +00:00
Jakub Jelinek d17680f342 re PR c/77767 (Side-effect from VLA array parameters lost)
PR c/77767
	* c-decl.c (grokdeclarator): If *expr is non-NULL, append expression
	to *expr instead of overwriting it.

	* gcc.c-torture/execute/pr77767.c: New test.

From-SVN: r243832
2016-12-21 01:07:49 +01:00
Pat Haugen 5b1d0fbaea sms-3.c: Add -fno-sched-pressure for powerpc.
* gcc.dg/sms-3.c: Add -fno-sched-pressure for powerpc.
	* gcc.dg/sms-6.c: Likewise.

From-SVN: r243829
2016-12-20 19:41:39 +00:00
David Edelsohn 96d8abf524 * gcc.dg/pr70859-2.c: Define _ISOC99_SOURCE on AIX.
From-SVN: r243828
2016-12-20 13:40:53 -05:00
David Edelsohn 0a565f3805 * gcc.dg/tls/alias-1.c: dg-add-options tls.
From-SVN: r243827
2016-12-20 13:30:21 -05:00
Andre Vieira d654723319 pr78255-2.c: Fix to work for targets that do not optimize for tailcall.
2016-12-20  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* gcc.target/arm/pr78255-2.c: Fix to work for targets
	that do not optimize for tailcall.

From-SVN: r243826
2016-12-20 16:39:50 +00:00
David Edelsohn d4dc42d276 pr78796.c: dg-add-options tls.
* gcc.dg/tls/pr78796.c: dg-add-options tls.
        * gcc.target/powerpc/fold-vec-mult-int.c: power8-vector.
        * gcc.target/powerpc/fold-vec-mult-longlong.c: -maix64.

From-SVN: r243825
2016-12-20 11:22:09 -05:00
Richard Biener a676a9a8c5 passes.c (execute_one_pass): Handle going out of SSA w/o hitting pass_startwith.
2016-12-20  Richard Biener  <rguenther@suse.de>

	* passes.c (execute_one_pass): Handle going out of SSA w/o
	hitting pass_startwith.  Handle skipping property providers.

	* gcc.dg/gimplefe-19.c: New testcase.

From-SVN: r243822
2016-12-20 12:49:31 +00:00
Kyrylo Tkachov 2a1d4076c4 [ARM] PR target/78694: Avoid invalid RTL sharing in minipool code
PR target/78694
	* config/arm/arm.c (dump_minipool): Copy mp->value before emitting it
	in the minipool to avoid invalid RTL sharing.

	* gcc.c-torture/compile/pr78694.c: New test.

From-SVN: r243820
2016-12-20 09:39:44 +00:00
Eric Botcazou 48e512b698 Fix PR testsuite/71232 entry.
From-SVN: r243819
2016-12-20 08:50:21 +00:00
Eric Botcazou c8c0c9ada6 re PR tree-optimization/71237 (scev tests failing after pass reorganization)
PR testsuite/71237
	* gnat.dg/vect1.adb: Add -fno-vect-cost-model to dg-options.
	* gnat.dg/vect2.adb: Likewise.
	* gnat.dg/vect3.adb: Likewise.
	* gnat.dg/vect4.adb: Likewise.
	* gnat.dg/vect5.adb: Likewise.
	* gnat.dg/vect6.adb: Likewise.

From-SVN: r243818
2016-12-20 08:45:52 +00:00
Uros Bizjak 6418b07737 i386.md (*popcounthi2_1): New insn_and_split pattern.
* config/i386/i386.md (*popcounthi2_1): New insn_and_split pattern.

testsuite/ChangeLog:

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

From-SVN: r243811
2016-12-19 21:23:08 +01:00
Will Schmidt a2124400f5 rs6000.c: Add handling for early expansion of vector multiply builtins.
2016-12-19  Will Schmidt  <will_schmidt@vnet.ibm.com>

        *  config/rs6000/rs6000.c: Add handling for early expansion of
        vector multiply builtins.
    
[gcc/testsuite]

2016-12-19  Will Schmidt  <will_schmidt@vnet.ibm.com>

        *  gcc.dg/vmx/mult-even-odd-be-order.c : Mark
        variables as volatile.
        *  gcc.target/powerpc/fold-vec-mult-char.c : New.
        *  gcc.target/powerpc/fold-vec-mult-float.c : New.
        *  gcc.target/powerpc/fold-vec-mult-floatdouble.c : New.
        *  gcc.target/powerpc/fold-vec-mult-int.c : New.
        *  gcc.target/powerpc/fold-vec-mult-int128-p8.c : New.
        *  gcc.target/powerpc/fold-vec-mult-int128-p9.c : New.
        *  gcc.target/powerpc/fold-vec-mult-longlong.c : New.
        *  gcc.target/powerpc/fold-vec-mult-short.c : New.

From-SVN: r243807
2016-12-19 19:03:48 +00:00
Will Schmidt 3b35c54a60 rs6000.c (rs6000_gimple_fold_builtin): Add handling for early expansion of vector subtract builtins.
2016-12-19  Will Schmidt  <will_schmidt@vnet.ibm.com>

        * config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add handling for
        early expansion of vector subtract builtins.
    
[gcc/testsuite]

2016-12-19  Will Schmidt  <will_schmidt@vnet.ibm.com>

      * gcc.target/powerpc/fold-vec-sub-char.c: New.
      * gcc.target/powerpc/fold-vec-sub-float.c: New.
      * gcc.target/powerpc/fold-vec-sub-floatdouble.c: New.
      * gcc.target/powerpc/fold-vec-sub-int.c: New.
      * gcc.target/powerpc/fold-vec-sub-int128.c: New.
      * gcc.target/powerpc/fold-vec-sub-longlong.c: New.
      * gcc.target/powerpc/fold-vec-sub-short.c: New.

From-SVN: r243806
2016-12-19 18:58:19 +00:00
Dominik Vogt ad7ab32ed4 PR target/78748: S/390: Fix ICE with ANDC splitter.
gcc/ChangeLog:

2016-12-19  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	PR target/78748
	* config/s390/s390.md ("*andc_split_<mode>"): Allow memory destination
	only if it coincides with operand 2.

gcc/testsuite/ChangeLog:

2016-12-19  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	PR target/78748
	* gcc.c-torture/compile/pr78748.c: New test.

From-SVN: r243793
2016-12-19 09:53:56 +00:00
Janus Weil 707024b2e8 re PR fortran/78848 ([OOP] ICE on writing CLASS variable with non-typebound DTIO procedure)
2016-12-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78848
	* trans-io.c (get_dtio_proc): Generate non-typebound DTIO call for class
	variables, if no typebound DTIO procedure is available.

2016-12-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78848
	* gfortran.dg/dtio_22.f90: New test.

From-SVN: r243784
2016-12-18 14:22:13 +01:00
Janus Weil 413e859cdf re PR fortran/78592 (ICE in gfc_find_specific_dtio_proc, at fortran/interface.c:4939)
2016-12-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78592
	* interfac.c (gfc_find_specific_dtio_proc): Fixup for r243005, making
	sure that the generic list is followed through until the end.

2016-12-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78592
	* gfortran.dg/dtio_21.f90: New test.

From-SVN: r243783
2016-12-18 12:03:41 +01:00
Steven G. Kargl efa84b0163 re PR fortran/78746 (charlen_03, charlen_10 ICE)
2016-12-17  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/78746
	* charlen_03.f90: Remove test. 
	* charlen_10.f90: Ditto.

From-SVN: r243778
2016-12-17 23:10:01 +00:00
Jakub Jelinek 8ccaace835 re PR sanitizer/78832 (-fcompare-debug failure (length) with -fsanitize=address)
PR sanitizer/78832
	* sanopt.c (sanitize_asan_mark_unpoison): Remove next variable, use
	continue if gsi_next should be skipped.
	(sanitize_asan_mark_poison): Remove prev variable, use continue if
	gsi_prev should be skipped.  When removing ASAN_MARK, do gsi_prev
	first and gsi_remove on a previously made copy of the iterator.

	* gcc.dg/asan/pr78832.c: New test.

From-SVN: r243777
2016-12-17 20:10:39 +01:00
Andrew Senkevich 75d727d2d0 avx512bwintrin.h: Add new k-mask intrinsics.
* config/i386/avx512bwintrin.h: Add new k-mask intrinsics.
	* config/i386/avx512dqintrin.h: Ditto.
	* config/i386/avx512fintrin.h: Ditto.
	* config/i386/i386-builtin.def (__builtin_ia32_kaddqi,
	__builtin_ia32_kaddhi, __builtin_ia32_kaddsi,
	__builtin_ia32_kadddi): New.
	* config/i386/sse.md (kadd<mode>): New.

testsuite/ChangeLog:

	* gcc.target/i386/avx512bw-kaddd-1.c: New test.
	* gcc.target/i386/avx512bw-kaddq-1.c: Ditto.
	* gcc.target/i386/avx512dq-kaddb-1.c: Ditto.
	* gcc.target/i386/avx512f-kaddw-1.c: Ditto.

From-SVN: r243774
2016-12-17 12:42:05 +01:00
Thomas Koenig 52fd48aeea re PR fortran/78239 (ICE in char_len_param_value, at fortran/decl.c:926, with -fimplicit-none)
2016-12-17  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78239
	* decl.c(char_len_param_value): Also check for -fimplicit-none
	when determining if implicit none is in force.

2016-12-17  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78239
	* gfortran.dg/fimplicit_none_1.f90:  New test.
	* gfortran.dg/fimplicit_none_2.f90:  New test.

From-SVN: r243773
2016-12-17 11:13:16 +00:00
Kelvin Nilsen 6040f6d497 byte-in-either-range-0.c: New test.
gcc/testsuite/ChangeLog:

2016-12-16  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	* gcc.target/powerpc/byte-in-either-range-0.c: New test.
	* gcc.target/powerpc/byte-in-either-range-1.c: New test.
	* gcc.target/powerpc/byte-in-range-0.c: New test.
	* gcc.target/powerpc/byte-in-range-1.c: New test.
	* gcc.target/powerpc/byte-in-set-0.c: New test.
	* gcc.target/powerpc/byte-in-set-1.c: New test.
	* gcc.target/powerpc/byte-in-set-2.c: New test.


gcc/ChangeLog:

2016-12-16  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	* config/rs6000/altivec.md (UNSPEC_CMPRB): New unspec value.
	(UNSPEC_CMPRB2): New unspec value.
	(UNSPEC_CMPEQB): New unspec value.
	(cmprb): New expansion.
	(*cmprb_internal): New insn.
	(*setb_internal): New insn.
	(cmprb2): New expansion.
	(*cmprb2_internal): New insn.
	(cmpeqb): New expansion.
	(*cmpeqb_internal): New insn.
	* config/rs6000/rs6000-builtin.def (BU_P9_2): New macro.
	(BU_P9_64BIT_2): Likewise.
	(BU_P9_OVERLOAD_2): Likewise.
	(CMPRB): Add byte-in-range built-in function.
	(CMBRB2): Add byte-in-either-range built-in function.
	(CMPEQB): Add byte-in-set built-in function.
	(CMPRB): Add overload support for byte-in-range function.
	(CMPRB2): Add overload support for byte-in-either-range function.
	(CMPEQB): Add overload support for byte-in-set built-in function.
	* config/rs6000/rs6000-c.c (P9_BUILTIN_CMPRB): Macro expansion to
	define argument types for new builtin. 
	(P9_BUILTIN_CMPRB2): Likewise.
	(P9_BUILTIN_CMPEQB): Likewise.
	* doc/extend.texi (PowerPC AltiVec Built-in Functions): Rearrange
	the order of presentation for certain built-in functions
	(scalar_extract_exp, scalar_extract_sig, scalar_insert_exp)
	(scalar_cmp_exp_gt, scalar_cmp_exp_lt, scalar_cmp_exp_eq)
	(scalar_cmp_exp_unordered, scalar_test_data_class)
	(scalar_test_neg) to improve locality and flow.  Document
	the new __builtin_scalar_byte_in_set,
	__builtin_scalar_byte_in_range, and
	__builtin_scalar_byte_in_either_range functions.

From-SVN: r243770
2016-12-17 00:18:32 +00:00
Jerry DeLisle 5cdc4b0ef0 re PR fortran/78662 ([F03] Incorrect parsing of quotes in the char-literal-constant of the DT data descriptor)
2016-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/78622
	* io.c (format_lex): Continue of string delimiter seen.

	* io/transfer.c (get_dt_format): New static function to alloc
	and set the DT iotype string, handling doubled quotes.
	(formatted_transfer_scalar_read,
	formatted_transfer_scalar_write): Use new function.

	* gfortran.dg/dtio_20.f03: New test.

From-SVN: r243765
2016-12-16 20:27:51 +00:00
Jakub Jelinek c2d42d1619 re PR fortran/78757 (ICE with function returning a pointer to a character)
PR fortran/78757
	* trans-expr.c (gfc_conv_procedure_call): Emit DECL_EXPR for the
	type pstr var points to.

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

From-SVN: r243761
2016-12-16 20:41:13 +01:00
Kyrylo Tkachov 680153bd1e [AArch64] Split X-reg UBFIZ into W-reg LSL when possible
* config/aarch64/aarch64.md: New define_split above bswap<mode>2.

	* gcc.target/aarch64/ubfiz_lsl_1.c: New test.

From-SVN: r243756
2016-12-16 16:26:08 +00:00
Kyrylo Tkachov bcb036c515 [AArch64] Split X-reg UBFX into W-reg LSR when possible
* config/aarch64/aarch64.md: New define_split above insv<mode>.

	* gcc.target/aarch64/ubfx_lsr_1.c: New test.

From-SVN: r243755
2016-12-16 16:24:26 +00:00
Jakub Jelinek 7b45d0dfeb re PR c/78408 (C loop initial declarations generate wrong code)
PR c/78408
	* tree-ssa-ccp.c: Include tree-dfa.h.
	(optimize_memcpy): New function.
	(pass_fold_builtins::execute): Use it.  Remove useless conditional
	break after BUILT_IN_VA_*.

	* gcc.dg/pr78408-1.c: New test.
	* gcc.dg/pr78408-2.c: New test.

From-SVN: r243753
2016-12-16 16:57:43 +01:00
Marek Polacek 6b520e8d4a re PR tree-optimization/78819 (Wrong code with VRP caused by register assertions along default switch labels)
PR tree-optimization/78819
	* tree-vrp.c (find_switch_asserts): Return if the insertion limit is 0.
	Don't register an assertion if the default case shares a label with
	another case.

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

From-SVN: r243746
2016-12-16 14:19:44 +00:00
Eric Botcazou cc0ca4999b opt61.adb: New test.
* gnat.dg/opt61.adb: New test.
	* gnat.dg/opt61_pkg.ad[sb]: New helper.

From-SVN: r243740
2016-12-16 12:21:45 +00:00
Richard Biener b7fc43d7c7 re PR c++/71694 (store-data race with bitfields and tail-padding in C++)
2016-12-16  Richard Biener  <rguenther@suse.de>

	PR c++/71694
	* langhooks-def.h (lhd_unit_size_without_reusable_padding): Declare.
	(LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING): Define.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Adjust.
	* langhooks.h (struct lang_hooks_for_types): Add
	unit_size_without_reusable_padding.
	* langhooks.c (lhd_unit_size_without_reusable_padding): New.
	* stor-layout.c (finish_bitfield_representative): Use
	unit_size_without_reusable_padding langhook to decide on the
	last representatives size.

	cp/
	* cp-objcp-common.h (cp_unit_size_without_reusable_padding): Declare.
	(LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING): Define.
	* cp-objcp-common.c (cp_unit_size_without_reusable_padding): New.

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

From-SVN: r243738
2016-12-16 09:40:03 +00:00
Richard Biener c4d5c5e6ac re PR middle-end/71632 (hang at -O3 on x86_64-linux-gnu)
2016-12-16  Richard Biener  <rguenther@suse.de>

	PR middle-end/71632
	* expr.c (expand_cond_expr_using_cmove): Bail out early if
	we end up recursing via TER.

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

From-SVN: r243737
2016-12-16 09:38:18 +00:00
Andrew Senkevich 7cdb6e4c68 avx512bwintrin.h: Add new k-mask intrinsics.
* config/i386/avx512bwintrin.h: Add new k-mask intrinsics.
	* config/i386/avx512dqintrin.h: Ditto.
	* config/i386/avx512fintrin.h: Ditto.
	* config/i386/i386-builtin.def (__builtin_ia32_kmovb,
	__builtin_ia32_kmovd, __builtin_ia32_kmovq): New.
	(__builtin_ia32_kmov16): Rename to __builtin_ia32_kmovw.
	* config/i386/sse.md (kmov<mskmodesuffix>): New.

testsuite/ChangeLog:

	* gcc.target/i386/avx512bw-kmovd-1.c: New test.
	* gcc.target/i386/avx512bw-kmovd-2.c: Ditto.
	* gcc.target/i386/avx512bw-kmovd-3.c: Ditto.
	* gcc.target/i386/avx512bw-kmovd-4.c: Ditto.
	* gcc.target/i386/avx512bw-kmovq-1.c: Ditto.
	* gcc.target/i386/avx512bw-kmovq-2.c: Ditto.
	* gcc.target/i386/avx512bw-kmovq-3.c: Ditto.
	* gcc.target/i386/avx512bw-kmovq-4.c: Ditto.
	* gcc.target/i386/avx512dq-kmovb-2.c: Ditto.
	* gcc.target/i386/avx512dq-kmovb-3.c: Ditto.
	* gcc.target/i386/avx512dq-kmovb-4.c: Ditto.
	* gcc.target/i386/avx512dq-kmovb-5.c: Ditto.
	* gcc.target/i386/avx512f-kmovw-2.c: Ditto.
	* gcc.target/i386/avx512f-kmovw-3.c: Ditto.
	* gcc.target/i386/avx512f-kmovw-4.c: Ditto.
	* gcc.target/i386/avx512f-kmovw-5.c: Ditto.

From-SVN: r243728
2016-12-15 23:39:33 +01:00
Jakub Jelinek ce7888dae8 P0490R0 GB 20: decomposition declaration should commit to tuple interpretation early
P0490R0 GB 20: decomposition declaration should commit to tuple
	interpretation early
	* decl.c (get_tuple_size): Make static.  If inst is error_mark_node
	or non-complete type, return NULL_TREE, otherwise if
	lookup_qualified_name fails or doesn't fold into INTEGER_CST, return
	error_mark_node.
	(get_tuple_element_type, get_tuple_decomp_init): Make static.
	(cp_finish_decomp): Pass LOC to get_tuple_size.  If it returns
	error_mark_node, complain and fail.

	* g++.dg/cpp1z/decomp10.C (f1): Adjust expected diagnostics.

From-SVN: r243724
2016-12-15 21:42:11 +01:00
Nathan Sidwell 2a810dedce re PR c++/77585 (g++ incorrectly decides that member function is called without object in generic lambda)
PR c++/77585
	* pt.c (instantiate_decl): Push to class scope lambda resides
	within when instantiating a generic lambda function.

	PR c++/77585
	* g++.dg/cpp1y/pr77585.C: New.

From-SVN: r243723
2016-12-15 19:50:25 +00:00
David Edelsohn 1df8dcfeee ssa-fre-55.c: Add -Wno-psabi.
* gcc.dg/tree-ssa/ssa-fre-55.c: Add -Wno-psabi.
        * gcc.dg/tree-ssa/pr71179.c: Same.

From-SVN: r243694
2016-12-15 10:15:35 -05:00
Janus Weil fec5ce2485 re PR fortran/78800 ([OOP] ICE in compare_parameter, at fortran/interface.c:2246)
2016-12-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78800
	* interface.c (compare_allocatable): Avoid additional errors on bad
	class declarations.
	(compare_parameter): Put the result of gfc_expr_attr into a variable,
	in order to avoid calling it multiple times. Exit early on bad class
	declarations to avoid ICE.

2016-12-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78800
	* gfortran.dg/unlimited_polymorphic_27.f90: New test case.

From-SVN: r243691
2016-12-15 15:07:51 +01:00
Toma Tabacu a5aa934d0f MIPS: Upgrade to R2 for -mmicromips.
gcc/testsuite

	* gcc.target/mips/mips.exp (mips-dg-options): Upgrade to R2 for
	-mmicromips.

From-SVN: r243687
2016-12-15 10:22:20 +00:00
Jakub Jelinek 8e22bda9f9 forwprop-35.c: Use -Wno-psabi everywhere.
* gcc.dg/tree-ssa/forwprop-35.c: Use -Wno-psabi everywhere.
	* gcc.dg/torture/pr78515.c: Likewise.
	* gcc.dg/pr69634.c: Likewise.

From-SVN: r243686
2016-12-15 09:22:05 +01:00
Martin Sebor 2c8c83ac77 PR middle-end/78519 - missing warning for sprintf %s with null pointer
gcc/ChangeLog:

	PR middle-end/78519
	* gimple-ssa-sprintf.c (format_string): Handle null pointers.
	(format_directive): Diagnose null pointer arguments.
	(pass_sprintf_length::handle_gimple_call): Diagnose null destination
	pointers.  Correct location of null format string in diagnostics.

gcc/testsuite/ChangeLog:

	PR middle-end/78519
	* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: New test.

From-SVN: r243684
2016-12-14 21:35:31 -07:00
Martin Sebor 1750f2a55a PR c++/78774 - [6/7 Regression] ICE in constexpr string literals and templates
gcc/cp/ChangeLog:

	PR c++/78774
	* pt.c (convert_template_argument): Avoid assuming operand type
	is non-null since that of SCOPE_REF is not.

gcc/testsuite/ChangeLog:

	PR c++/78774
	* g++.dg/cpp1y/pr78774.C: New test.

From-SVN: r243683
2016-12-14 20:08:14 -07:00
David Malcolm ecfc21ff34 Introduce selftest::locate_file
gcc/ChangeLog:
	* Makefile.in (SELFTEST_FLAGS): Add path argument to -fself-test.
	(s-selftest): Add dependency on the selftests data directory.
	* common.opt (fself-test): Rename to...
	(fself-test=): ...this, documenting the meaning of the argument.
	* selftest-run-tests.c (along): Likewise.
	* selftest-run-tests.c: Include "options.h".
	(selftest::run_tests): Initialize selftest::path_to_selftest_files
	from flag_self_test.
	* selftest.c (selftest::path_to_selftest_files): New global.
	(selftest::locate_file): New function.
	(selftest::test_locate_file): New function.
	(selftest_c_tests): Likewise.
	(selftest::selftest_c_tests): Call test_locate_file.
	* selftest.h (selftest::locate_file): New decl.
	(selftest::path_to_selftest_files): New decl.

gcc/testsuite/ChangeLog:
	PR target/78213
	* gcc.dg/cpp/pr71591.c: Add a fake value for the argument of
	-fself-test.
	* gcc.dg/pr78213.c: Disable this test.
	* selftests/example.txt: New file.

From-SVN: r243681
2016-12-15 01:47:48 +00:00
Martin Sebor cfce1a4a42 PR middle-end/78786 - GCC hangs/out of memory calling sprintf with large precision
gcc/ChangeLog:

	PR middle-end/78786
	* gimple-ssa-sprintf.c (target_dir_max): New macro.
	(get_mpfr_format_length): New function.
	(format_integer): Use HOST_WIDE_INT instead of int.
	(format_floating_max): Same.
	(format_floating): Call get_mpfr_format_length.
	(format_directive): Use target_dir_max.

gcc/testsuite/ChangeLog:

	PR middle-end/78786
	* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: New test.

From-SVN: r243672
2016-12-14 14:58:19 -07:00
Jakub Jelinek 8000827901 re PR target/78791 (ACATS cxf2001 failure)
PR target/78791
	* config/i386/i386.h (enum ix86_stack_slot): Add SLOT_STV_TEMP.
	* config/i386/i386.c (dimode_scalar_chain::make_vector_copies,
	dimode_scalar_chain::convert_reg): Use SLOT_STV_TEMP instead of
	SLOT_TEMP.

	* gcc.c-torture/execute/pr78791.c: New test.
	* gcc.target/i386/pr78791.c: New test.

From-SVN: r243671
2016-12-14 22:39:51 +01:00
Marek Polacek 964b79eb33 re PR c++/72775 (internal compiler error: in finish_expr_stmt, at cp/semantics.c:677)
PR c++/72775
	* init.c (perform_member_init): Diagnose member initializer for
	flexible array member. 

	* g++.dg/ext/flexary12.C: Adjust dg-error.
	* g++.dg/ext/flexary20.C: New.
	* g++.dg/ext/flexary21.C: New.

From-SVN: r243669
2016-12-14 20:41:43 +00:00
Uros Bizjak cc99421ec4 re PR target/59874 (Missing builtin (__builtin_clzs) when compiling with g++)
PR target/59874
	* config/i386/i386-builtin.def: Add __builtin_clzs and __builtin_ctzs.
	(ix86_fold_builtin): Handle IX86_BUILTIN_CTZS and IX86_BUILTIN_CLZS.
	* config/i386/i386.md (*ctzhi2): New insn_and_split pattern.
	(*clzhi2): Ditto.

testsuite/ChangeLog

	PR target/59874
	* gcc.target/i386/pr59874-1.c: New test.
	* gcc.target/i386/pr59874-2.c: Ditto.

From-SVN: r243668
2016-12-14 21:27:06 +01:00
David Edelsohn d3cab14ab3 pr78515.c: Add -Wno-psabi for AIX.
* gcc.dg/torture/pr78515.c: Add -Wno-psabi for AIX.
        * gcc.dg/tree-ssa/forwprop-35.c: Add -Wno-psabi for AIX.
        * gcc.dg/pr69634.c: Add -Wno-psabi for AIX.

From-SVN: r243666
2016-12-14 14:53:51 -05:00
Jakub Jelinek 53cfcb2e28 re PR debug/77844 (Compilation of simple C++ example exhaust memory)
PR debug/77844
	* valtrack.c: Include rtl-iter.h.
	(struct rtx_subst_pair): Add insn field.
	(propagate_for_debug_subst): If pair->to contains at least 2
	regs, create a DEBUG_INSN with a debug temp before pair->insn
	and replace from with the debug temp instead of pair->to.
	(propagate_for_debug): Initialize p.insn.
	* combine.c (insn_uid_check): New inline function.
	(INSN_COST, LOG_LINKS): Use it instead of INSN_UID.
	(find_single_use, combine_instructions,
	cant_combine_insn_p, try_combine): Use NONDEBUG_INSN_P instead of
	INSN_P.

	* g++.dg/opt/pr77844.C: New test.

From-SVN: r243662
2016-12-14 20:40:05 +01:00
Martin Sebor 474da67ef9 PR c/78673 - sprintf missing attribute nonnull on destination argument
PR c/78673 - sprintf missing attribute nonnull on destination argument
PR c/17308 - nonnull attribute not as useful as it could be

gcc/ChangeLog:

	PR c/17308
	* builtin-attrs.def (ATTR_NONNULL_1_1, ATTR_NONNULL_1_2): Defined.
	(ATTR_NONNULL_1_3, ATTR_NONNULL_1_4, ATTR_NONNULL_1_5): Same.
	(ATTR_NOTHROW_NONNULL_1_1, ATTR_NOTHROW_NONNULL_1_2): Same.
	(ATTR_NOTHROW_NONNULL_1_3, ATTR_NOTHROW_NONNULL_1_4): Same.
	(ATTR_NOTHROW_NONNULL_1_5): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_1_2): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_2_0): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_2_3): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_3_0): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_3_4): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_4_0): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_4_5): Same.
	* builtins.c (validate_arg): Add argument.  Treat null pointers
	passed to nonnull arguments as invalid.
	(validate_arglist): Same.
	* builtins.def (fprintf, fprintf_unlocked): Add nonnull attribute.
	(printf, printf_unlocked, sprintf. vfprintf, vsprintf): Same.
	(__sprintf_chk, __vsprintf_chk, __fprintf_chk, __vfprintf_chk): Same.
	* calls.c (get_nonnull_ags, maybe_warn_null_arg): New functions.
	(initialize_argument_information): Diagnose null pointers passed to
	arguments declared nonnull.
	* calls.h (get_nonnull_args): Declared.

gcc/c-family/ChangeLog:

	PR c/17308
	* c-common.c (check_nonnull_arg): Disable when optimization
	is enabled.

gcc/testsuite/ChangeLog:

	PR c/17308
	* gcc.dg/builtins-nonnull.c: New test.
	* gcc.dg/nonnull-4.c: New test.

From-SVN: r243661
2016-12-14 10:23:16 -07:00
Nathan Sidwell b4ba085209 re PR c++/78701 (ICE: unexpected expression N of kind template_parm_index)
PR c++/78701
	* pt.c (type_unification_real): Check tsubst arg doesn't have
	remaining template parms before converting it.

	PR c++/78701
	* g++.dg/cpp0x/pr78701.C: New.

From-SVN: r243657
2016-12-14 16:45:33 +00:00
Michael Meissner 16370e798c rs6000.c (rs6000_split_vec_extract_var): On ISA 3.0/power9, add support to use the VEXTU{B,H,W}{L,R}X extract instructions.
[gcc]
2016-12-14  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config/rs6000/rs6000.c (rs6000_split_vec_extract_var): On ISA
	3.0/power9, add support to use the VEXTU{B,H,W}{L,R}X extract
	instructions.
	* config/rs6000/vsx.md (VSr2): Add IEEE 128-bit floating point
	type constraint registers.
	(VSr3): Likewise.
	(FL_CONV): New mode iterator for binary floating types that have a
	direct conversion from 64-bit integer to floating point.
	(vsx_extract_<mode>_p9): Add support for the ISA 3.0/power9
	VEXTU{B,H,W}{L,R}X extract instructions.
	(vsx_extract_<mode>_p9 splitter): Add splitter to load up the
	extract byte position into the GPR if we are using the
	VEXTU{B,H,W}{L,R}X extract instructions.
	(vsx_extract_<mode>_di_p9): Support extracts to GPRs.
	(vsx_extract_<mode>_store_p9): Support extracting to GPRs so that
	we can use reg+offset address instructions.
	(vsx_extract_<mode>_var): Support extracts to GPRs.
	(vsx_extract_<VSX_EXTRACT_I:mode>_<SDI:mode>_var): New combiner
	insn to combine vector extracts with zero_extend.
	(vsx_ext_<VSX_EXTRACT_I:VS_scalar>_fl_<FL_CONV:mode>): Optimize
	extracting a small integer vector element and converting it to a
	floating point type.
	(vsx_ext_<VSX_EXTRACT_I:VS_scalar>_ufl_<FL_CONV:mode>): Likewise.
	(UNSPEC_XXEXTRACTUW): New unspec.
	(UNSPEC_XXINSERTW): Likewise.
	(vextract4b): Add support for the vec_vextract4b built-in
	function.
	(vextract4b_internal): Likewise.
	(vinsert4b): Add support for the vec_insert4b built-in function.
	Include both a version that inserts element 1 from a V4SI object
	and one that inserts a DI object.
	(vinsert4b_internal): Likewise.
	(vinsert4b_di): Likewise.
	(vinsert4b_di_internal): Likewise.
	* config/rs6000/predicates.md (const_0_to_11_operand): New
	predicate, match 0..11.
	* config/rs6000/rs6000-builtin.def (BU_P9V_VSX_3): Set built-in
	type to ternary, not binary.
	(BU_P9V_64BIT_VSX_3): Likewise.
	(P9V_BUILTIN_VEXTRACT4B): Add support for vec_vinsert4b and
	vec_extract4b non-overloaded built-in functions.
	(P9V_BUILTIN_VINSERT4B): Likewise.
	(P9V_BUILTIN_VINSERT4B_DI): Likewise.
	(P9V_BUILTIN_VEC_VEXTULX): Move to section that adds 2 operand ISA
	3.0 built-in functions.
	(P9V_BUILTIN_VEC_VEXTURX): Likewise.
	(P9V_BUILTIN_VEC_VEXTRACT4B): Add support for overloaded
	vec_insert4b and vec_extract4 built-in functions.
	(P9V_BUILTIN_VEC_VINSERT4B): Likewise.
	* config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
	overloaded support for vec_vinsert4b and vec_extract4b.
	* config/rs6000/rs6000.c (altivec_expand_builtin): Add checks for
	the vec_insert4b and vec_extract4b byte number being a constant in
	the range 0..11.
	* config/rs6000/altivec.h (vec_vinsert4b): Support vec_vinsert4b
	and vec_extract4b built-in functions.
	* doc/extend.doc (PowerPC VSX built-in functions): Document
	vec_insert4b and vec_extract4b.

[gcc/testsuite]
2016-12-14  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* gcc/testsuite/gcc.target/powerpc/vec-extract.h: If DO_TRACE is
	defined, add tracing of the various extracts to stderr.  Add
	support for tests that convert the result to another type.
	* gcc/testsuite/gcc.target/powerpc/vec-extract-v2df.c: Likewise.
	* gcc/testsuite/gcc.target/powerpc/vec-extract-v4sf.c: Likewise.
	* gcc/testsuite/gcc.target/powerpc/vec-extract-v4si-df.c: Add new
	tests that do an extract and then convert the values double.
	* gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu-df.c: Likewise.
	* gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-df.c: Likewise.
	* gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi-df.c: Likewise.
	* gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu-df.c: Likewise.
	* gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi-df.c: Likewise.
	* gcc.target/powerpc/p9-extract-1.c: Update test to check for
	VEXTU{B,H,W}{L,R}X instructions being generated by default instead
	of VEXTRACTU{B,H} and XXEXTRACTUW.
	* gcc.target/powerpc/p9-extract-3.c: New test for combination of
	vec_extract and convert to floating point.
	* gcc.target/powerpc/p9-vinsert4b-1.c: New test for vec_vinsert4b
	and vec_extract4b.
	* gcc.target/powerpc/p9-vinsert4b-2.c: Likewise.

From-SVN: r243653
2016-12-14 16:08:07 +00:00
Toma Tabacu 54601417ce MIPS: Remove redundant dg-skip-if from mips16-attributes.c.
gcc/testsuite

	* gcc.target/mips/mips16-attributes.c: Remove dg-skip-if for
	-mmicromips.

From-SVN: r243649
2016-12-14 14:44:14 +00:00
Andre Vehreschild 8c92e4522d re PR fortran/78780 ([Coarray] ICE in conv_caf_send, at fortran/trans-intrinsic.c:1936)
gcc/testsuite/ChangeLog:

2016-12-14  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78780
	* gfortran.dg/coarray/alloc_comp_5.f90: New test.
	* gfortran.dg/coarray_42.f90: New test.


gcc/fortran/ChangeLog:

2016-12-14  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/78780
	* trans-expr.c (gfc_trans_assignment_1): Improve check whether detour
	caf-runtime routines is needed.

From-SVN: r243648
2016-12-14 13:49:45 +01:00
Jakub Jelinek e397febfb8 re PR target/78796 (TLS fails to link on aarch64 with -mcmodel=large)
PR target/78796
	* gcc.dg/tls/pr78796.c: New test.

From-SVN: r243645
2016-12-14 11:39:36 +01:00
Richard Biener 007e18eb1f re PR tree-optimization/78731 (Possible bug with switch when optimization is turned on.)
2016-12-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78731
	* gcc.dg/torture/pr78731.c: New testcase.

From-SVN: r243644
2016-12-14 10:35:11 +00:00
Martin Liska e19ef86d01 Print 2 digits after decimal delimiter for BB frequencies
* gimple-pretty-print.c (dump_probability): New function.
	(dump_edge_probability): Use the function.
	(dump_gimple_label): Likewise.
	(dump_gimple_bb_header): Likewise.
	* gcc.dg/tree-ssa/20040703-1.c: Update scanned pattern.
	* gcc.dg/tree-ssa/dump-2.c: Likewise.

From-SVN: r243643
2016-12-14 10:33:10 +00:00
Toma Tabacu 998f4f30ea MIPS: Force assembly output for msa-builtins-err.c.
gcc/testsuite

	* gcc.target/mips/msa-builtins-err.c (dg-options): Add 
	-ffat-lto-objects option.

From-SVN: r243639
2016-12-14 10:19:01 +00:00
Prathamesh Kulkarni 3b1970cb3c tree-ssa-strlen.c (fold_strstr_to_memcmp): New function.
2016-12-14  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
	    Jakub Jelinek  <jakub@redhat.com>

	* tree-ssa-strlen.c (fold_strstr_to_memcmp): New function.
	(strlen_optimize_stmt): Call fold_strstr_to_memcmp.

testsuite/
	* gcc.dg/strlenopt-30.c: New test-case.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r243633
2016-12-14 09:10:31 +00:00
Richard Biener 253c0172bb re PR tree-optimization/78788 (ICE (segfault) on s390x-linux-gnu)
2016-12-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78788
	* tree-vrp.c (set_value_range): Allow [-INF(OVF), +INF(OVF)].
	(set_and_canonicalize_value_range): Do not drop the above to
	VARYING.

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

From-SVN: r243631
2016-12-14 08:33:12 +00:00
Nathan Sidwell 5bfd81e715 re PR c++/69481 (ICE with C++11 alias using with templates)
cp/
	PR c++/69481
	* cp-tree.h (TYPE_TEMPLATE_INFO): Remove alias type checking.
	(TYPE_ALIAS_TEMPLATE_INFO): New.
	(TYPE_TEMPLATE_INFO_MAYBE_ALIAS): New.  Use those macros.
	* error.c (dump_alias_template_specialization): Adjust.
	* pt.c (maybe_process_partial_specialization)
	iterative_has_template_arg, find_parameter_packs_r,
	alias_template_specialization_p, dependent_alias_template_spec_p,
	get_underlying_template, lookup_template_class_1, unify): Adjust
	template using decl access.

	testsuite/
	PR c++/69481
	* g++.dg/cpp0x/pr69481.C: New.
(--This line, and those below, will be ignored--

M    gcc/testsuite/ChangeLog
A    gcc/testsuite/g++.dg/cpp0x/pr69481.C
M    gcc/cp/cp-tree.h
M    gcc/cp/error.c
M    gcc/cp/ChangeLog
M    gcc/cp/pt.c

From-SVN: r243624
2016-12-13 20:43:08 +00:00
Uros Bizjak 80e66af3c8 re PR target/78794 (We noticed ~9% regression in 32-bit mode for 462.libquntum on Avoton after r243202)
PR target/78794
	* config/i386/i386.c (dimode_scalar_chain::compute_convert_gain):
	Calculate additional gain for andnot for targets without BMI.

testsuite/ChangeLog:

	PR target/78794
	* gcc.target/i386/pr78794.c: New test.

From-SVN: r243615
2016-12-13 18:15:35 +01:00
Andre Vehreschild 6479f45b31 re PR fortran/77785 ([Coarray] ICE in gfc_get_caf_token_offset, at fortran/trans-expr.c:1990)
gcc/fortran/ChangeLog:

2016-12-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/77785
	* resolve.c (resolve_symbol): Correct attr lookup to the _data
	component.
	* trans-array.c (gfc_alloc_allocatable_for_assignment): Indirect ref
	pointers and references before retrieving the caf-token.

gcc/testsuite/ChangeLog:

2016-12-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/77785
	* gfortran.dg/coarray_38.f90: Added expecting error message.
	* gfortran.dg/coarray_41.f90: New test.
	* gfortran.dg/coarray_class_2.f90: New test.

From-SVN: r243614
2016-12-13 17:47:48 +01:00
Carl Love b37a5b979a rs6000-c.c: Add built-in support for vector float vec_pack (vector double...
gcc/ChangeLog:

2016-12-13  Carl Love  <cel@us.ibm.com>

   * config/rs6000/rs6000-c.c: Add built-in support for
   vector float vec_pack (vector double, vector double)
   vector double vec_sld (vector double, vector double)
   * config/rs6000/rs6000.c: Add icode check for vsldoi_v2df to allow
   4-bit unsigned literal.
   * config/rs6000/rs6000-builtin.def: Add definition for VSLDOI_2DF
   * doc/extend.texi: Update the built-in documentation file for the
   new powerpc vec_pack and vec_sld built-ins.

gcc/testsuite/ChangeLog:

2016-12-13 Carl Love  <cel@us.ibm.com>

	* gcc.target/powerpc/builtins-3.c: Add new test of the test suite
	file.
	* gcc.target/powerpc/builtins-3-p8.c: Add new test of the test suite
	file.

From-SVN: r243612
2016-12-13 16:18:36 +00:00
Martin Liska 437df9f9d1 Fill bitregion_{start,end} in store_constructor (PR tree-optimization/78428)
* expr.c (store_constructor_field): Add new arguments to the
	function.
	(store_constructor): Set up bitregion_end and add
	gcc_unreachable to fields that have either non-constant size
	or (and) offset.
	* gcc.dg/tree-ssa/pr78428.c: New test.

From-SVN: r243610
2016-12-13 15:26:14 +00:00
Janus Weil e4e659b947 re PR fortran/78737 ([OOP] linking error with deferred, undefined user-defined derived-type I/O)
2016-12-13  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/78737
	* gfortran.h (gfc_find_typebound_dtio_proc): New prototype.
	* interface.c (gfc_compare_interfaces): Whitespace fix.
	(gfc_find_typebound_dtio_proc): New function.
	(gfc_find_specific_dtio_proc): Use it. Improve error recovery.
	* trans-io.c (get_dtio_proc): Implement polymorphic calls to DTIO
	procedures.

2016-12-13  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/78737
	* gfortran.dg/dtio_19.f90: New test case.

Co-Authored-By: Paul Thomas <pault@gcc.gnu.org>

From-SVN: r243609
2016-12-13 15:28:17 +01:00
Michael Matz 9042295c44 Fix pr78725
PR tree-optimization/78725
	* tree-ssa-loop-split.c (split_at_bb_p): Check for overflow and
	at correct use point.

testsuite/
	PR tree-optimization/78725
	* gcc.dg/pr78725.c: New test.
	* gcc.dg/pr78725-2.c: New test.

From-SVN: r243606
2016-12-13 14:14:41 +00:00
Richard Biener 6182121c12 re PR tree-optimization/78742 (internal compiler error: in int_cst_value, at tree.c:10782)
2016-12-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/78742
	* tree.c (cst_and_fits_in_hwi): Look if the actual value fits.
	* tree-object-size.c (compute_builtin_object_size): Use
	tree_fits_shwi_p.
	* tree-data-ref.c (initialize_matrix_A): Remove excess assert.

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

From-SVN: r243598
2016-12-13 09:17:42 +00:00
Martin Liska 56b7aede91 Add pretty printer for ASAN_MARK and add a helper fn
* asan.c (asan_mark_poison_p): Remove.
	(asan_mark_p): New function.
	(transform_statements): Use the function.
	(asan_expand_mark_ifn): Do not use masked enum.
	* asan.h (enum asan_mark_flags): Declare it via a macro.
	* gimple-pretty-print.c (dump_gimple_call_args): Dump first
	argument of ASAN_MARK.
	* gimplify.c (build_asan_poison_call_expr): Use new enum values.
	(asan_poison_variable): Likewise.
	* gcc.dg/asan/use-after-scope-goto-1.c: Update first argument of
	scanned pattern ASAN_MARK.
	* gcc.dg/asan/use-after-scope-goto-2.c: Likewise.
	* gcc.dg/asan/use-after-scope-switch-1.c: Likewise.
	* gcc.dg/asan/use-after-scope-switch-2.c: Likewise.
	* gcc.dg/asan/use-after-scope-switch-3.c: Likewise.

From-SVN: r243597
2016-12-13 09:14:47 +00:00
Jakub Jelinek cd6d518b29 re PR ipa/77905 (ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in ipa_comdats, at ipa-comdats.c:352))
PR ipa/77905
	* ipa-pure-const.c (cdtor_p): Return true for
	DECL_STATIC_{CON,DE}STRUCTOR even when it is
	DECL_LOOPING_CONST_OR_PURE_P.

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

From-SVN: r243596
2016-12-13 09:48:45 +01:00
Jakub Jelinek 1697df8c99 re PR tree-optimization/78777 (ICE in mark_reachable_handlers, at tree-eh.c:3823 (aarch64-linux-gnu))
PR tree-optimization/78777
	* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
	insert_initializers): Use stmt_ends_bb_p instead of is_ctrl_stmt.

	* g++.dg/torture/pr78777.C: New test.

From-SVN: r243584
2016-12-12 23:02:52 +01:00
Martin Sebor 573aa7d4b7 PR middle-end/78622 - -Wformat-length/-fprintf-return-value incorrect with overflow/wrapping
gcc/ChangeLog:

	PR middle-end/78622
	PR middle-end78606
	* gimple-ssa-sprintf.c (min_bytes_remaining): Use res.knownrange
	rather than res.bounded.
	(get_width_and_precision): Set precision to -1 when negative.
	(adjust_range_for_overflow): New function.
	(format_integer): Correct the handling of the space, plus, and pound
	flags, and the special case of zero precision.
	Always set res.bounded to true unless either precision or width
	is specified and unknown.
	Call adjust_range_for_overflow.
	Avoid use zero as the shortest value when precision is specified
	but unknown.
	(format_directive): Remove vestigial quoting.  Always inform of
	argument value or range when it's available.
	(add_bytes): Correct the computation of boundrange used to
	decide whether a warning is of a "maybe" or "defnitely" kind.

gcc/testsuite/ChangeLog:

	PR middle-end/78622
	PR middle-end78606
	* gcc.c-torture/execute/pr78622.c: New test.
	* gcc.dg/tree-ssa/builtin-sprintf-2.c: Remove "benign" undefined
	behavior inadvertently introduced in a previous commit.  Tighten
	up final checking.
	* gcc.dg/tree-ssa/builtin-sprintf-5.c: Rename macros for clarity.
	Add test cases.
	* gcc.dg/tree-ssa/builtin-sprintf-6.c: Add test cases.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-2.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-5.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: Remove xfails and
	add a final optimization check.
	* gcc.dg/tree-ssa/builtin-sprintf.c: Add test cases.
	* gcc.dg/tree-ssa/pr78622.c: New test.

From-SVN: r243582
2016-12-12 14:56:22 -07:00
Janus Weil 068b961b6a re PR fortran/78392 (ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:5979)
2016-12-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78392
	* expr.c (gfc_is_constant_expr): Specification functions are not
	compile-time constants. Update documentation (add reference to F08
	standard), add a FIXME.
	(external_spec_function): Add reference to F08 standard.
	* resolve.c (resolve_fl_variable): Ditto.

2016-12-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/78392
	* gfortran.dg/constant_shape.f90: New test case.

From-SVN: r243580
2016-12-12 19:54:54 +01:00
Marek Polacek fe366b8715 re PR c++/78647 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected tree_list, have error_mark in get_attribute_name, at attribs.c:664))
PR c++/78647
	* c-common.c (attribute_fallthrough_p): Return false for
	error_mark_node.

	* g++.dg/parse/error58.C: New.

From-SVN: r243575
2016-12-12 17:58:00 +00:00
David Malcolm 470a60b2c4 re PR preprocessor/78680 (ICE in get_substring_ranges_for_loc, at input.c:1398)
Fix for PR preprocessor/78680

PR preprocessor/78680 identifies a crash when attempting to issue
a -Wformat warning, where the format string includes a string token
split across multiple physical source lines via backslash-continued
lines.

The issue is that libcpp is generating bogus range information for
such tokens.

For example, in:

void fn1() {
  __builtin_printf("\
     %ld.\n\
        2\n"); };

the range of the string token is printed as:

   __builtin_printf("\
                    ^~

whereas the range ought to be:

  __builtin_printf("\
                   ^~
     %ld.\n\
     ~~~~~~~
        2\n"); };
        ~~~~

The root cause is that the line notes expressing the update
of the buffer in lex.c aren't yet updated when the end-point of
the token is computed

3095	    tok_range.m_finish
3096	      = linemap_position_for_column (pfile->line_table,
3097					     CPP_BUF_COLUMN (buffer, buffer->cur));

so that the physical line is still regarded as that of the start
of the token, and, where CPP_BUF_COLUMN uses (BUF)->line_base,
line_base is still the location of the first physical line in the
and hence the column information is too large (as if it were the
offset in the *logical* line).

(the printed range is somewhat misleading; the actual buggy range
extends beyond the "\ in the line, but within diagnostic-show-locus.c
layout::print_annotation_line only prints up to the xbound set by
layout::print_source_line and so truncates most of the buggy range).

The fix is to ensure that line notes are handled before calculating
the end-point of the token range.

This leads to the range for the string token being correctly
computed, as:

  __builtin_printf("\
                   ^~
     %ld.\n\
     ~~~~~~~
        2\n"); };
        ~~~~

and this leads to get_substring_ranges_for_loc failing gracefully,
rather than crashing.

gcc/testsuite/ChangeLog:
	PR preprocessor/78680
	* gcc.dg/format/pr78680.c: New test case.
	* gcc.dg/plugin/diagnostic-test-expressions-1.c
	(test_multiline_token): New function.
	* gcc.dg/plugin/diagnostic-test-string-literals-1.c
	(test_backslash_continued_logical_lines): New function.

libcpp/ChangeLog:
	PR preprocessor/78680
	* lex.c (_cpp_lex_direct): Ensure line notes are processed before
	computing the end-point of the token.

From-SVN: r243567
2016-12-12 17:37:48 +00:00
Nathan Sidwell 8e09a726e6 re PR other/78252 (C++ demangler crashes with infinite recursion with lambda (auto))
libiberty/
	PR c++/78252
	* cp-demangle.c (struct d_print_info): Add is_lambda_arg field.
	(d_print_init): Initialize it.
	(d_print_comp_inner) <DEMANGLE_COMPONENT_TEMPLATE_PARAM>: Check
	is_lambda_arg for auto.
	<DEMANGLE_COMPONENT_REFERENCE,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE>: Skip smashing check when
	is_lambda_arg.
	<DEMANGLE_COMPONENT_LAMBDA>: Increment is_lambda_arg around arg
	printing.
	* testsuite/demangle-expected: Add lambda auto mangling cases.

	gcc/testsuite/
	PR c++/78252
	* g++.dg/cpp1y/lambda-mangle-1.C: New.

From-SVN: r243566
2016-12-12 17:00:37 +00:00
Uros Bizjak b8cab8a549 re PR target/78738 (ICE in extract_insn, at recog.c:2311)
PR target/78738
	* config/i386/i386.h (X87_ENABLE_ARITH): Also enable for
	flag_unsafe_math_optimizations.
	(X87_ENABLE_FLOAT): Ditto.

testsuite/ChangeLog:

	PR target/78738
	* gcc.target/i386/pr78738.c: New test.

From-SVN: r243559
2016-12-12 17:02:28 +01:00
Kyrylo Tkachov 39c429372b [libstdc++][testsuite] XFAIL tests relying on long double-to-string conversions on broken newlib
* lib/target-supports.exp
    (check_effective_target_newlib_broken_long_double_io): New check.
    (check_effective_target_frexpl): Likewise.

    * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc:
    XFAIL run if newlib_broken_long_double_io.
    * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc:
    Likewise.
    * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc:
    Likewise.
    * testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc:
    Likewise.

From-SVN: r243558
2016-12-12 15:47:47 +00:00
Marek Polacek 3071bfa9c3 re PR middle-end/78716 (ICE in gimplify_va_arg_expr, at gimplify.c:12650 (i686-linux-gnu))
PR middle-end/78716
	* gimplify.c (gimplify_va_arg_expr): Don't require ADDR_EXPR for
	Case 1; check POINTER_TYPE_P instead.

	* g++.dg/other/vararg-5.C: New.

From-SVN: r243553
2016-12-12 13:57:32 +00:00
Bernd Schmidt fba1216545 re PR rtl-optimization/78669 (ICE: in combine_and_move_insns, at ira.c:3665 with -Os -fno-tree-ter -mavx512bw)
PR rtl-optimization/78669
	* ira.c (combine_and_move_insns): When deleting an insn, clear the
	replace flag for all used regs in that insn.

	PR rtl-optimization/78669
	* gcc.target/i386/pr78669.c: New test.

From-SVN: r243551
2016-12-12 13:29:48 +00:00
Rainer Orth 9e9034937b Fix g++.dg/debug/dwarf2/typedef1.C
* g++.dg/debug/dwarf2/typedef1.C: Adjust pattern for last change.

From-SVN: r243544
2016-12-12 11:12:17 +00:00
Toma Tabacu 4a584d050d MIPS: Upgrade to R2 for -mnan=2008 and -mabs=2008.
gcc/testsuite/

	* gcc.target/mips/mips.exp (mips-dg-options): Upgrade to R2 for
	-mnan=2008 and -mabs=2008.

From-SVN: r243542
2016-12-12 10:12:26 +00:00
Bill Schmidt 3113e92dc3 re PR target/78695 (ICE (segfault) on powerpc64le-linux-gnu)
[gcc]

2016-12-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/78695
	* config/rs6000/rs6000.c (find_alignment_op): Discard from
	consideration any artificial definition.

[gcc/testsuite]

2016-12-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	PR target/78695
	* gcc.target/powerpc/swaps-stack-protector.c: New test.

From-SVN: r243534
2016-12-11 23:37:17 +00:00
Uros Bizjak 8c7cc1a98f re PR target/70799 (STV pass does not convert DImode shifts)
PR target/70799
	* config/i386/i386.c (dimode_scalar_to_vector_candidate_p)
	<case ASHIFT, case LSHIFTRT>: Consider all constant shifts.
	Add FIXME comment.
	(dimode_scalar_chain::compute_convert_gain): Reduce gain for
	constant shifts larger or equal than 32.

testsuite/ChangeLog:

	PR target/70799
	* gcc.target/i386/pr70799-3.c: New test.

From-SVN: r243530
2016-12-11 19:59:07 +01:00
Paolo Carlini a1f7d967aa re PR c++/78637 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in pop_namespace, at cp/name-lookup.c:3826))
/cp
2016-12-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/78637
	* parser.c (cp_parser_namespace_definition): Increment
	nested_definition_count only if push_namespace succeeds.

/testsuite
2016-12-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/78637
	* g++.dg/parse/namespace14.C: New.

From-SVN: r243529
2016-12-11 18:15:31 +00:00
Jakub Jelinek c0140e3c5d re PR tree-optimization/78720 (Illegal instruction in generated code)
PR tree-optimization/78720
	* match.pd (A < 0 ? C : 0): Only optimize for signed A.  If shift
	is negative, sign extend to @1's type and than AND with C.

	* gcc.c-torture/execute/pr78720.c: New test.

Co-Authored-By: Marc Glisse <marc.glisse@inria.fr>

From-SVN: r243516
2016-12-10 13:06:12 +01:00