Commit Graph

164657 Commits

Author SHA1 Message Date
Richard Henderson d400fda3a8 aarch64: Improve cas generation
Do not zero-extend the input to the cas for subword operations;
instead, use the appropriate zero-extending compare insns.
Correct the predicates and constraints for immediate expected operand.

	* config/aarch64/aarch64.c (aarch64_gen_compare_reg_maybe_ze): New.
	(aarch64_split_compare_and_swap): Use it.
	(aarch64_expand_compare_and_swap): Likewise.  Remove convert_modes;
	test oldval against the proper predicate.
	* config/aarch64/atomics.md (@atomic_compare_and_swap<ALLI>):
	Use nonmemory_operand for expected.
	(cas_short_expected_pred): New.
	(@aarch64_compare_and_swap<SHORT>): Use it; use "rn" not "rI" to match.
	(@aarch64_compare_and_swap<GPI>): Use "rn" not "rI" for expected.
	* config/aarch64/predicates.md (aarch64_plushi_immediate): New.
	(aarch64_plushi_operand): New.

From-SVN: r265657
2018-10-31 02:42:39 -07:00
Richard Henderson 77f33f44ba aarch64: Simplify LSE cas generation
The cas insn is a single insn, and if expanded properly need not
be split after reload.  Use the proper inputs for the insn.

	* config/aarch64/aarch64.c (aarch64_expand_compare_and_swap):
	Force oldval into the rval register for TARGET_LSE; emit the compare
	during initial expansion so that it may be deleted if unused.
	(aarch64_gen_atomic_cas): Remove.
	* config/aarch64/atomics.md (@aarch64_compare_and_swap<SHORT>_lse):
	Change =&r to +r for operand 0; use match_dup for operand 2;
	remove is_weak and mod_f operands as unused.  Drop the split
	and merge with...
	(@aarch64_atomic_cas<SHORT>): ... this pattern's output; remove.
	(@aarch64_compare_and_swap<GPI>_lse): Similarly.
	(@aarch64_atomic_cas<GPI>): Similarly.

From-SVN: r265656
2018-10-31 02:29:29 -07:00
Richard Biener 187cea947e re PR testsuite/87802 (g++.dg/vect/slp-pr87105.cc fails starting with r265522)
2018-10-31  Richard Biener  <rguenther@suse.de>

	PR testsuite/87802
	* g++.dg/vect/slp-pr87105.cc: XFAIL for strict alignment targets.

From-SVN: r265655
2018-10-31 08:48:59 +00:00
Richard Biener 1a71493d59 tree-eh.c (replace_trapping_overflow): Simplify ABS_EXPR case using ABSU_EXPR.
2018-10-31  Richard Biener  <rguenther@suse.de>

	* tree-eh.c (replace_trapping_overflow): Simplify ABS_EXPR case
	using ABSU_EXPR.

From-SVN: r265654
2018-10-31 08:10:58 +00:00
Sameera Deshpande 2e9d500e4e Add pipeline description for Qualcomm Saphira core.
From-SVN: r265653
2018-10-31 13:02:53 +05:30
GCC Administrator 8f4103c5aa Daily bump.
From-SVN: r265652
2018-10-31 00:17:19 +00:00
Thomas Koenig 0a8949a3f2 re PR fortran/85896 (ICE in gfc_convert_constant(): Unexpected type)
2018-10-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/85896
	* simplify.c (simplify_min_max): Do not convert the type of the
	return expression.

2018-10-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/85896
	* gfortran.dg/min_max_type.f90: New test.

From-SVN: r265649
2018-10-30 23:04:10 +00:00
Martin Sebor 91e3ec29af PR middle-end/87041 - -Wformat reading through null pointer on unreachable code
gcc/ChangeLog:

	PR middle-end/87041
	* gimple-ssa-sprintf.c (format_directive): Use %G to include
	inlining context.
	(sprintf_dom_walker::compute_format_length):
	Avoid setting POSUNDER4K here.
	(get_destination_size): Handle null argument values.
	(get_user_idx_format): New function.
	(sprintf_dom_walker::handle_gimple_call): Handle all printf-like
	functions, including user-defined with attribute format printf.
	Use %G to include inlining context.
	Set POSUNDER4K here.

gcc/c-family/ChangeLog:

	PR middle-end/87041
	* c-format.c (check_format_types): Avoid diagnosing null pointer
	arguments to printf-family of functions.

gcc/testsuite/ChangeLog:

	PR middle-end/87041
	* gcc.c-torture/execute/fprintf-2.c: New test.
	* gcc.c-torture/execute/printf-2.c: Same.
	* gcc.c-torture/execute/user-printf.c: Same.
	* gcc.dg/tree-ssa/builtin-fprintf-warn-1.c: Same.
	* gcc.dg/tree-ssa/builtin-printf-2.c: Same.
	* gcc.dg/tree-ssa/builtin-printf-warn-1.c: Same.
	* gcc.dg/tree-ssa/user-printf-warn-1.c: Same.

From-SVN: r265648
2018-10-30 15:58:35 -06:00
Jan Hubicka 448af20a27 * params.def (lto-partitions): Bump from 32 to 128.
From-SVN: r265647
2018-10-30 21:47:19 +00:00
Marek Polacek b5ff4f5c0d Implement P0892R2, explicit(bool).
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_explicit_bool.

	* call.c (add_template_candidate_real): Return if the declaration is
	explicit and we're only looking for non-converting constructor.
	* cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
	(DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
	(cp_decl_specifier_seq): Add explicit_specifier field.
	(build_explicit_specifier, store_explicit_specifier): Declare.
	* decl.c (grokdeclarator): Call store_explicit_specifier.
	(build_explicit_specifier): New function.
	* parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
	Parse C++20 explicit(bool).
	* pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
	(tsubst_function_decl): Handle explicit(dependent-expr).

	* g++.dg/cpp2a/explicit1.C: New test.
	* g++.dg/cpp2a/explicit10.C: New test.
	* g++.dg/cpp2a/explicit11.C: New test.
	* g++.dg/cpp2a/explicit12.C: New test.
	* g++.dg/cpp2a/explicit13.C: New test.
	* g++.dg/cpp2a/explicit2.C: New test.
	* g++.dg/cpp2a/explicit3.C: New test.
	* g++.dg/cpp2a/explicit4.C: New test.
	* g++.dg/cpp2a/explicit5.C: New test.
	* g++.dg/cpp2a/explicit6.C: New test.
	* g++.dg/cpp2a/explicit7.C: New test.
	* g++.dg/cpp2a/explicit8.C: New test.
	* g++.dg/cpp2a/explicit9.C: New test.

	* testsuite/20_util/any/cons/explicit.cc: Adjust dg-error.
	* testsuite/20_util/pair/cons/explicit_construct.cc: Likewise.
	* testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise.

From-SVN: r265641
2018-10-30 19:59:41 +00:00
Segher Boessenkool 8d42623b37 xfail ira-shrink-wrap-prep tests (PR87708)
After r265398, the ira-shrinkwrap-prep-[12].c tests fail on all
targets, because the IRA feature tested can only move hard registers
down, and we no longer have hard registers for the function parameters
at this stage.


gcc/testsuite/
	PR rtl-optimization/87708
	gcc.dg/ira-shrinkwrap-prep-1.c: xfail test.
	gcc.dg/ira-shrinkwrap-prep-2.c: xfail test.

From-SVN: r265639
2018-10-30 20:49:36 +01:00
Jan Hubicka 3487ab638e * tree.c
(free_lang_data_d, add_tree_to_fld_list, fld_worklist_push): Move
	head in file.
	(free_lang_data_in_type): Forward declare.
	(fld_type_variant_equal_p): New function.
	(fld_type_variant): New function
	(fld_incomplete_types): New hash.
	(fld_incomplete_type_of): New function
	(fld_simplfied-type): New function.
	(free_lang_data_in_decl): Add fld parameter; simplify type of FIELD_DECL
	(free_lang_data): Allocate and free fld_incomplete_type; update call
	of free_lang_data_in_decl.

From-SVN: r265638
2018-10-30 19:13:47 +00:00
Paolo Carlini 190facef83 decl.c (grokdeclarator): Use declarator->id_loc in diagnostic about flexible array members.
/cp
2018-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
	about flexible array members.

/testsuite
2018-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp1z/has-unique-obj-representations1.C: Test location too.
	* g++.dg/ext/flexarray-mangle-2.C: Likewise.
	* g++.dg/ext/flexarray-mangle.C: Likewise.
	* g++.dg/ext/flexarray-subst.C: Likewise.
	* g++.dg/ext/flexary10.C: Likewise.
	* g++.dg/ext/flexary11.C: Likewise.
	* g++.dg/ext/flexary14.C: Likewise.
	* g++.dg/ext/flexary16.C: Likewise.
	* g++.dg/ext/flexary26.C: Likewise.
	* g++.dg/ext/flexary27.C: Likewise.
	* g++.dg/ext/flexary7.C: Likewise.
	* g++.dg/ext/pr71290.C: Likewise.

From-SVN: r265636
2018-10-30 18:29:49 +00:00
Eric Botcazou 6a6e0926b2 * gcov.c (output_lines): Remove duplicate line.
From-SVN: r265634
2018-10-30 18:01:41 +00:00
Aaron Sawdey 320314dba3 rs6000.md (bswapdi2): Force address into register if not in indexed or indirect form.
2018-10-30  Aaron Sawdey  <acsawdey@linux.ibm.com>

	* config/rs6000/rs6000.md (bswapdi2): Force address into register
	if not in indexed or indirect form.
	(bswapdi2_load): Change predicate to indexed_or_indirect_operand.
	(bswapdi2_store): Ditto.
	* config/rs6000/rs6000.c (rs6000_force_indexed_or_indirect_mem): New
	helper function.
	* config/rs6000/rs6000-protos.h (rs6000_force_indexed_or_indirect_mem):
	Prototype for helper function.

From-SVN: r265632
2018-10-30 12:05:37 -05:00
Martin Sebor d2bfc447e8 extend.texi (optimize): Clarify/expand attribute documentation.
gcc/ChangeLog:

	* doc/extend.texi (optimize): Clarify/expand attribute documentation.
	(target, pragma GCC optimize, pragma GCC target): Ditto.

From-SVN: r265631
2018-10-30 09:46:07 -06:00
Jeff Law a2e0398a31 Add PR marker
From-SVN: r265628
2018-10-30 09:14:39 -06:00
Nicholas Krause 1f82422acc method-serial.cc: Mark varible as potentially unused to silence warning.
* method-serial.cc: Mark varible as potentially unused
        to silence warning.

From-SVN: r265627
2018-10-30 09:13:26 -06:00
Jonathan Wakely 0321d9fac6 PR libstdc++/87809 avoid invalid expressions in exception specifications
If the allocator isn't default constructible then checking if the
default constructor throws in an exception specification makes the
declaration invalid. Use the type trait instead.

	PR libstdc++/87809
	* include/bits/forward_list.h (_Fwd_list_impl::_Fwd_list_impl()): Use
	trait in exception-specification instead of possibly invalid
	expression.
	* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl()):
	Likewise.
	* include/bits/stl_list.h (_List_impl::_List_impl()): Likewise.
	* include/bits/stl_vector.h (_Vector_impl::_Vector_impl()): Likewise.
	* testsuite/23_containers/forward_list/cons/87809.cc: New test.
	* testsuite/23_containers/list/cons/87809.cc: New test.
	* testsuite/23_containers/vector/bool/cons/87809.cc: New test.
	* testsuite/23_containers/vector/cons/87809.cc: New test.

From-SVN: r265626
2018-10-30 14:49:43 +00:00
Jonathan Wakely c397f267f1 PR libstdc++/87784 fix dynamic_bitset::push_back
Previously the _M_Nb member was incremented before calling
_M_unchecked_set which meant that the bit being set was out of bounds.
It either set the wrong bit in an allocated word, or accessed beyond the
end of the allocated memory in the _M_w vector. The fix for the bug is
to update the _M_Nb member after using it as an index.

As an optimisation, when a new block needs to be appended the call to
_M_unchecked_set can be avoided by appending a block with the least
significant bit already set to the desired value.

	PR libstdc++/87784
	* include/tr2/dynamic_bitset (dynamic_bitset::push_back): When there
	are no unused bits in the last block, append a new block with the
	right value so the bit doesn't need to be set. Only increment size
	after setting the new bit, not before.
	* testsuite/tr2/dynamic_bitset/pr87784.cc: New test.

From-SVN: r265625
2018-10-30 14:49:32 +00:00
Paul Koning 47abbc3196 * gcc.dg/tree-ssa/attr-alias.c: Skip if no weak support.
From-SVN: r265624
2018-10-30 10:47:32 -04:00
Jonathan Wakely 3a4673e047 Fix __builtin_expect_with_probability documentation
* doc/extend.texi: Fix prototype and description of
	__builtin_expect_with_probability.

From-SVN: r265622
2018-10-30 12:17:27 +00:00
Michael Ploujnikov 7958186bea Avoid unnecessarily numbering cloned symbols.
2018-10-30  Michael Ploujnikov  <michael.ploujnikov@oracle.com>

	* cgraph.h (clone_function_name_1): Replaced by new
	  clone_function_name_numbered that takes name as string; for
	  privatize_symbol_name_1 use only.
	  (clone_function_name): Renamed to
	  clone_function_name_numbered to be explicit about numbering.
	  (clone_function_name): New two-argument function that does
	  not number its output.
	  (clone_function_name): New three-argument function that
	  takes a number to append to its output.
	* cgraphclones.c (duplicate_thunk_for_node):
	  (clone_function_name_1): Renamed.
	  (clone_function_name_numbered): Two new functions.
	  (clone_function_name): Improved documentation.
	  (cgraph_node::create_virtual_clone): Use clone_function_name_numbered.
	* config/rs6000/rs6000.c (make_resolver_func): Ditto.
	* final.c (final_scan_insn_1): Use the new clone_function_name
	  without numbering.
	* multiple_target.c (create_dispatcher_calls): Ditto.
	  (create_target_clone): Ditto.
	* omp-expand.c (grid_expand_target_grid_body): Ditto.
	* omp-low.c (create_omp_child_function_name): Ditto.
	* omp-simd-clone.c (simd_clone_create): Ditto.
	* symtab.c (simd_symtab_node::noninterposable_alias): Use the
	  new clone_function_name without numbering.
2018-10-30  Michael Ploujnikov  <michael.ploujnikov@oracle.com>

	* lto-partition.c (privatize_symbol_name_1): Use
	  clone_function_name_numbered.
2018-10-30  Michael Ploujnikov  <michael.ploujnikov@oracle.com>

	* gcc.dg/tree-prof/cold_partition_label.c: Update for cold
	  section names without numbers.
	* gcc.dg/tree-prof/section-attr-1.c: Ditto.
	* gcc.dg/tree-prof/section-attr-2.c: Ditto.
	* gcc.dg/tree-prof/section-attr-3.c: Ditto.

From-SVN: r265621
2018-10-30 11:39:29 +00:00
Richard Earnshaw 29f6f2d244 Don't allow the pool allocator to be configured to allocate zero-sized objects
PR bootstrap/87747 would have been significantly easier to track down if
the pool allocator had faulted an attempt to configure it to allocate
zero-sized objects.  Instead, this slipped through and we later hit
memory corruption when the assumed size turned out to be different to
the configured size.

While, theoretically, there might be a use case for this, it seems
unlikely to me that GCC would have such a use.  So this patch adds a
checking assert that the object size is not zero.

	* alloc-pool.h (base_pool_allocator <TBlockAllocator>::initialize):
	Assert that the allocation size is not zero.

From-SVN: r265620
2018-10-30 11:33:24 +00:00
Richard Biener 22e4f1fb6c re PR tree-optimization/87800 (CPU2006 416.gamess failed to build with LTO)
2018-10-30  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87800
	* tree-vect-slp.c (vect_build_slp_tree_2): Reject any
	non-induction or reduction PHIs.

From-SVN: r265619
2018-10-30 11:27:32 +00:00
Sameera Deshpande 8393382954 Fixes bug 87330 by invoking df_note_add_problem to recompute REG_DEAD and REG_UNUSED notes before analysis.
From-SVN: r265618
2018-10-30 16:29:37 +05:30
Rasmus Villemoes be7b071e9e libgcc: properly destroy mutexes on VxWorks
Just as one needs run-time initialization of mutexes, one needs to
destroy them properly to allow the OS to release resources associated
with the semaphore.

From-SVN: r265616
2018-10-30 08:33:04 +00:00
Martin Liska 9eeb0b97a6 Fix typo in documentation of __builtin_expect_with_probability.
2018-10-30  Martin Liska  <mliska@suse.cz>

	* doc/extend.texi: Fix typo in documentation
	of __builtin_expect_with_probability.

From-SVN: r265615
2018-10-30 08:28:48 +00:00
GCC Administrator 4267ed5195 Daily bump.
From-SVN: r265614
2018-10-30 00:16:43 +00:00
David Malcolm 3d0a539346 Fix ICE in get_substring_ranges_for_loc on __FILE__ (PR c++/87721)
PR c++/87721 reports a crash in get_substring_ranges_for_loc introduced
by r265271, my fix for PR 87562.

The new issue occurs when attempting to get a location with a string
literal inside a macro in which the first token is __FILE__ (formed via
concatenation).  Attempting to get the spelling location of __FILE__
fails, leading to NULL for start_ord_map and final_ord_map, and thus
a NULL pointer dereference.

Given that our "on-demand" substring locations approach reparses the
string literals, there isn't a good way to access the locations inside
such string literals: attempting to reparse __FILE__ fails with a
"missing open quote".

This patch applies the easy fix by gracefully rejecting the case where
the spelling locations for the start or finish give us NULL maps.

gcc/ChangeLog:
	PR c++/87721
	* input.c (get_substring_ranges_for_loc): Detect if
	linemap_resolve_location gives us a NULL map, and reject
	this case.

gcc/testsuite/ChangeLog:
	PR c++/87721
	* c-c++-common/substring-location-PR-87721.c: New test.
	* gcc.dg/plugin/diagnostic-test-string-literals-1.c: Add test for
	PR 87721.
	* gcc.dg/plugin/diagnostic_plugin_test_string_literals.c
	(test_string_literals): Fold the index arguments before checking
	for INTEGER_CST.

From-SVN: r265611
2018-10-29 23:58:34 +00:00
David Malcolm 7e2de6df10 C++: simplify output from suggest_alternatives_for
In the C++ FE, after emitting various errors about unrecognized names,
the parser can call
  suggest_alternatives_for
and/or
  suggest_alternative_in_explicit_scope.
These can issue zero or more suggestions for the unrecognized name,
or various other "note" diagnostics suggesting how to fix the problem.

For example, currently g++ emits:

t.cc:12:3: error: 'gtk_widget_showall' was not declared in this scope
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
t.cc:12:3: note: suggested alternative: 'gtk_widget_show_all'
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
   |   gtk_widget_show_all

This patch consolidates the common case when there is a single
candidate, so that the error can issue a fix-it hint directly.

This simplifies the above to:

t.cc:12:3: error: 'gtk_widget_showall' was not declared in this scope;
 did you mean 'gtk_widget_show_all'?
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
   |   gtk_widget_show_all

omitting the second "note" diagnostic.

Doing so requires changing the above "suggest_" functions so that
rather than being called after "error" and emitting a note directly,
they are called before the "error", and return a name_hint, which
can contain a suggestion and/or a deferred diagnostic.  The "single
candidate" case is handled via a suggestion, and the "multiple
candidates" case via a new subclass of deferred_diagnostic.

There was some complication due to the fact that we don't always have
enough location information to issue a fix-it hint.  Specifically,
for the case in qualified_name_lookup_error, the location is that of
the name, but the location of the qualifier prefix isn't reliably
available.  For some hints, e.g. spell-corrections, the replacement
is of the name, and for others, e.g. parent namespaces, it's for the
qualified name.  The patch addresses this by splitting this case out
into a new "suggest_alternatives_in_other_namespaces" function, for
which fix-it hints aren't issued.

Another complication is that of emitting a note when
  --param cxx-max-namespaces-for-diagnostic-help
is reached.  The patch emulates the existing behavior by emitting
the note from a deferred_diagnostic.  This potentially needs to
co-exist with another deferred_diagnostic, so it works as a decorator
around any other such deferred_diagnostic.  Doing so requires slightly
extending class name_hint.

On adding test coverage for the various cases, I discovered that
after emitting a "FOO is not a namespace-name" error, we also emit
a "expected namespace-name before" error.  The patch removes this
second error for the case where it's redundant, simplifying this case
from e.g.:

spellcheck-ns.C:10:24: error: 'inner_ms' is not a namespace-name
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
spellcheck-ns.C:10:24: note: suggested alternative: 'inner_ns'
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
   |                        inner_ns
spellcheck-ns.C:10:32: error: expected namespace-name before ';' token
10 | using namespace outer::inner_ms;
   |                                ^

to:

spellcheck-ns.C:10:24: error: 'inner_ms' is not a namespace-name;
 did you mean 'inner_ns'?
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
   |                        inner_ns

include/ChangeLog:
	* unique-ptr.h (gnu::move): Generalize so it applies to all
	lvalue references, rather than just to unique_ptr values.

gcc/c-family/ChangeLog:
	* name-hint.h (name_hint::take_deferred): New member function.

gcc/c/ChangeLog:
	* c-decl.c (implicit_decl_warning): Update "is there a suggestion"
	logic for change to name_hint::operator bool.
	(undeclared_variable): Likewise.
	* c-parser.c (c_parser_declaration_or_fndef): Likewise.
	(c_parser_parameter_declaration): Likewise.

gcc/cp/ChangeLog:
	* cp-name-hint.h: New file.
	* cp-tree.h (expr_to_string): New decl.
	(suggest_alternatives_for): Move to cp-name-hint.h, changing
	return type from bool to name_hint.
	(suggest_alternative_in_explicit_scope): Likewise.
	* error.c: Define INCLUDE_UNIQUE_PTR.  Include "cp-name-hint.h".
	(expr_to_string): Make non-static.
	(qualified_name_lookup_error): For the non-"::" case, take
	responsibity for issuing any suggestion from
	suggest_alternative_in_explicit_scope, as it changes from
	returning a bool to returning a name_hint.  Replace fallback call
	to suggest_alternatives_for to a call to
	suggest_alternatives_in_other_namespaces, capturing the fact that
	we don't have enough location information to issue a fix-it hint
	for this case.  Update the error to support emitting a fix-it hint
	where appropriate.  For the "::" case, take responsibility for
	issuing any suggestion from suggest_alternatives_for, supporting
	emitting a fix-it hint.
	* lex.c: Define INCLUDE_UNIQUE_PTR.  Include "gcc-rich-location.h"
	and "cp-name-hint.h".
	(unqualified_name_lookup_error): Take responsibility for issuing
	any suggestion from suggest_alternatives_for, supporting emitting
	a fix-it hint.
	* name-lookup.c (class namespace_limit_reached): New subclass of
	deferred_diagnostic.
	(class show_candidate_location): Likewise.
	(class suggest_alternatives): Likewise.
	(class namespace_hints): New class.
	(suggest_alternatives_for): Convert return type from bool to
	name_hint, replacing all direct diagnostic emission by setting
	suggestions on the return value, or creating deferred diagnostics.
	Specifically, split out initial traversal of namespaces into
	namespace_hints' ctor, and maybe_decorate_with_limit, and move the
	rest of the implementation to
	namespace_hints::convert_candidates_to_name_hint and
	suggest_alternatives_for_1.
	(namespace_hints::namespace_hints): New ctor, adapted from
	suggest_alternatives_for's initial namespace traversal, storing
	location and name, and converting locals "candidates", "limited"
	and "limit" into members.
	(namespace_hints::convert_candidates_to_name_hint): New member
	function.
	(namespace_hints::maybe_decorate_with_limit): New member function.
	(suggest_alternatives_for_1): New function, based on second half
	of old implementation of suggest_alternatives_for, converting from
	immediate emission of suggestions to using name_hint.
	(suggest_alternatives_in_other_namespaces): New function.
	(maybe_suggest_missing_std_header): Convert from immediate
	emission of suggestions to using name_hint, moving emission
	implementation to...
	(class missing_std_header): New subclass of deferred_diagnostic.
	(maybe_suggest_missing_header): Convert return type from bool to
	name_hint.
	(suggest_alternative_in_explicit_scope): Convert from immediate
	emission of suggestions to using name_hint.
	* parser.c: Replace include of "c-family/name-hint.h" with
	"cp-name-hint.h".
	(cp_parser_diagnose_invalid_type_name): Update
	"is there a suggestion" logic for change to
	name_hint::operator bool.  Take responsibility for emitting
	fix-it hints from suggest_alternative_in_explicit_scope.
	(cp_parser_namespace_name): Take responsibility for emitting
	fix-it hints from suggest_alternative_in_explicit_scope.  Don't
	emit the "expected namespace-name" error if we've already emitted
	an "is not a namespace-name" error.

gcc/testsuite/ChangeLog:
	* c-c++-common/spellcheck-reserved.c: Update expected output for
	C++ for merger of "did you mean" suggestions into the error
	message.
	* g++.dg/ext/builtin3.C: Update expected output for merger of "did
	you mean" suggestion into the error.
	* g++.dg/lookup/error1.C: Likewise.
	* g++.dg/lookup/pr77549.C: Likewise.
	* g++.dg/lookup/pr80913.C: Likewise.
	* g++.dg/lookup/suggestions1.C: Likewise.
	* g++.dg/lookup/suggestions2.C: New test.
	* g++.dg/overload/koenig1.C: Update expected output as above.
	* g++.dg/spellcheck-identifiers-2.C: Likewise.
	* g++.dg/spellcheck-identifiers.C: Likewise.
	* g++.dg/spellcheck-ns.C: New test.
	* g++.dg/spellcheck-pr77829.C: Update expected output as above.
	* g++.dg/spellcheck-pr78656.C: Likewise.
	* g++.dg/spellcheck-pr79298.C: Likewise, adding
	-fdiagnostics-show-caret to options.
	* g++.dg/spellcheck-pr80177.C: Likewise.
	* g++.dg/spellcheck-single-vs-multiple.C: New test.
	* g++.dg/spellcheck-typenames.C: Update expected output as above.
	* g++.dg/template/static10.C: Likewise.
	* g++.old-deja/g++.mike/ns5.C: Likewise.
	* g++.old-deja/g++.mike/ns7.C: Likewise.
	* g++.old-deja/g++.ns/koenig5.C: Likewise.
	* g++.old-deja/g++.other/lineno5.C: Likewise.

libstdc++-v3/ChangeLog:
	* testsuite/17_intro/using_namespace_std_exp_neg.cc: Remove
	"expected namespace-name before" error.
	* testsuite/17_intro/using_namespace_std_tr1_neg.cc: Likewise.

From-SVN: r265610
2018-10-29 23:53:50 +00:00
David Malcolm b2bf438c02 Folding and check_function_arguments
This patch eliminates the arglocs array I introduced to build_over_call
in r264887, and eliminates the call to maybe_constant_value when building
"fargs" (thus retaining location wrapper nodes).

Instead, this patch requires that any checks within
check_function_arguments that need folded arguments do their own folding.

Of the various checks:
(a) check_function_nonnull already calls fold_for_warn,
(b) check_function_format doesn't need folding
(c) check_function_sentinel needs fold_for_warn in one place, which the
patch adds, and
(d) check_function_restrict needs per-argument folding, which the patch
adds.  Given that it scans before and after resetting TREE_VISITED on
each argument, it seemed best to make a copy of the array, folding each
argument from the outset, rather than repeatedly calling fold_for_warn;

gcc/c-family/ChangeLog:
	PR c++/56856
	* c-common.c (check_function_sentinel): Call fold_for_warn on the
	argument.
	(check_function_restrict): Rename param "argarray" to
	"unfolded_argarray", and make a copy named "argarray", calling
	fold_for_warn on each argument.
	(check_function_arguments): Add note about responsibility for
	folding the arguments.

gcc/cp/ChangeLog:
	PR c++/56856
	* call.c (build_over_call): Eliminate the "arglocs" array, and the
	call to maybe_constant_value when building "fargs".

From-SVN: r265609
2018-10-29 23:44:10 +00:00
Paolo Carlini ebdb73c0b0 decl.c (create_array_type_for_decl): Add location_t parameter and use it.
/cp
2018-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (create_array_type_for_decl): Add location_t parameter
	and use it.
	(grokdeclarator): Adjust call.

/testsuite
2018-10-29  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp0x/auto24.C: Test location too.
	* g++.dg/cpp0x/auto3.C: Likewise.
	* g++.dg/cpp0x/auto42.C: Likewise.
	* g++.dg/cpp0x/initlist57.C: Likewise.
	* g++.dg/cpp0x/initlist75.C: Likewise.
	* g++.dg/cpp0x/initlist80.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-ice13.C: Likewise.
	* g++.old-deja/g++.brendan/array-refs.C: Likewise.
	* g++.old-deja/g++.bugs/900322_01.C: Likewise.
	* g++.old-deja/g++.bugs/900519_07.C: Likewise.
	* g++.old-deja/g++.other/typeck1.C: Likewise.

From-SVN: r265608
2018-10-29 22:57:39 +00:00
Iain Buclaw 64ac3c33ba config.gcc (xstormy16-*-elf): Set tm_d_file.
gcc/ChangeLog:

2018-10-29  Iain Buclaw  <ibuclaw@gdcproject.org>

	* config.gcc (xstormy16-*-elf): Set tm_d_file.

From-SVN: r265607
2018-10-29 22:56:52 +00:00
David Malcolm 90938ef882 ux.texi: move "Quoting" and "Fix-it hints" from DiagnosticsGuidelines wiki page
gcc/ChangeLog:
	* doc/ux.texi (Quoting): New subsection, adapted from material at
	https://gcc.gnu.org/wiki/DiagnosticsGuidelines written by
	MartinSebor and ManuelLopezIbanez.
	(Fix-it hints): Note that fix-it hints shouldn't be marked for
	translation.


Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>
Co-Authored-By: Martin Sebor <msebor@redhat.com>

From-SVN: r265606
2018-10-29 22:25:29 +00:00
Kugan Vivekanandarajah 5efd9f170a re PR c++/87469 (ice in record_estimate, at tree-ssa-loop-niter.c:3271)
gcc/testsuite/ChangeLog:

2018-10-29  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR middle-end/87469
	* g++.dg/pr87469.C: New test.

gcc/ChangeLog:

2018-10-29  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR middle-end/87469
	* tree-ssa-loop-niter.c (number_of_iterations_popcount): Fix niter
	max value.

From-SVN: r265605
2018-10-29 22:02:45 +00:00
Olivier Hainque ec827ab608 Add ChangeLog entry for hunk introduced together with another one
From-SVN: r265604
2018-10-29 20:52:29 +00:00
Paul A. Clarke 5695084415 [rs6000] Remove inaccurate comment
DEBUG doesn't actually "replace abort with printf on error",
it just enables debugging output.  Just remove the comment.

[gcc/testsuite]

2018-10-29  Paul A. Clarke  <pc@us.ibm.com>

	* gcc.target/powerpc/ssse3-check.h: Remove inaccurate comment.

From-SVN: r265603
2018-10-29 20:14:12 +00:00
Paul Koning 74ec858007 * doc/rtl.texi (CONST_WIDE_INT_ELT): Give correct macro name.
From-SVN: r265602
2018-10-29 16:07:16 -04:00
Paul A. Clarke 8505bf12ff [rs6000] Consistently use '__vector' instead of 'vector'
Revision r265535 committed changes that used 'vector' instead of the
preferred '__vector'.  There is a reason that '__vector' is preferred,
because it ensures no conflicts with C++ namespace.  Indeed,
gcc/config/rs6000/xmmintrin.h undefines it, leading to errors:

  gcc/include/xmmintrin.h:999:20: error: 'vector' undeclared (first use in this function); did you mean 'vec_or'?
  gcc/include/xmmintrin.h:999:20: note: each undeclared identifier is reported only once for each function it appears in
  gcc/include/xmmintrin.h:999:26: error: expected ')' before 'long'
  gcc/include/xmmintrin.h:999:37: error: expected ')' before 'result'

Also fixed a few whitespace issues.

[gcc]

2018-10-29  Paul A. Clarke  <pc@us.ibm.com>

	* gcc/config/rs6000/mmintrin.h (_mm_packs_pi16, _mm_packs_pi32,
	_mm_packs_pu16, _mm_unpackhi_pi8, _mm_unpacklo_pi8, _mm_add_pi8,
	_mm_add_pi16, _mm_add_pi32, _mm_sub_pi8, _mm_sub_pi16, _mm_sub_pi32,
	_mm_cmpgt_pi8, _mm_cmpeq_pi16, _mm_cmpgt_pi16, _mm_cmpeq_pi32,
	_mm_cmpgt_pi32, _mm_adds_pi8, _mm_adds_pi16, _mm_adds_pu8,
	_mm_adds_pu16, _mm_subs_pi8, _mm_subs_pi16, _mm_subs_pu8,
	_mm_subs_pu16, _mm_madd_pi16, _mm_mulhi_pi16, _mm_mullo_pi16,
	_mm_sll_pi16, _mm_sra_pi16, _mm_srl_pi16, _mm_set1_pi16, _mm_set1_pi8):
	Change 'vector' to '__vector'.
	* gcc/config/rs6000/xmmintrin.h (_mm_cvtps_pi32, _mm_cvttps_pi32,
	_mm_cvtps_pi16, _mm_cvtps_pi8, _mm_max_pi16, _mm_max_pu8, _mm_min_pi16,
	_mm_min_pu8, _mm_mulhi_pu16, _mm_shuffle_pi16, _mm_avg_pu8,
	_mm_avg_pu16): Likewise.  And, whitespace corrections.

From-SVN: r265601
2018-10-29 19:44:57 +00:00
Marek Polacek a385474c79 PR c++/87594 - constexpr rejects-valid with range-based for.
* constexpr.c (potential_constant_expression_1): If the condition
	can't be evaluated, return true.

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

From-SVN: r265600
2018-10-29 19:40:18 +00:00
Ian Lance Taylor a4e30bef64 compiler: pass a single flags argument to Backend::function
Reviewed-on: https://go-review.googlesource.com/c/145319

	* go-gcc.cc (Gcc_backend::function): Change to use a single flags
	parameter.

From-SVN: r265599
2018-10-29 19:25:57 +00:00
Ian Lance Taylor 943cc2fb64 compiler: add location_file
Add support for getting the file name from a Location value.  This
    will be used by later work.
    
    Reviewed-on: https://go-review.googlesource.com/c/145318

	* go-linemap.cc (Gcc_linemap::location_file): New method.

From-SVN: r265598
2018-10-29 18:44:39 +00:00
Richard Biener 266ef3613e re PR tree-optimization/87785 (ICE in dr_misalignment, at tree-vectorizer.h:1245 on 454.calculix with -Ofast and -flto)
2018-10-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87785
	* tree-vect-slp.c (vect_gather_slp_loads): Only gather
	internal defs.

	* gcc.dg/torture/20181029-1.c: New testcase.
	* gcc.dg/torture/20181029-2.c: Likewise.

From-SVN: r265596
2018-10-29 15:43:08 +00:00
Olivier Hainque bca81bd229 Extract VXWORKS_NET_LIBS_RTP from VXWORKS_LIBS_RTP
2018-10-29  Olivier Hainque  <hainque@adacore.com>

	* VXWORKS_NET_LIBS_RTP: New macro, network part of VXWORKS_LIBS_RTP.

From-SVN: r265595
2018-10-29 15:07:47 +00:00
Olivier Hainque 3b727799d4 Introduce notion of VXWORKS_PERSONALITY
2018-10-29  Olivier Hainque  <hainque@adacore.com>

	* config/vxworks.h (VXWORKS_PERSONALITY): New VxWorks
	ports configuration macro, defaults to "gnu".
	(VXWORKS_OS_CPP_BUILTINS): Use it. Feed TOOL and
	TOOL_FAMILY instead of _VX_TOOL/_VXTOOL_FAMILY.

From-SVN: r265594
2018-10-29 15:07:33 +00:00
Richard Biener 6c7e3b1fe2 re PR tree-optimization/87790 (ICE in vect_get_vec_def_for_operand_1, at tree-vect-stmts.c:1475)
2018-10-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87790
	* tree-vect-slp.c (vect_mark_slp_stmts): Simplify.
	(vect_make_slp_decision): Adjust.
	(vect_slp_analyze_bb_1): Likewise.
	(vect_detect_hybrid_slp_stmts): Properly union SLP type over
	edges.

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

From-SVN: r265593
2018-10-29 14:57:52 +00:00
Joseph Myers 87a5ccfb7c [OpenACC] Support C++ "this" in OpenACC directives
2018-10-29  Joseph Myers  <joseph@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>

	* semantics.c (handle_omp_array_sections_1): Allow array sections with
	"this" pointer for OpenACC.

Co-Authored-By: Julian Brown <julian@codesourcery.com>

From-SVN: r265591
2018-10-29 14:31:20 +00:00
Richard Biener 5d8c32cb86 re PR tree-optimization/87785 (ICE in dr_misalignment, at tree-vectorizer.h:1245 on 454.calculix with -Ofast and -flto)
2018-10-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87785
	* tree-vect-slp.c (vect_build_slp_tree_2): Remove loads argument
	and processing.
	(vect_build_slp_tree): Likewise.
	(vect_gather_slp_loads): New function.
	(vect_analyze_slp_instance): Gather loads separately from the
	SLP tree build.

From-SVN: r265588
2018-10-29 13:31:28 +00:00
Martin Liska c8fda30f0c GCOV: introduce --json-format.
2018-10-29  Martin Liska  <mliska@suse.cz>

	* Makefile.in: Make dependency to json.o.
	* doc/gcov.texi: Document new JSON format, remove
	old intermediate format documentation.
	* gcov.c (struct function_info): Come up with m_name and
	m_demangled_name.
	(function_info::function_info): Initialize it.
	(function_info::~function_info): Release it.
	(main): Rename flag_intermediate_format to flag_json_format.
	(print_usage): Describe --json-format.
	(process_args): Set flag_json_format.
	(output_intermediate_line): Remove.
	(output_intermediate_json_line): Likewise.
	(get_gcov_intermediate_filename): Return new extension
	".gcov.json.gz".
	(output_intermediate_file): Implement JSON emission.
	(output_json_intermediate_file): Implement JSON emission.
	(generate_results): Use ::get_name for function name.
	Handle JSON output file.
	(read_graph_file): Use ::get_name instead of cplus_demangle.
	(read_count_file): Likewise.
	(solve_flow_graph): Likewise.
	(add_line_counts): Likewise.
	(accumulate_line_counts): Use new flag_json_format.
	(output_function_details): Use ::get_name instead of cplus_demangle.
	(output_lines): Likewise.
	* json.cc (test_writing_literals): Add new tests.
	* json.h (class literal): Add new boolean constructor.
2018-10-29  Martin Liska  <mliska@suse.cz>

	* g++.dg/gcov/gcov-8.C: Do not check intermediate format.
	* lib/gcov.exp: Remove legacy verify-intermediate.

From-SVN: r265587
2018-10-29 12:00:54 +00:00