Commit Graph

157907 Commits

Author SHA1 Message Date
Przemyslaw Wirkus
b99415b760 Fix invalid XML in libstdc++ manual
2017-11-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* doc/xml/manual/using.xml (manual.intro.using.macros): Move
	variablelist element at the end of its list.

From-SVN: r255023
2017-11-21 18:45:04 +00:00
Jonathan Wakely
4bd9c84c52 Improve -Wmaybe-uninitialized documentation
* doc/invoke.texi (-Wmaybe-uninitialized): Rephrase for clarity.

From-SVN: r255022
2017-11-21 18:38:18 +00:00
Marc Glisse
1af4ebf598 New POINTER_DIFF_EXPR
2017-11-21  Marc Glisse  <marc.glisse@inria.fr>

gcc/c/
	* c-fold.c (c_fully_fold_internal): Handle POINTER_DIFF_EXPR.
	* c-typeck.c (pointer_diff): Use POINTER_DIFF_EXPR.

gcc/c-family/
	* c-pretty-print.c (pp_c_additive_expression,
	c_pretty_printer::expression): Handle POINTER_DIFF_EXPR.

gcc/cp/
	* constexpr.c (cxx_eval_constant_expression,
	potential_constant_expression_1): Handle POINTER_DIFF_EXPR.
	* cp-gimplify.c (cp_fold): Likewise.
	* error.c (dump_expr): Likewise.
	* typeck.c (pointer_diff): Use POINTER_DIFF_EXPR.

gcc/
	* doc/generic.texi: Document POINTER_DIFF_EXPR, update
	POINTER_PLUS_EXPR.
	* cfgexpand.c (expand_debug_expr): Handle POINTER_DIFF_EXPR.
	* expr.c (expand_expr_real_2): Likewise.
	* fold-const.c (const_binop, fold_addr_of_array_ref_difference,
	fold_binary_loc): Likewise.
	* match.pd (X-X, P+(Q-P), &D-P, (P+N)-P, P-(P+N), (P+M)-(P+N),
	P-Q==0, -(A-B), X-Z<Y-Z, (X-Z)-(Y-Z), Z-X<Z-Y, (Z-X)-(Z-Y),
	(A-B)+(C-A)): New transformations for POINTER_DIFF_EXPR, based on
	MINUS_EXPR transformations.
	* optabs-tree.c (optab_for_tree_code): Handle POINTER_DIFF_EXPR.
	* tree-cfg.c (verify_expr, verify_gimple_assign_binary): Likewise.
	* tree-inline.c (estimate_operator_cost): Likewise.
	* tree-pretty-print.c (dump_generic_node, op_code_prio,
	op_symbol_code): Likewise.
	* tree-vect-stmts.c (vectorizable_operation): Likewise.
	* vr-values.c (extract_range_from_binary_expr): Likewise.
	* varasm.c (initializer_constant_valid_p_1): Likewise.
	* tree.def: New tree code POINTER_DIFF_EXPR.

From-SVN: r255021
2017-11-21 18:23:56 +00:00
Uros Bizjak
ffb41aab7a * config/i386/i386.md: Missing file from my previous commit.
From-SVN: r255019
2017-11-21 18:46:38 +01:00
Jakub Jelinek
826eccc6fd re PR c++/83045 (-Wreturn-type regression in C++)
PR c++/83045
	* tree-cfg.c (pass_warn_function_return::execute): Formatting fix.
	Also warn if seen __builtin_unreachable () call with BUILTINS_LOCATION.
	Use LOCATION_LOCUS when comparing against UNKNOWN_LOCATION.

	* c-c++-common/pr61405.c (fn0, fn1): Add return stmts.
	* c-c++-common/Wlogical-op-2.c (fn): Likewise.
	* g++.dg/debug/pr53466.C: Add -Wno-return-type to dg-options.
	* g++.dg/opt/combine.C: Likewise.
	* g++.dg/ubsan/return-3.C: Likewise.
	* g++.dg/pr59445.C: Likewise.
	* g++.dg/pr49847.C: Likewise.
	* g++.dg/ipa/pr61800.C: Likewise.
	* g++.dg/ipa/pr63470.C: Likewise.
	* g++.dg/ipa/pr68672-1.C: Likewise.
	* g++.dg/pr58438.C: Likewise.
	* g++.dg/torture/pr59265.C: Likewise.
	* g++.dg/tree-ssa/ssa-dse-2.C: Likewise.
	* g++.old-deja/g++.eh/catch13.C: Likewise.
	* g++.old-deja/g++.eh/crash1.C: Likewise.
	* g++.dg/tm/pr60004.C: Expect -Wreturn-type warning.
	* g++.dg/torture/pr55740.C: Likewise.
	* g++.dg/torture/pr43257.C: Likewise.
	* g++.dg/torture/pr64280.C: Likewise.
	* g++.dg/torture/pr54684.C: Likewise.
	* g++.dg/torture/pr56694.C: Likewise.
	* g++.dg/torture/pr68470.C: Likewise.
	* g++.dg/torture/pr60648.C: Likewise.
	* g++.dg/torture/pr71281.C: Likewise.
	* g++.dg/torture/pr52772.C: Add -Wno-return-type dg-additional-options.
	* g++.dg/torture/pr64669.C: Likewise.
	* g++.dg/torture/pr58369.C: Likewise.
	* g++.dg/torture/pr33627.C: Likewise.
	* g++.dg/torture/predcom-1.C: Add
	#pragma GCC diagnostic ignored "-Wreturn-type".
	* g++.dg/lto/20090221_0.C: Likewise.
	* g++.dg/lto/20091026-1_1.C: Likewise.
	* g++.dg/lto/pr54625-1_1.C: Likewise.
	* g++.dg/warn/pr83045.C: New test.

From-SVN: r255018
2017-11-21 18:40:34 +01:00
Uros Bizjak
8fccb0a6b6 i386.md (*bswap<mode>2_movbe): Add integer suffix to movbe mnemonic.
* config/i386/i386.md (*bswap<mode>2_movbe): Add
	integer suffix to movbe mnemonic.
	(*bswaphi2_movbe): Ditto.
	(bswaphi_lowpart): Merge with *bswaphi_lowpart_1.

testsuite/ChangeLog:

	* gcc.target/i386/movbe-1.c: Update scan string for movbe
	with integer suffix.
	* gcc.target/i386/movbe-2.c: Ditto.
	* gcc.target/i386/movbe-3.c: Ditto.
	* gcc.target/i386/movbe-4.c: Ditto.
	* gcc.target/i386/movbe-5.c: Ditto.

From-SVN: r255017
2017-11-21 18:35:23 +01:00
Uros Bizjak
40a9022414 * gcc.target/i386/pr82713.c: Fix dg directive.
From-SVN: r255016
2017-11-21 18:00:35 +01:00
Paolo Carlini
00709c08e8 re PR c++/83020 (('17) Class template constructor call skipped with no error when substitution fails in default argument)
2017-11-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/83020
	* g++.dg/cpp1z/pr83020.C: New.

From-SVN: r255006
2017-11-21 15:36:25 +00:00
Martin Liska
769ae3bb49 Remove not needed xstrdup_for_dump.
2017-11-21  Martin Liska  <mliska@suse.cz>

	* tree-inline.c (expand_call_inline):
	  Remove not needed xstrdup_for_dump.

From-SVN: r255005
2017-11-21 14:59:27 +00:00
Jakub Jelinek
0698829670 re PR target/82880 (gcc --help=target --help=optimizers hangs on mips)
PR target/82880
	* config/mips/frame-header-opt.c (mips_register_frame_header_opt):
	Remove static keyword from f variable.

	* gcc.dg/opts-8.c: New test.

From-SVN: r255004
2017-11-21 15:50:03 +01:00
Jakub Jelinek
7d2f0f9b61 * c-common.c (get_nonnull_operand): Use tree_to_uhwi.
From-SVN: r255003
2017-11-21 14:57:11 +01:00
Jakub Jelinek
aa11164a39 re PR tree-optimization/83086 (valgrind error in gimple-ssa-store-merging.c for recent build)
PR tree-optimization/83086
	* gimple-ssa-store-merging.c
	(imm_store_chain_info::try_coalesce_bswap): Test this_n.base_addr
	rather than n.base_addr.

From-SVN: r255002
2017-11-21 14:54:08 +01:00
Martin Liska
938f9248db Fix UBSAN errors in dse.c (PR rtl-optimization/82044).
2017-11-21  Martin Liska  <mliska@suse.cz>

	PR rtl-optimization/82044
	PR tree-optimization/82042
	* dse.c (check_mem_read_rtx): Check for overflow.

From-SVN: r255001
2017-11-21 13:39:14 +00:00
Aldy Hernandez
ddc1759a35 tree-ssa-threadbackward.c (find_jump_threads_backwards): Fix typo in comment.
* tree-ssa-threadbackward.c (find_jump_threads_backwards): Fix
	typo in comment.

From-SVN: r254999
2017-11-21 11:39:51 +00:00
Claudiu Zissulescu
13f5d5e082 Don't split call from its call arg location.
gcc/
2017-11-21  Claudiu Zissulescu  <claziss@synopsys.com>

	* cfgrtl.c (force_nonfallthru_and_redirect): Don't split a call
	and its corresponding call arg location note.

testsuite/
2017-11-21  Claudiu Zissulescu  <claziss@synopsys.com>

	* gcc.target/arc/loop-5.cpp: New test.

From-SVN: r254998
2017-11-21 12:37:42 +01:00
Claudiu Zissulescu
6fe5e235f9 [ARC] Reimplement exception handling support.
2016-06-09  Claudiu Zissulescu  <claziss@synopsys.com>
	    Andrew Burgess  <andrew.burgess@embecosm.com>

	* config/arc/arc-protos.h (arc_compute_frame_size): Delete
	declaration.
	(arc_return_slot_offset): Likewise.
	(arc_eh_return_address_location): New declaration.
	* config/arc/arc.c (TARGET_BUILTIN_SETJMP_FRAME_VALUE): Define.
	(MUST_SAVE_REGISTER): Add exception handler case.
	(MUST_SAVE_RETURN_ADDR): Likewise.
	(arc_frame_pointer_required): Likewise.
	(arc_frame_pointer_needed): New function.
	(arc_compute_frame_size): Changed.
	(arc_expand_prologue): Likewise.
	(arc_expand_epilogue): Likewise.
	(arc_initial_elimination_offset): Likewise.
	(arc_return_slot_offset): Delete.
	(arc_eh_return_address_location): New function.
	(arc_builtin_setjmp_frame_value): Likewise.
	* config/arc/arc.h (EH_RETURN_DATA_REGNO): Use 2 registers.
	(EH_RETURN_STACKADJ_RTX): Define.
	(EH_RETURN_HANDLER_RTX): Likewise.
	* config/arc/arc.md (eh_return): Delete.

Co-Authored-By: Andrew Burgess <andrew.burgess@embecosm.com>

From-SVN: r254997
2017-11-21 12:37:30 +01:00
Aldy Hernandez
24d39222e8 print-tree.h (debug_vec_tree): Remove prototype.
* print-tree.h (debug_vec_tree): Remove prototype.
	* gdbinit.in (pvt): Remove macro.

From-SVN: r254996
2017-11-21 10:06:52 +00:00
Jakub Jelinek
97031af755 re PR tree-optimization/83047 (glibc/crypt/crypt_util.c gets miscompiled)
PR tree-optimization/83047
	* gimple-ssa-store-merging.c
	(imm_store_chain_info::output_merged_store): If the loads with the
	same vuse are in different basic blocks, for load_gsi pick a load
	location that is dominated by the other loads.

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

From-SVN: r254992
2017-11-21 09:41:47 +01:00
Jakub Jelinek
7768f20b0a P0428R2 - familiar template syntax for generic lambdas
P0428R2 - familiar template syntax for generic lambdas
	* parser.c (cp_parser_lambda_declarator_opt): Don't pedwarn
	for cxx2a and above, reword pedwarn for C++14/C++17.

	* g++.dg/cpp1y/lambda-generic-x.C: Adjust warnings and limit
	to c++17_down target.
	* g++.dg/cpp1y/lambda-generic-dep.C: Likewise.
	* g++.dg/cpp1y/lambda-generic-77914.C: Adjust error and limit
	to c++17_down target.
	* g++.dg/cpp2a/lambda-generic1.C: New test.
	* g++.dg/cpp2a/lambda-generic2.C: New test.
	* g++.dg/cpp2a/lambda-generic3.C: New test.
	* g++.dg/cpp2a/lambda-generic4.C: New test.
	* g++.dg/cpp2a/lambda-generic5.C: New test.

From-SVN: r254991
2017-11-21 09:39:57 +01:00
Jakub Jelinek
d44ed508a6 re PR c++/83059 (ICE on invalid C++ code: in tree_to_uhwi, at tree.c:6633)
PR c++/83059
	* c-common.c (get_atomic_generic_size): Use TREE_INT_CST_LOW
	instead of tree_to_uhwi, formatting fix.
	* config/i386/i386.c (ix86_memmodel_check): Start
	-Winvalid-memory-model diagnostics with lowercase letter.

	* c-c++-common/pr83059.c: New test.

From-SVN: r254990
2017-11-21 09:06:28 +01:00
Jakub Jelinek
8b87e0d125 re PR debug/82718 (Bad DWARF5 .debug_loclists generation)
PR debug/82718
	* dwarf2out.c (dw_loc_list): If crtl->has_bb_partition, temporarily
	set in_cold_section_p to the partition containing loc_list->first.
	When seeing loc_list->last_before_switch node, update secname and
	perform range_across_switch second partition handling only after that.

	* gcc.dg/debug/dwarf2/pr82718-1.c: New test.
	* gcc.dg/debug/dwarf2/pr82718-2.c: New test.

From-SVN: r254989
2017-11-21 08:59:03 +01:00
Jakub Jelinek
83087d6521 re PR debug/82933 (valgrind error in set_cur_line_info_table with -g)
PR debug/82933
	* run-rtl-passes.c: Include debug.h.
	(run_rtl_passes): Call debug_hooks->assembly_start.
	* dwarf2out.c (dwarf2out_assembly_start): Return early if invoked
	multiple times.

	* gcc.dg/rtl/x86_64/pr82933.c: New test.

From-SVN: r254987
2017-11-21 08:50:15 +01:00
Jakub Jelinek
644f013227 re PR target/82981 (unnecessary __multi3 call for mips64r6 linux kernel)
PR target/82981
	* internal-fn.c (expand_mul_overflow): Use OPTAB_WIDEN instead of
	OPTAB_DIRECT in calls to expand_simple_binop.

From-SVN: r254986
2017-11-21 08:49:14 +01:00
Sebastian Huber
b76602dcf2 RTEMS: Enable some libstdc++ features
libstdc++/

	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Add rtems*.
	(GLIBCXX_ENABLE_FILESYSTEM_TS): Likewise.
	* configure: Regenerate.

From-SVN: r254985
2017-11-21 06:22:13 +00:00
Ian Lance Taylor
c9548fa4f1 libgo: fix makefile buglet
Fix a small bug in the libgo Makefile recipe that constructs the
    directory from which to pick up libgcc_s.so ; the gccgo invocation
    with -print-libgcc-file-name was missing the flags, which meant that
    for -m32 builds we'd see the 64-bit libgcc dir.
    
    Reviewed-on: https://go-review.googlesource.com/78836

From-SVN: r254984
2017-11-21 06:19:10 +00:00
Ian Lance Taylor
5e43a9eeca compiler: report error for ++/-- applied to a non-numeric type
This avoids a compiler crash.
    
    Fixes GCC PR 83071.
    
    Reviewed-on: https://go-review.googlesource.com/78875

From-SVN: r254983
2017-11-21 06:14:32 +00:00
Jerry DeLisle
8c09856788 re PR libfortran/78549 (Very slow formatted internal file output)
2017-11-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/78549
	* io/io.h (newunit_free): Add declaration. Clean some whitespace.
	* io/transfer.c (st_read_done, st_write_done): Call newunit_free.
	* io/unit.c (newunit_free): Change type from static void to void.

From-SVN: r254982
2017-11-21 02:17:11 +00:00
Eric Gallager
34b81eb96c Use -Wtraditional for "would be stringified in traditional C" (PR preprocessor/81794)
libcpp/ChangeLog:

2017-03-24  Eric Gallager  <egall@gwmail.gwu.edu>

	PR preprocessor/81794
	* macro.c (check_trad_stringification): Have warning be controlled
	by -Wtraditional.

gcc/testsuite/ChangeLog:

2017-09-17  Eric Gallager  <egall@gwmail.gwu.edu>

	PR preprocessor/81794
	* gcc.dg/pragma-diag-7.c: Update to include check for
	stringification.

From-SVN: r254981
2017-11-21 00:57:29 +00:00
David Malcolm
26edace69b C/C++: more stdlib header hints (PR c/81404)
This patch extends the C frontend's "knowledge" of the C stdlib within
get_c_name_hint to cover some more macros and functions, covering
a case reported in PR c/81404 ("INT_MAX"), so that rather than printing:

  t.c:5:12: error: 'INT_MAX' undeclared here (not in a function); did you mean '__INT_MAX__'?
   int test = INT_MAX;
              ^~~~~~~
              __INT_MAX__

we instead print:

  t.c:5:12: error: 'INT_MAX' undeclared here (not in a function)
   int test = INT_MAX;
              ^~~~~~~
  t.c:5:12: note: 'INT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
  t.c:1:1:
  +#include <limits.h>

  t.c:5:12:
    int test = INT_MAX;
               ^~~~~~~

It also adds generalizes some of the code for this (and for the "std::"
namespace hints in the C++ frontend), moving it to a new
c-family/known-headers.cc and .h, and introducing a class known_headers.
This currently just works by scanning a hardcoded array of known
name/header associations, but perhaps in the future could be turned
into some kind of symbol database so that the compiler could record API
uses and use that to offer suggestions e.g.

foo.cc: error: 'myapi::foo' was not declared in this scope
foo.cc: note: 'myapi::foo" was declared in header 'myapi/private.h'
(included via 'myapi/public.h') when compiling 'bar.cc'; did you forget to
'#include "myapi/public.h"'?

or somesuch.

In any case, moving this to a class gives an easier way to locate the
hardcoded knowledge about the stdlib.

The patch also adds similar code to the C++ frontend covering
unqualified names in the standard library, so that rather than just
e.g.:

  t.cc:19:13: error: 'NULL' was not declared in this scope
   void *ptr = NULL;
               ^~~~

we can emit:

  t.cc:19:13: error: 'NULL' was not declared in this scope
   void *ptr = NULL;
               ^~~~
  t.cc:19:13: note: 'NULL' is defined in header '<cstddef>'; did you forget
  to '#include <cstddef>'?
  t.cc:1:1:
  +#include <cstddef>

  t.cc:19:13:
   void *ptr = NULL;
               ^~~~

(Also XFAIL for PR c++/80567 added for the C++ testcase; this is a
separate pre-existing bug exposed by the testcase for PR 81404).

gcc/ChangeLog:
	PR c/81404
	* Makefile.in (C_COMMON_OBJS): Add c-family/known-headers.o.

gcc/c-family/ChangeLog:
	PR c/81404
	* known-headers.cc: New file, based on material from c/c-decl.c.
	(suggest_missing_header): Copied as-is.
	(get_stdlib_header_for_name): New, based on get_c_name_hint but
	heavily edited to add C++ support.  Add some knowledge about
	<limits.h>, <stdint.h>, and <wchar.h>.
	* known-headers.h: Likewise.

gcc/c/ChangeLog:
	PR c/81404
	* c-decl.c: Include "c-family/known-headers.h".
	(get_c_name_hint): Rename to get_stdlib_header_for_name and move
	to known-headers.cc.
	(class suggest_missing_header): Move to known-header.h.
	(lookup_name_fuzzy): Call get_c_stdlib_header_for_name rather
	than get_c_name_hint.

gcc/cp/ChangeLog:
	PR c/81404
	* name-lookup.c: Include "c-family/known-headers.h"
	(lookup_name_fuzzy): Call get_cp_stdlib_header_for_name and
	potentially return a new suggest_missing_header hint.

gcc/testsuite/ChangeLog:
	PR c/81404
	* g++.dg/spellcheck-stdlib.C: New.
	* gcc.dg/spellcheck-stdlib.c (test_INT_MAX): New.

From-SVN: r254980
2017-11-21 00:50:39 +00:00
David Malcolm
b121225555 C: hints for missing stdlib includes for macros and types
The C frontend already "knows" about many common functions in
the C standard library:

  test.c: In function 'test':
  test.c:3:3: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
     printf ("hello world\n");
     ^~~~~~
  test.c:3:3: warning: incompatible implicit declaration of built-in function 'printf'
  test.c:3:3: note: include '<stdio.h>' or provide a declaration of 'printf'

and which header file they are in.

However it doesn't know about various types and macros:

test.c:1:13: error: 'NULL' undeclared here (not in a function)
 void *ptr = NULL;
             ^~~~

This patch uses the name_hint/deferred_diagnostic machinery to
add hints for missing C standard library headers for some of the
most common type and macro names.

For example, the above becomes:
test.c:1:13: error: 'NULL' undeclared here (not in a function)
 void *ptr = NULL;
             ^~~~
test.c:1:13: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?

gcc/c/ChangeLog:
	* c-decl.c (get_c_name_hint): New function.
	(class suggest_missing_header): New class.
	(lookup_name_fuzzy): Call get_c_name_hint and use it to
	suggest missing headers to the user.

gcc/testsuite/ChangeLog:
	* gcc.dg/spellcheck-stdlib.c: New test case.

From-SVN: r254979
2017-11-21 00:46:24 +00:00
David Malcolm
01ada12136 C++: provide macro used-before-defined hint (PR c++/72786)
This patch uses the name_hint/deferred_diagnostic to provide
a message in the C++ frontend if a macro is used before it is defined
e.g.:

test.c:6:24: error: expected ';' at end of member declaration
   virtual void clone() const OVERRIDE { }
                        ^~~~~
                             ;
test.c:6:30: error: 'OVERRIDE' does not name a type
   virtual void clone() const OVERRIDE { }
                              ^~~~~~~~
test.c:6:30: note: the macro 'OVERRIDE' had not yet been defined
test.c:15:0: note: it was later defined here
 #define OVERRIDE override

It's possible to do it from the C++ frontend as tokenization happens
up-front (and hence the macro already exists when the above is parsed);
I attempted to do it from the C frontend, but because the C frontend only
tokenizes on-demand during parsing, the macro isn't known about until
later.

gcc/cp/ChangeLog:
	PR c++/72786
	* name-lookup.c (class macro_use_before_def): New class.
	(lookup_name_fuzzy): Detect macro that were used before being
	defined, and report them as such.

gcc/ChangeLog:
	PR c++/72786
	* spellcheck.h (best_match::blithely_get_best_candidate): New
	accessor.

gcc/testsuite/ChangeLog:
	PR c++/72786
	* g++.dg/spellcheck-macro-ordering-2.C: New test case.
	* g++.dg/spellcheck-macro-ordering.C: Add dg-message directives
	for macro used-before-defined.

libcpp/ChangeLog:
	PR c++/72786
	* include/cpplib.h (cpp_macro_definition_location): New decl.
	* macro.c (cpp_macro_definition): New function.

From-SVN: r254978
2017-11-21 00:40:53 +00:00
Steve Ellcey
874b8068f6 re PR target/81356 (__builtin_strcpy is not good for copying an empty string on aarch64)
2017-11-20  Steve Ellcey  <sellcey@cavium.com>

	PR target/81356
	* gfortran.dg/pr45636.f90 (aarch64*-*-*): Remove from xfail list.

From-SVN: r254977
2017-11-21 00:18:14 +00:00
GCC Administrator
a121f8229d Daily bump.
From-SVN: r254976
2017-11-21 00:16:16 +00:00
Jason Merrill
753c2e693f Avoid duplicate visibility warning.
* decl2.c (constrain_class_visibility): Don't warn about artificial
	fields.

From-SVN: r254973
2017-11-20 17:37:45 -05:00
François Dumont
e324f9cb92 streambuf_iterator.h (istreambuf_iterator<>): Declare std::advance for istreambuf_iterator of char types to be friend.
2017-11-20  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/streambuf_iterator.h (istreambuf_iterator<>): Declare
	std::advance for istreambuf_iterator of char types to be friend.
	(std::advance(istreambuf_iterator&, _Distance)): New overload.
	* include/std/streambuf (basic_streambuf<>): Declare std::advance for
	istreambuf_iterator of char types to be friend.
	* testsuite/22_locale/money_get/get/char/9.cc: Have
	istreambuf_iterator created on the fly when calling money_get<>::get.
	* testsuite/22_locale/money_get/get/wchar_t/9.cc: Likewise.
	* testsuite/24_iterators/istreambuf_iterator/debug/1_neg.cc: New.
	* testsuite/24_iterators/istreambuf_iterator/debug/2_neg.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/1.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/1_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/2.cc: New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/2_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/char/3_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/1.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/1_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/2_neg.cc:
	New.
	* testsuite/25_algorithms/advance/istreambuf_iterators/wchar_t/3_neg.cc:
	New.
	* testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc: Leverage
	on std::advance overload.
	* testsuite/25_algorithms/find/istreambuf_iterators/wchar_t/2.cc:
	Likewise.

From-SVN: r254972
2017-11-20 22:30:28 +00:00
Jonathan Wakely
9be0a9d6d2 Fix failing tests caused by duplicate dg-options
* testsuite/special_functions/18_riemann_zeta/check_value.cc: Fix
	duplicate dg-options directive.
	* testsuite/tr1/5_numerical_facilities/special_functions/
	20_riemann_zeta/check_value_neg.cc: Likewise.

From-SVN: r254971
2017-11-20 21:48:31 +00:00
Jakub Jelinek
49e68526ab i386.c (parse_mtune_ctrl_str): Start diagnostics with lower case letter.
* config/i386/i386.c (parse_mtune_ctrl_str): Start diagnostics
	with lower case letter.

From-SVN: r254970
2017-11-20 22:03:47 +01:00
Uros Bizjak
121075d760 i386.md (bswaphi2): New expander.
* config/i386/i386.md (bswaphi2): New expander.
	(*bswaphi2_movbe): New insn pattern.
	(bswaphi -> rorhi pepehole2): New peephole pattern.

testsuite/ChangeLog:

	* gcc.target/i386/movbe-5.c: New test.

From-SVN: r254967
2017-11-20 20:52:14 +01:00
Paul Thomas
6017b8f0cf re PR fortran/79072 (ICE with class(*) pointer function result and character value)
2017-11-20  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/79072
	* trans-expr.c (trans_class_vptr_len_assignment): Set from_len
	if the temporary is unlimited polymorphic.
	* trans-stmt.c (trans_associate_var): Use the fake result decl
	to obtain the 'len' field from an explicit function result when
	in that function scope.

2017-11-20  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/79072
	* gfortran.dg/class_result_5.f90: New test.

From-SVN: r254966
2017-11-20 19:09:34 +00:00
Kito Cheng
ee1c213355 RISC-V: Implement __umulsidi3, umul_ppmm and __muluw3
2017-11-20  Kito Cheng  <kito.cheng@gmail.com>

        * longlong.h [__riscv] (__umulsidi3): Define.
        [__riscv] (umul_ppmm): Likewise.
        [__riscv] (__muluw3): Likewise.

From-SVN: r254965
2017-11-20 19:08:38 +00:00
Jakub Jelinek
d68ddd2b35 P0329R4: Designated Initialization
P0329R4: Designated Initialization
	* parser.c (cp_parser_initializer_clause): List in comment grammar
	designated-initializer-list.
	(cp_parser_initializer_list): Allow .identifier = without pedwarn for
	C++2A, parse .identifier { ... }.  Improve location_t argument to
	pedwarn.  Add pedwarn for [cst] = designators.  Diagnose ... in
	designated initializer list.  Diagnose mixing designated and
	non-designated initializer clauses for C++2A.  Diagnose duplicated
	identifiers in designators.
	* name-lookup.h (search_anon_aggr): New declaration.
	* name-lookup.c (fields_linear_search): Use search_anon_aggr.
	(search_anon_aggr): New function.
	* typeck2.c (process_init_constructor_record): Allow designator
	to skip over some non-static data members.  Handle anonymous
	aggregates.  Add diagnostics for designator order not matching
	member declaration order.

	* g++.dg/ext/desig2.C: Adjust comment, no sorry about designator
	refering to second member.
	(b): New variable and associated expected diagnostic.
	* g++.dg/ext/desig4.C: For C++2A expect diagnostics.
	* g++.dg/ext/desig5.C: Add dg-do dg-compile and empty dg-options.
	* g++.dg/ext/desig8.C: Likewise.
	* g++.dg/ext/desig9.C: New test.
	* g++.dg/ext/pr27019.C: Don't expect any diagnostics.
	* g++.dg/init/error2.C: Adjust expected diagnostics.
	* g++.dg/cpp0x/desig1.C: Add dg-options with -pedantic, expect
	warning on C99 designators.
	* g++.dg/cpp2a/desig1.C: New test.
	* g++.dg/cpp2a/desig2.C: New test.
	* g++.dg/cpp2a/desig3.C: New test.
	* g++.dg/cpp2a/desig4.C: New test.
	* g++.dg/cpp2a/desig5.C: New test.
	* g++.dg/cpp2a/desig6.C: New test.

From-SVN: r254964
2017-11-20 19:58:01 +01:00
David Malcolm
6c7a259b81 c-family: add name_hint/deferred_diagnostic
In various places we use lookup_name_fuzzy to provide a hint,
and can report messages of the form:
  error: unknown foo named 'bar'
or:
  error: unknown foo named 'bar'; did you mean 'SUGGESTION?

This patch provides a way for lookup_name_fuzzy to provide
both the suggestion above, and (optionally) additional hints
that can be printed e.g.

  note: did you forget to include <SOME_HEADER.h>?

This patch provides the mechanism and ports existing users
of lookup_name_fuzzy to the new return type.
There are no uses of such hints in this patch, but followup
patches provide various front-end specific uses of this.

gcc/c-family/ChangeLog:
	* c-common.h (enum lookup_name_fuzzy_kind): Move to name-hint.h.
	(lookup_name_fuzzy): Likewise.  Convert return type from
	const char * to name_hint.  Add location_t param.
	* name-hint.h: New header.

gcc/c/ChangeLog:
	* c-decl.c: Define INCLUDE_UNIQUE_PTR before including system.h.
	Include "c-family/name-hint.h"
	(implicit_decl_warning): Convert "hint" from
	const char * to name_hint.  Pass location to
	lookup_name_fuzzy.  Suppress any deferred diagnostic if the
	warning was not printed.
	(undeclared_variable): Likewise for "guessed_id".
	(lookup_name_fuzzy): Convert return type from const char *
	to name_hint.  Add location_t param.
	* c-parser.c: Define INCLUDE_UNIQUE_PTR before including system.h.
	Include "c-family/name-hint.h"
	(c_parser_declaration_or_fndef): Convert "hint" from
	const char * to name_hint.  Pass location to lookup_name_fuzzy.
	(c_parser_parameter_declaration): Likewise.

gcc/cp/ChangeLog:
	* name-lookup.c: Define INCLUDE_UNIQUE_PTR before including system.h.
	Include "c-family/name-hint.h"
	(suggest_alternatives_for): Convert "fuzzy_name" from const char *
	to name_hint, and rename to "hint".  Pass location to
	lookup_name_fuzzy.
	(lookup_name_fuzzy): Convert return type from const char *
	to name_hint.  Add location_t param.
	* parser.c: Define INCLUDE_UNIQUE_PTR before including system.h.
	Include "c-family/name-hint.h"
	(cp_parser_diagnose_invalid_type_name): Convert
	"suggestion" from const char * to name_hint, and rename to "hint".
	Pass location to lookup_name_fuzzy.

From-SVN: r254963
2017-11-20 18:37:05 +00:00
Jeff Law
74ba745bdc Makefile.in (OBJS): Add gimple-ssa-evrp-analyze.o.
* Makefile.in (OBJS): Add gimple-ssa-evrp-analyze.o.
	* gimple-ssa-evrp-analyze.c: New file pulled from gimple-ssa-evrp.c.
	* gimple-ssa-evrp-analyze.h: New file pulled from gimple-ssa-evrp.c.
	* gimple-ssa-evrp.c: Remove bits moved into new files.  Include
	gimple-ssa-evrp-analyze.h.

From-SVN: r254961
2017-11-20 10:44:45 -07:00
Jeff Law
8c66dd9b33 gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Do not set BB_VISITED here.
* gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Do not
	set BB_VISITED here.
	(evrp_range_analyzer::enter): Set BB_VISITED here instead.

From-SVN: r254960
2017-11-20 10:29:33 -07:00
Nathan Sidwell
6aa80414a0 [PR c++/82878] pass-by-invisiref in lambda
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01115.html
	PR c++/82878
	PR c++/78495
	* call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited
	ctor.
	* cp-gimplify.c	(cp_genericize_r): Restore THUNK dereference
	inhibibition check removed in previous c++/78495 change.

	PR c++/82878
	* g++.dg/cpp0x/pr82878.C: New.
	* g++.dg/cpp1z/inh-ctor38.C: Check moves too.

From-SVN: r254958
2017-11-20 14:39:00 +00:00
Ville Voutilainen
7b7b60c830 Implement LWG 2353
* include/bits/stl_iterator_base_funcs.h (next):
Use InputIterator instead of ForwardIterator.
* testsuite/24_iterators/operations/lwg2353.cc: New.
* testsuite/24_iterators/operations/next_neg.cc: Remove.

From-SVN: r254957
2017-11-20 16:21:42 +02:00
Bin Cheng
9cdcebf971 tree-predcom.c: Add general comment on Store-Store chains.
* tree-predcom.c: Add general comment on Store-Store chains.
	(split_data_refs_to_components): Postpone clearing eliminate_store_p
	flag in component.
	(get_chain_last_ref_at): Rename into...
	(get_chain_last_write_at): ...this.
	(get_chain_last_write_before_load): New function.
	(add_ref_to_chain): Promote type of chain from CT_STORE_LOAD to
	CT_STORE_STORE when write reference is added.
	(determine_roots_comp): Support load ref in CT_STORE_STORE chains.
	(is_inv_store_elimination_chain): Update get_chain_last_write_at call.
	(initialize_root_vars_store_elim_1): Ditto.
	(initialize_root_vars_store_elim_2): Ditto.  Replace rhs once default
	definition is created.
	(execute_pred_commoning_chain): Support load ref in CT_STORE_STORE
	chain by replacing it with dominant stored value.

	gcc/testsuite
	* gcc.dg/tree-ssa/predcom-dse-12.c: New test.

From-SVN: r254956
2017-11-20 14:20:08 +00:00
Bin Cheng
90ef577378 * tree-predcom.c (add_ref_to_chain): Remove check on distance.
From-SVN: r254955
2017-11-20 14:15:30 +00:00
Marc Glisse
50dec459c6 VRP: x+1 and -x cannot be INT_MIN
2017-11-20  Marc Glisse  <marc.glisse@inria.fr>

gcc/
	* vr-values.c (extract_range_from_binary_expr): Use a full range
	for VR_VARYING.

gcc/testsuite/
	PR testsuite/82951
	* gcc.c-torture/execute/20040409-1.c: Move invalid tests...
	* gcc.c-torture/execute/20040409-1w.c: ... here with -fwrapv.
	* gcc.c-torture/execute/20040409-2.c: Move invalid tests...
	* gcc.c-torture/execute/20040409-2w.c: ... here with -fwrapv.
	* gcc.c-torture/execute/20040409-3.c: Move invalid tests...
	* gcc.c-torture/execute/20040409-3w.c: ... here with -fwrapv.
	* gcc.dg/tree-ssa/cmpmul-1.c: Tweak condition.
	* gcc.dg/tree-ssa/vrp118.c: New file.

From-SVN: r254954
2017-11-20 13:26:39 +00:00
Rainer Orth
9aab553436 Add g++.dg/pr82836.C requirements
* g++.dg/pr82836.C: Require int128, __float128 support.
	Add __float128 options.
	(size_t): Define using __SIZE_TYPE__.

From-SVN: r254953
2017-11-20 13:03:06 +00:00