gcc.git
5 years agodiagnostics: add labeling of source ranges
David Malcolm [Wed, 15 Aug 2018 18:09:35 +0000 (18:09 +0000)]
diagnostics: add labeling of source ranges

This patch adds the ability to label source ranges within a rich_location,
to be printed by diagnostic_show_locus.

For example:

pr69554-1.c:11:18: error: invalid operands to binary + (have 'const char *' and 'const char *')
11 |   return (p + 1) + (q + 1);
   |          ~~~~~~~ ^ ~~~~~~~
   |             |         |
   |             |         const char *
   |             const char *

The patch implements labels for various type mismatch errors in the C and
C++ frontends, and in -Wformat.  I implemented it wherever accurate location
information was guaranteed (there are other places that could benefit, but
we need better location information in those places).

The labels can be disabled via -fno-diagnostics-show-labels.

Similarly:

param-type-mismatch.C: In function 'int test_1(int, int, float)':
param-type-mismatch.C:11:27: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
11 |   return callee_1 (first, second, third);
   |                           ^~~~~~
   |                           |
   |                           int
param-type-mismatch.C:7:43: note:   initializing argument 2 of 'int callee_1(int, const char*, float)'
7 | extern int callee_1 (int one, const char *two, float three);
  |                               ~~~~~~~~~~~~^~~

where the first "error" describing the bad argument gets a label
describing the type inline (since it's non-obvious from "second").
The "note" describing the type of the param of the callee *doesn't*
get a label, since that information is explicit there in the
source ("const char *two").

The idea is that in any diagnostic where two aspects of the source aren't
in sync it ought to be easier for the user if we directly show them the
mismatching aspects inline (e.g. types).

As well as type mismatch errors, perhaps labels could also be used for
buffer overflow warnings, for describing the capacity of the destination
buffer vs the size of what's being written:

  sprintf (buf, "filename: %s\n", file);
           ^~~   ~~~~~~~~~~~^~~
           |                |
           capacity: 32     10 + strlen(file) + 2

or somesuch.  Another idea might be for macro expansion warnings:

warning: repeated side effects in macro expansion...
   x = MIN (p++, q++);
       ~~~~^~~~~~~~~~
note: ...expanded here as
 #define MIN(X,Y) (X<Y?X:Y)
         ^~~ ~ ~   ~ ~ ~ ~
             | |   | | | |
             | |   | | | q++
             | |   | | p++
             | |   | q++
             | q++ p++
             p++

The patch removes some logic from multiline.exp which special-cased
lines ending with a '|' character (thus complicating testing of this
patch).  I believe that this was a vestige from experiments I did to
support strippng dg directives from the output; it was present in the
earliest version of multiline.exp I posted:
  "[RFC, stage1] Richer source location information for gcc 6 (location ranges etc)"
    https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00837.html
and I believe was neved used.

gcc/c-family/ChangeLog:
* c-format.c: Include "selftest-diagnostic.h" and
"gcc-rich-location.h".
(format_warning_at_char): Pass NULL for new label params of
format_warning_va.
(class indirection_suffix): New class.
(class range_label_for_format_type_mismatch): New class.
(format_type_warning): Move logic for generating "*" suffix to
class indirection_suffix.  Create "fmt_label" and "param_label"
to show their types, and pass them to the
format_warning_at_substring calls.
(selftest::test_type_mismatch_range_labels): New test.
(selftest::c_format_c_tests): Call it.

gcc/c/ChangeLog:
* c-objc-common.c: Include "gcc-rich-location.h".
(c_tree_printer): Move implemenation of '%T' to...
(print_type): ...this new function.
(range_label_for_type_mismatch::get_text): New function.
* c-typeck.c (convert_for_assignment): Add type labels to the rhs
range for the various ic_argpass cases.
(class maybe_range_label_for_tree_type_mismatch): New class.
(build_binary_op): Use it when calling binary_op_error.

gcc/cp/ChangeLog:
* call.c: Include "gcc-rich-location.h".
(convert_like_real): Add range label for "invalid conversion"
diagnostic.
(perform_implicit_conversion_flags): Add type label to the
"could not convert" error.
* error.c: Include "gcc-rich-location.h".
(range_label_for_type_mismatch::get_text): New function.
* typeck.c (convert_for_assignment): Add type label to
the "cannot convert" error if a location is available.

gcc/ChangeLog:
* common.opt (fdiagnostics-show-labels): New option.
* diagnostic-show-locus.c (class layout_range): Add field
"m_label".
(class layout): Add field "m_show_labels_p".
(layout_range::layout_range): Add param "label" and use it to
initialize m_label.
(make_range): Pass in NULL for new "label" param of layout_range's
ctor.
(layout::layout): Initialize m_show_labels_p.
(layout::maybe_add_location_range): Pass in loc_range->m_label
when constructing layout_range instances.
(struct line_label): New struct.
(layout::print_any_labels): New member function.
(layout::print_line): Call it if label-printing is enabled.
(selftest::test_one_liner_labels): New test.
(selftest::test_diagnostic_show_locus_one_liner): Call it.
* diagnostic.c (diagnostic_initialize): Initialize
context->show_labels_p.
* diagnostic.h (struct diagnostic_context): Add field
"show_labels_p".
* doc/invoke.texi (Diagnostic Message Formatting Options): Add
-fno-diagnostics-show-labels.
* dwarf2out.c (gen_producer_string): Add
OPT_fdiagnostics_show_labels to the ignored options.
* gcc-rich-location.c (gcc_rich_location::add_expr): Add "label"
param.
(gcc_rich_location::maybe_add_expr): Likewise.
* gcc-rich-location.h (gcc_rich_location::gcc_rich_location): Add
label" param, defaulting to NULL.
(gcc_rich_location::add_expr): Add "label" param.
(gcc_rich_location::maybe_add_expr): Likewise.
(class text_range_label): New class.
(class range_label_for_type_mismatch): New class.
* gimple-ssa-sprintf.c (fmtwarn): Pass NULL for new label params
of format_warning_va.
(fmtwarn_n): Likewise for new params of format_warning_n_va.
* lto-wrapper.c (merge_and_complain): Add
OPT_fdiagnostics_show_labels to the "pick one setting" options.
(append_compiler_options): Likewise to the dropped options.
(append_diag_options): Likewise to the passed-on options.
* opts.c (common_handle_option): Handle the new option.
* selftest-diagnostic.c
(test_diagnostic_context::test_diagnostic_context): Enable
show_labels_p.
* substring-locations.c: Include "gcc-rich-location.h".
(format_warning_n_va): Add "fmt_label" and "param_label" params
and use them as appropriate.
(format_warning_va): Add "fmt_label" and "param_label" params,
passing them on to format_warning_n_va.
(format_warning_at_substring): Likewise.
(format_warning_at_substring_n): Likewise.
* substring-locations.h (format_warning_va): Add "fmt_label" and
"param_label" params.
(format_warning_n_va): Likewise.
(format_warning_at_substring): Likewise.
(format_warning_at_substring_n): Likewise.
* toplev.c (general_init): Initialize global_dc->show_labels_p.

gcc/testsuite/ChangeLog:
* g++.dg/diagnostic/aka3.C: New test.
* g++.dg/diagnostic/param-type-mismatch-2.C: Update expected
output to show range labels.
* g++.dg/diagnostic/param-type-mismatch.C: Likewise.
* g++.dg/plugin/plugin.exp (plugin_test_list): Add...
* g++.dg/plugin/show-template-tree-color-labels.C: New test.
* gcc.dg/bad-binary-ops.c: Update expected output to show range
labels.  Add an "aka" example.
* gcc.dg/cpp/pr66415-1.c: Update expected output to show range
labels.
* gcc.dg/format/diagnostic-ranges.c: Likewise.
* gcc.dg/format/pr72858.c: Likewise.
* gcc.dg/format/pr78498.c: Likewise.
* gcc.dg/param-type-mismatch.c: Add "-Wpointer-sign" to options.
Update expected output to show range labels.  Add examples of
-Wincompatible-pointer-types and -Wpointer-sign for parameters.
* gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c:
Update expected output to show range labels.
* gcc.dg/plugin/diagnostic-test-show-locus-bw.c: Likewise.
(test_very_wide_line): Adjust so that label is at left-clipping
boundary.
(test_very_wide_line_2): New test.
* gcc.dg/plugin/diagnostic-test-show-locus-color-line-numbers.c:
Update expected output to show range labels.
* gcc.dg/plugin/diagnostic-test-show-locus-color.c: Likewise.
* gcc.dg/plugin/diagnostic-test-show-locus-no-labels.c: New test.
* gcc.dg/plugin/diagnostic_plugin_show_trees.c (show_tree): Update
for new param to gcc_rich_location::add_expr.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (add_range):
Add "label" param.
(test_show_locus): Add examples of labels to various tests.  Tweak
the "very wide_line" test case and duplicate it, to cover the
boundary values for clipping of labels against the left-margin.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
diagnostic-test-show-locus-no-labels.c.
* gcc.dg/pr69554-1.c: Update expected output to show range labels.
Update line numbers of dg-locus directives.
* gcc.dg/pr69627.c:  Update expected output to show range labels.
* lib/multiline.exp (proc _build_multiline_regex): Remove
special-case handling of lines with trailing '|'.

libcpp/ChangeLog:
* include/line-map.h (struct location_range): Add "m_label" field.
(class rich_location): Add description of labels to leading
comment.
(rich_location::rich_location): Add "label" param, defaulting to
NULL.
(rich_location::add_range): Likewise.
(struct label_text): New struct.
(class range_label): New abstract base class.
* line-map.c (rich_location::rich_location): Add "label" param;
use it.
(rich_location::add_range): Likewise.

From-SVN: r263564

5 years agoDo not expand the call to memcmp at all when overflow is detected.
Qing Zhao [Wed, 15 Aug 2018 16:33:52 +0000 (16:33 +0000)]
Do not expand the call to memcmp at all when overflow is detected.

From-SVN: r263563

5 years agoc-decl.c (start_decl): Do not warn if variables is named as main and is a local variable.
Prathamesh Kulkarni [Wed, 15 Aug 2018 15:52:22 +0000 (15:52 +0000)]
c-decl.c (start_decl): Do not warn if variables is named as main and is a local variable.

2018-08-15  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

c/
* c-decl.c (start_decl): Do not warn if variables is named as main
and is a local variable.

testsuite/
* gcc.dg/wmain.c: New test.

From-SVN: r263562

5 years agoPR tree-optimization/71625 - missing strlen optimization on different array
Martin Sebor [Wed, 15 Aug 2018 15:25:46 +0000 (15:25 +0000)]
PR tree-optimization/71625 - missing strlen optimization on different array

PR tree-optimization/71625 - missing strlen optimization on different array
initialization style (avoid compilation errors on aarch64)

gcc/ChangeLog:
* config/aarch64/aarch64-builtins.c
(aarch64_init_simd_builtin_types): Clear Poly8_t's TYPE_STRING_FLAG.

From-SVN: r263561

5 years agoS/390: Remove branch splitting loop
Ilya Leoshkevich [Wed, 15 Aug 2018 12:24:54 +0000 (12:24 +0000)]
S/390: Remove branch splitting loop

Since there is no branch splitting anymore, the loop is no longer
necessary: pool chunkification can be done in one step.

gcc/ChangeLog:

2018-08-15  Ilya Leoshkevich  <iii@linux.ibm.com>

* config/s390/s390.c (s390_reorg): Remove loop.

From-SVN: r263557

5 years agoDon't make unsized objects into extern.
Iain Sandoe [Wed, 15 Aug 2018 11:45:44 +0000 (11:45 +0000)]
Don't make unsized objects into extern.

2018-08-15  Iain Sandoe <iain@sandoe.co.uk>

gcc/c:

        PR c/19315
        * c-decl.c (finish_decl): Don't add the 'extern' storage class to
        objects of unknown size.

gcc/testsuite:

        PR c/19315
        gcc.dg/graphite/pr82451.c: Make array 'a' an extern.
        gcc.dg/redecl-10.c: Expect warnings for the static vars with unknown
        size.

From-SVN: r263556

5 years agoDarwin - remove unnecessary target hook
Iain Sandoe [Wed, 15 Aug 2018 11:16:12 +0000 (11:16 +0000)]
Darwin - remove unnecessary target hook

gcc/

2018-08-15  Iain Sandoe  <iain@sandoe.co.uk>

* config/darwin.c
 (darwin_function_switched_text_sections): Delete.
* gcc/config/darwin.h
 (TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS): Likewise.

From-SVN: r263555

5 years agoFix single-threaded build for targets without atomics
Jonathan Wakely [Wed, 15 Aug 2018 09:56:33 +0000 (10:56 +0100)]
Fix single-threaded build for targets without atomics

* src/c++17/memory_resource.cc [!_GLIBCXX_HAS_GTHREADS]
(atomic_mem_res): Add unsynchronized definition for single-threaded.

From-SVN: r263554

5 years agoUpdate Darwin section names for DWARF5
Iain Sandoe [Wed, 15 Aug 2018 09:19:39 +0000 (09:19 +0000)]
Update Darwin section names for DWARF5

gcc/

2018-08-15  Iain Sandoe  <iain@sandoe.co.uk>

PR target/81685
* config/darwin.h: (DEBUG_STR_OFFSETS_SECTION, DEBUG_LOCLISTS_SECTION,
DEBUG_RNGLISTS_SECTION) new macros.  (DEBUG_PUBNAMES_SECTION,
DEBUG_PUBTYPES_SECTION) update to include GNU variant.

From-SVN: r263553

5 years agoFix merging of 2 predictors (PR tree-optimization/86925).
Martin Liska [Wed, 15 Aug 2018 08:55:15 +0000 (10:55 +0200)]
Fix merging of 2 predictors (PR tree-optimization/86925).

2018-08-15  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86925
* predict.c (expr_expected_value_1): When taking
        later predictor, assign also probability.
        Use fold_build2_initializer_loc in order to fold
        the expression in -frounding-math.
2018-08-15  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86925
* gcc.dg/predict-20.c: New test.
* gcc.dg/predict-21.c: New test.

From-SVN: r263552

5 years agodecl.c (check_previous_goto_1): When decl_jump_unsafe returns 2 emit an error instead...
Paolo Carlini [Wed, 15 Aug 2018 08:20:21 +0000 (08:20 +0000)]
decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2 emit an error instead of a permerror.

/cp
2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

* decl.c (check_previous_goto_1): When decl_jump_unsafe returns 2
emit an error instead of a permerror.

/testsuite
2018-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/init/goto3.C: Adjust for error instead of permerror.

From-SVN: r263551

5 years agobackport: ffi.c (ffi_call_go, [...]): New functions.
Andreas Schwab [Wed, 15 Aug 2018 06:57:45 +0000 (06:57 +0000)]
backport: ffi.c (ffi_call_go, [...]): New functions.

Backport of RISC-V support for libffi go closures
* src/riscv/ffi.c (ffi_call_go, ffi_prep_go_closure): New
functions.
(ffi_call_int): Renamed from ffi_call.
(ffi_call_asm, ffi_closure_inner): Adjust interface.
* src/riscv/ffitarget.h (FFI_GO_CLOSURES): Define.
* src/riscv/sysv.S (ffi_go_closure_asm): New function.
(ffi_closure_asm, ffi_call_asm): Update for adjusted interfaces.

From-SVN: r263550

5 years agoi386.c (expand_vec_perm_movs): New method matching movs patterns.
Allan Sandfeld Jensen [Wed, 15 Aug 2018 04:33:12 +0000 (10:33 +0600)]
i386.c (expand_vec_perm_movs): New method matching movs patterns.

* config/i386/i386.c (expand_vec_perm_movs): New method matching movs
patterns.
(expand_vec_perm_1): Try the new method.

* gcc.target/i386/sse2-movs.c: New test.

From-SVN: r263549

5 years agore PR target/86547 (s390x: Maximum number of LRA assignment passes is achieved (30...
Ilya Leoshkevich [Wed, 15 Aug 2018 04:09:45 +0000 (04:09 +0000)]
re PR target/86547 (s390x: Maximum number of LRA assignment passes is achieved (30) when compiling a small inline assembler snippet)

        PR target/86547
* lra-lives.c (remove_some_program_points_and_update_live_ranges):
        Check whether lra_live_max_point is 0 before dividing.

From-SVN: r263548

5 years agoDaily bump.
GCC Administrator [Wed, 15 Aug 2018 00:16:39 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263547

5 years agoInclude <sys/random.h> for getentropy on Solaris
Rainer Orth [Tue, 14 Aug 2018 22:51:36 +0000 (22:51 +0000)]
Include <sys/random.h> for getentropy on Solaris

* configure.ac: Check for <sys/random.h>.
* configure, config.h.in: Regenerate.
* intrinsics/random.c [HAVE_SYS_RANDOM_H]: Include <sys/random.h>.

From-SVN: r263543

5 years agoPR libstdc++/86954 use non-placement operator delete
Jonathan Wakely [Tue, 14 Aug 2018 20:19:20 +0000 (21:19 +0100)]
PR libstdc++/86954 use non-placement operator delete

As explained in the PR, there's no reason to call the nothrow delete,
we can just use the normal one.

PR libstdc++/86954
* include/bits/stl_tempbuf.h (return_temporary_buffer): Use
non-placement delete.

From-SVN: r263542

5 years agoPR tree-optimization/86650 - -Warray-bounds missing inlining context
Martin Sebor [Tue, 14 Aug 2018 19:11:20 +0000 (19:11 +0000)]
PR tree-optimization/86650 - -Warray-bounds missing inlining context

gcc/ChangeLog:

PR tree-optimization/86650
* tree-vrp.c (vrp_prop::check_array_ref): Print an inform message.
(vrp_prop::check_mem_ref): Same.

gcc/testsuite/ChangeLog:

PR tree-optimization/86650
* gcc.dg/Warray-bounds-34.c: New test.

From-SVN: r263541

5 years agore PR fortran/86116 (Ambiguous generic interface not recognised)
Janus Weil [Tue, 14 Aug 2018 19:09:33 +0000 (21:09 +0200)]
re PR fortran/86116 (Ambiguous generic interface not recognised)

2018-08-14  Janus Weil  <janus@gcc.gnu.org>

PR fortran/86116
* interface.c (compare_type): Remove a CLASS/TYPE check.
(compare_type_characteristics): New function that behaves like the old
'compare_type'.
(gfc_check_dummy_characteristics, gfc_check_result_characteristics):
Call 'compare_type_characteristics' instead of 'compare_type'.

2018-08-14  Janus Weil  <janus@gcc.gnu.org>

PR fortran/86116
* gfortran.dg/generic_34.f90: New test case.

From-SVN: r263540

5 years agoSimplify overflow checks in duration literals
Jonathan Wakely [Tue, 14 Aug 2018 13:55:21 +0000 (14:55 +0100)]
Simplify overflow checks in duration literals

* include/std/chrono (__check_overflow): Simplify definition.
(_Checked_integral_constant): Remove.

From-SVN: r263537

5 years agoPR libstdc++/86846 Alternative to pointer-width atomics
Jonathan Wakely [Tue, 14 Aug 2018 13:13:37 +0000 (14:13 +0100)]
PR libstdc++/86846 Alternative to pointer-width atomics

Define a class using std::mutex for when std::atomic<memory_resource*>
cannot be used to implement the default memory resource.

When std::mutex constructor is not constexpr the constant_init trick
won't work, so just define a global and use init_priority for it. The
compiler warns about using reserved priority, so put the definition in a
header file using #pragma GCC system_header to suppress the warning.

PR libstdc++/86846
* src/c++17/default_resource.h: New file, defining default_res.
* src/c++17/memory_resource.cc [ATOMIC_POINTER_LOCK_FREE != 2]
(atomic_mem_res): Define alternative for atomic<memory_resource*>
using a mutex instead of atomics.

From-SVN: r263536

5 years agoPR libstdc++/85343 overload __throw_ios_failure to take errno
Jonathan Wakely [Tue, 14 Aug 2018 12:09:57 +0000 (13:09 +0100)]
PR libstdc++/85343 overload __throw_ios_failure to take errno

[ios::failure] p2: "When throwing ios_base::failure exceptions,
implementations should provide values of ec that identify the specific
reason for the failure."

This adds a new overload of __throw_ios_failure that can be passed
errno, to store error_code(errno, system_category()) in the exception
object.

PR libstdc++/85343
* acinclude.m4 (libtool_VERSION): Bump version.
* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Add new symbol version.
Export new symbol.
* configure: Regenerate.
* doc/xml/manual/abi.xml: Document new versions.
* include/bits/fstream.tcc (basic_filebuf<C, T>::underflow)
(basic_filebuf<C, T>::xsgetn): Pass errno to __throw_ios_failure.
* include/bits/functexcept.h (__throw_ios_failure(const char*, int)):
Declare new overload.
* src/c++11/cxx11-ios_failure.cc (__ios_failure): Add new constructor
and static member function.
(__throw_ios_failure(const char*, int)): Define.
* src/c++98/ios_failure.cc [!_GLIBCXX_USE_DUAL_ABI]
(__throw_ios_failure(const char*, int)): Define.
* testsuite/util/testsuite_abi.cc: Update known and latest versions.

From-SVN: r263535

5 years agoRope iterators: don't retain pointers when copied
Jeremy Sawicki [Tue, 14 Aug 2018 11:23:50 +0000 (11:23 +0000)]
Rope iterators: don't retain pointers when copied

Rope iterators sometimes contain pointers to an internal buffer
inside the iterator itself.  When such an iterator is copied, the
copy incorrectly retains pointers to the original.

This patch takes the simple approach of not copying the cached
information when the internal buffer is being used, instead
requiring it to be recomputed when the copied iterator is
dereferenced.  An alternative would be to adjust the pointers so
they refer to the buffer in the copy.

2018-08-14  Jeremy Sawicki  <jeremy-gcc@sawicki.us>

* include/ext/rope (_Rope_iterator_base(const _Rope_iterator_base&))
(_Rope_const_iterator::operator=(const _Rope_const_iterator&))
(_Rope_iterator::operator=(const _Rope_iterator&)): Ensure
copied/assigned rope iterators don't retain pointers to the iterator
they were copied/assigned from.
* testsuite/ext/rope/7.cc: New.

From-SVN: r263534

5 years agopretty-print.c (eat_esc_sequence): Swap the foreground and background colors if...
Liu Hao [Tue, 14 Aug 2018 10:04:10 +0000 (10:04 +0000)]
pretty-print.c (eat_esc_sequence): Swap the foreground and background colors if...

* gcc/pretty-print.c (eat_esc_sequence): Swap the foreground and background
colors if the COMMON_LVB_REVERSE_VIDEO flag is set, and clear it thereafter,
as it only works for DBCS.

From-SVN: r263531

5 years agopretty-print.c (mingw_ansi_fputs): Do not call _close() on the handle returned by...
Liu Hao [Tue, 14 Aug 2018 10:02:09 +0000 (10:02 +0000)]
pretty-print.c (mingw_ansi_fputs): Do not call _close() on the handle returned by _get_osf_handle().

* gcc/pretty-print.c (mingw_ansi_fputs): Do not call _close() on the handle
returned by _get_osf_handle().

From-SVN: r263530

5 years agoDaily bump.
GCC Administrator [Tue, 14 Aug 2018 00:16:39 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263527

5 years agore PR c++/57891 (No diagnostic of narrowing conversion in non-type template argument)
Marek Polacek [Mon, 13 Aug 2018 23:12:11 +0000 (23:12 +0000)]
re PR c++/57891 (No diagnostic of narrowing conversion in non-type template argument)

PR c++/57891
* call.c (struct conversion): Add check_narrowing_const_only.
(build_converted_constant_expr): Set check_narrowing and
check_narrowing_const_only.  Give error if expr is error node.
(convert_like_real): Pass it to check_narrowing.
* cp-tree.h (check_narrowing): Add a default parameter.
* decl.c (compute_array_index_type): Use input_location instead of
location_of.
* pt.c (convert_nontype_argument): Return NULL_TREE if tf_error.
* typeck2.c (check_narrowing): Don't warn for instantiation-dependent
expressions.  Call maybe_constant_value instead of
fold_non_dependent_expr.  Don't mention { } in diagnostic.  Only check
narrowing for constants if CONST_ONLY.

* g++.dg/cpp0x/Wnarrowing6.C: New test.
* g++.dg/cpp0x/Wnarrowing7.C: New test.
* g++.dg/cpp0x/Wnarrowing8.C: New test.
* g++.dg/cpp0x/Wnarrowing9.C: New test.
* g++.dg/cpp0x/Wnarrowing10.C: New test.
* g++.dg/cpp0x/constexpr-47969.C: Adjust dg-error.
* g++.dg/cpp0x/constexpr-ex2.C: Likewise.
* g++.dg/cpp0x/constexpr-targ.C: Likewise.
* g++.dg/cpp0x/scoped_enum2.C: Likewise.
* g++.dg/ext/stmtexpr15.C: Likewise.
* g++.dg/gomp/pr47963.C: Likewise.
* g++.dg/init/new37.C: Likewise.
* g++.dg/init/new43.C: Likewise.
* g++.dg/other/fold1.C: Likewise.
* g++.dg/parse/array-size2.C: Likewise.
* g++.dg/template/dependent-name3.C: Likewise.
* g++.dg/cpp0x/constexpr-data2.C: Add dg-error.
* g++.dg/other/vrp1.C: Likewise.
* g++.dg/template/char1.C: Likewise.

From-SVN: r263523

5 years agoUse getentropy() for seeding PRNG
Janne Blomqvist [Mon, 13 Aug 2018 20:21:50 +0000 (23:21 +0300)]
Use getentropy() for seeding PRNG

The getentropy function, found on Linux, OpenBSD, and recently also
FreeBSD, can be used to get random bytes to initialize the PRNG.  It
is similar to the traditional way of reading from /dev/urandom, but
being a system call rather than a special file, it doesn't suffer from
problems like running out of file descriptors, or failure when running
in a container where /dev/urandom may not be available.

Regtested on x86_64-pc-linux-gnu, Ok for trunk?

2018-08-13  Janne Blomqvist  <jb@gcc.gnu.org>

* configure.ac: Check for getentropy.
* intrinsics/random.c (getosrandom): Use getentropy if available.
* config.h.in: Regenerated.
* configure: Regenerated.

From-SVN: r263522

5 years agors6000: Fix pr56605.c
Segher Boessenkool [Mon, 13 Aug 2018 19:27:56 +0000 (21:27 +0200)]
rs6000: Fix pr56605.c

After the combine 2-2 changes, this testcase does not have a ZERO_EXTEND
in the intermediate code, but an AND instead.

gcc/testsuite/
* gcc.target/powerpc/pr56605.c: The generated code can have an AND
instead of a ZERO_EXTEND.

From-SVN: r263521

5 years agors6000.c (rs6000_gimple_fold_builtin): Add support for folding vec_perm.
Will Schmidt [Mon, 13 Aug 2018 19:23:38 +0000 (19:23 +0000)]
rs6000.c (rs6000_gimple_fold_builtin): Add support for folding vec_perm.

[gcc]

2018-07-06  Will Schmidt  <will_schmidt@vnet.ibm.com>

* gcc/config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add support
for folding vec_perm.

From-SVN: r263520

5 years agors6000.c (rs6000_gimple_fold_builtin): Add support for gimple-folding of vec_pack...
Will Schmidt [Mon, 13 Aug 2018 19:18:53 +0000 (19:18 +0000)]
rs6000.c (rs6000_gimple_fold_builtin): Add support for gimple-folding of vec_pack() and vec_unpack() intrinsics.

[gcc]

2018-08-13 Will Schmidt  <will_schmidt@vnet.ibm.com>

* config/rs6000/rs6000.c (rs6000_gimple_fold_builtin):
Add support for gimple-folding of vec_pack() and vec_unpack()
intrinsics.

From-SVN: r263519

5 years agoPR libstdc++/45093 avoid warnings for _M_destroy_node
Jonathan Wakely [Mon, 13 Aug 2018 18:54:43 +0000 (19:54 +0100)]
PR libstdc++/45093 avoid warnings for _M_destroy_node

PR libstdc++/45093
* include/bits/stl_tree.h (_Rb_tree::_M_destroy_node(_Link_type)):
Combine definitions to avoid --detect-odr-violations warning.

From-SVN: r263516

5 years agoMinor optimisations in operator new(size_t, align_val_t)
Jonathan Wakely [Mon, 13 Aug 2018 18:54:38 +0000 (19:54 +0100)]
Minor optimisations in operator new(size_t, align_val_t)

* libsupc++/new_opa.cc (operator new(size_t, align_val_t)): Use
__is_pow2 to check for valid alignment. Avoid branching when rounding
size to multiple of alignment.

From-SVN: r263515

5 years agoAdd <bit> and <version> to freestanding headers
Jonathan Wakely [Mon, 13 Aug 2018 18:54:34 +0000 (19:54 +0100)]
Add <bit> and <version> to freestanding headers

* include/Makefile.am: Install <bit> and <version> for freestanding.
* include/Makefile.in: Regenerate.
* testsuite/17_intro/freestanding.cc: Check for <bit> and <version>.

From-SVN: r263514

5 years agoRevert "libstdc++-v3: Have aligned_alloc() on Newlib"
Jonathan Wakely [Mon, 13 Aug 2018 18:54:21 +0000 (19:54 +0100)]
Revert "libstdc++-v3: Have aligned_alloc() on Newlib"

This reverts commit r263461 / 2e920cd849b3cf0a72df4f172e27676a3e70b73f
because aligned_alloc is not defined for baremetal newlib targets, see
https://gcc.gnu.org/ml/libstdc++/2018-08/msg00065.html

Revert
2018-08-10  Sebastian Huber  <sebastian.huber@embedded-brains.de>

PR target/85904
* configure.ac: Define HAVE_ALIGNED_ALLOC if building for
Newlib.
* configure: Regenerate.

From-SVN: r263513

5 years agors6000.c (rs6000_builtin_valid_without_lhs): Add vec_xst variants to the list.
Will Schmidt [Mon, 13 Aug 2018 18:13:20 +0000 (18:13 +0000)]
rs6000.c (rs6000_builtin_valid_without_lhs): Add vec_xst variants to the list.

[gcc]

2018-08-13 Will Schmidt <will_schmidt@vnet.ibm.com>

* config/rs6000/rs6000.c (rs6000_builtin_valid_without_lhs): Add
vec_xst variants to the list.
(rs6000_gimple_fold_builtin): Add support for folding unaligned
vector loads and stores.

From-SVN: r263512

5 years agoPR tree-optimization/71625 - missing strlen optimization on different array initializ...
Martin Sebor [Mon, 13 Aug 2018 17:57:51 +0000 (17:57 +0000)]
PR tree-optimization/71625 - missing strlen optimization on different array initialization style

gcc/c/ChangeLog:

PR tree-optimization/71625
* c-parser.c (c_parser_declaration_or_fndef): Call
braced_list_to_string.

gcc/c-family/ChangeLog:

PR tree-optimization/71625
* c-common.c (braced_list_to_string): New function.
* c-common.h (braced_list_to_string): Declare it.

gcc/cp/ChangeLog:

PR tree-optimization/71625
* decl.c (check_initializer):  Call braced_list_to_string.
(eval_check_narrowing): New function.
* gcc/cp/typeck2.c (digest_init_r): Accept strings literals
as initilizers for all narrow character types.

gcc/testsuite/ChangeLog:

PR tree-optimization/71625

* g++.dg/init/string2.C: New test.
* g++.dg/init/string3.C: New test.
* g++.dg/init/string4.C: New test.
* gcc.dg/init-string-3.c: New test.
* gcc.dg/strlenopt-55.c: New test.
* gcc.dg/strlenopt-56.c: New test.

From-SVN: r263511

5 years agoP0806R2 - Deprecate implicit capture of this via [=]
Marek Polacek [Mon, 13 Aug 2018 15:46:42 +0000 (15:46 +0000)]
P0806R2 - Deprecate implicit capture of this via [=]

P0806R2 - Deprecate implicit capture of this via [=]
* lambda.c (add_default_capture): Formatting fixes.  Warn about
deprecated implicit capture of this via [=].

* g++.dg/cpp2a/lambda-this1.C: New test.
* g++.dg/cpp2a/lambda-this2.C: New test.
* g++.dg/cpp2a/lambda-this3.C: New test.

From-SVN: r263508

5 years agore PR c++/86915 (Segmentation fault for an array of auto in template parameter)
Marek Polacek [Mon, 13 Aug 2018 15:36:30 +0000 (15:36 +0000)]
re PR c++/86915 (Segmentation fault for an array of auto in template parameter)

PR c++/86915
* decl.c (create_array_type_for_decl): Handle null name.

* g++.dg/diagnostic/auto1.C: New test.

From-SVN: r263507

5 years agoconfig.gcc (rs6000-ibm-aix4.x): Delete.
David Edelsohn [Mon, 13 Aug 2018 13:37:19 +0000 (13:37 +0000)]
config.gcc (rs6000-ibm-aix4.x): Delete.

        * config.gcc (rs6000-ibm-aix4.x): Delete.
        (rs6000-ibm-aix5.1): Delete.
        (rs6000-ibm-aix5.2): Delete.
        (rs6000-ibm-aix5.3): Delete.
        * config/rs6000/aix43.h: Delete.
        * config/rs6000/aix51.h: Delete.
        * config/rs6000/aix52.h: Delete.
        * config/rs6000/t-aix43: Delete.

From-SVN: r263506

5 years ago[nvptx] Use CUDA driver API to select default runtime launch geometry
Cesar Philippidis [Mon, 13 Aug 2018 12:04:24 +0000 (05:04 -0700)]
[nvptx] Use CUDA driver API to select default runtime launch geometry

The CUDA driver API starting version 6.5 offers a set of runtime functions to
calculate several occupancy-related measures, as a replacement for the occupancy
calculator spreadsheet.

This patch adds a heuristic for default runtime launch geometry, based on the
new runtime function cuOccupancyMaxPotentialBlockSize.

Build on x86_64 with nvptx accelerator and ran libgomp testsuite.

2018-08-13  Cesar Philippidis  <cesar@codesourcery.com>
    Tom de Vries  <tdevries@suse.de>

PR target/85590
* plugin/cuda/cuda.h (CUoccupancyB2DSize): New typedef.
(cuOccupancyMaxPotentialBlockSize): Declare.
* plugin/cuda-lib.def (cuOccupancyMaxPotentialBlockSize): New
CUDA_ONE_CALL_MAYBE_NULL.
* plugin/plugin-nvptx.c (CUDA_VERSION < 6050): Define
CUoccupancyB2DSize and declare
cuOccupancyMaxPotentialBlockSize.
(nvptx_exec): Use cuOccupancyMaxPotentialBlockSize to set the
default num_gangs and num_workers when the driver supports it.

Co-Authored-By: Tom de Vries <tdevries@suse.de>
From-SVN: r263505

5 years agoS/390: Factor out constant pool ref decomposition
Ilya Leoshkevich [Mon, 13 Aug 2018 11:33:38 +0000 (11:33 +0000)]
S/390: Factor out constant pool ref decomposition

gcc/ChangeLog:

2018-08-13  Ilya Leoshkevich  <iii@linux.ibm.com>

* config/s390/s390.c (s390_decompose_constant_pool_ref):
        New function.
(s390_decompose_address): Factor out constant pool ref
        decomposition.

From-SVN: r263504

5 years agoDaily bump.
GCC Administrator [Mon, 13 Aug 2018 00:16:33 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263503

5 years agore PR fortran/66679 ([OOP] ICE with class(*) and transfer)
Paul Thomas [Sun, 12 Aug 2018 17:19:09 +0000 (17:19 +0000)]
re PR fortran/66679 ([OOP] ICE with class(*) and transfer)

2018-08-12  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/66679
* trans-intrinsic.c (gfc_conv_intrinsic_transfer): Class array
elements are returned as references to the data element. Get
the class expression by stripping back the references. Use this
for the element size.

2018-08-12  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/66679
* gfortran.dg/transfer_class_3.f90: New test.

From-SVN: r263499

5 years ago[NDS32] Change return type of predicator to bool.
Chung-Ju Wu [Sun, 12 Aug 2018 15:21:02 +0000 (15:21 +0000)]
[NDS32] Change return type of predicator to bool.

gcc/
* config/nds32/nds32-predicates.c
(nds32_can_use_bclr_p): Change return type as bool.
(nds32_can_use_bset_p): Ditto.
(nds32_can_use_btgl_p): Ditto.
(nds32_can_use_bitci_p): Ditto.
* config/nds32/nds32-protos.h
(nds32_can_use_bclr_p): Change declaration.
(nds32_can_use_bset_p): Ditto.
(nds32_can_use_btgl_p): Ditto.
(nds32_can_use_bitci_p): Ditto.

From-SVN: r263497

5 years ago[NDS32] Add new option: -msched-prolog-epilog
Chung-Ju Wu [Sun, 12 Aug 2018 13:41:22 +0000 (13:41 +0000)]
[NDS32] Add new option: -msched-prolog-epilog

gcc/
* config/nds32/nds32.c (nds32_expand_prologue, nds32_expand_epilogue):
Support -msched-prolog-epilog option.
* config/nds32/nds32.opt (msched-prolog-epilog): New option.

From-SVN: r263496

5 years ago[NDS32] Enable -malways-align by default at -O1 and above.
Chung-Ju Wu [Sun, 12 Aug 2018 13:26:05 +0000 (13:26 +0000)]
[NDS32] Enable -malways-align by default at -O1 and above.

gcc/
* common/config/nds32/nds32-common.c
(nds32_option_optimization_table): Enalbe -malways-align.

From-SVN: r263495

5 years agore PR fortran/86906 (erroneous name clash with renaming in use statement)
Paul Thomas [Sun, 12 Aug 2018 10:55:13 +0000 (10:55 +0000)]
re PR fortran/86906 (erroneous name clash with renaming in use statement)

2018-08-12  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/86906
* resolve.c (resolve_fl_variable_derived): Check if the derived
type is use associated before checking for the host association
error.

2018-08-12  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/86906
* gfortran.dg/use_rename_9.f90: New test.

From-SVN: r263494

5 years ago[NDS32] Implement more C ISR extension.
Chung-Ju Wu [Sun, 12 Aug 2018 07:38:40 +0000 (07:38 +0000)]
[NDS32] Implement more C ISR extension.

gcc/
* config.gcc (nds32*): Add nds32_isr.h and nds32_init.inc in
extra_headers.
* common/config/nds32/nds32-common.c (nds32_handle_option): Handle
OPT_misr_secure_ case.
* config/nds32/nds32-isr.c: Implementation of backward compatibility.
* config/nds32/nds32-protos.h (nds32_isr_function_critical_p): New.
* config/nds32/nds32.c (nds32_attribute_table): Add critical and
secure attribute.
* config/nds32/nds32.h (nds32_isr_nested_type): Add NDS32_CRITICAL.
(nds32_isr_info): New field security_level.
(TARGET_ISR_VECTOR_SIZE_4_BYTE): New macro.
* config/nds32/nds32.md (return_internal): Consider critical attribute.
* config/nds32/nds32.opt (misr-secure): New option.
* config/nds32/nds32_init.inc: New file.
* config/nds32/nds32_isr.h: New file.

libgcc/
* config/nds32/t-nds32-isr: Rearrange object dependency.
* config/nds32/initfini.c: Add dwarf2 unwinding support.
* config/nds32/isr-library/adj_intr_lvl.inc: Consider new extensions
and registers usage.
* config/nds32/isr-library/excp_isr.S: Ditto.
* config/nds32/isr-library/intr_isr.S: Ditto.
* config/nds32/isr-library/reset.S: Ditto.
* config/nds32/isr-library/restore_all.inc: Ditto.
* config/nds32/isr-library/restore_mac_regs.inc: Ditto.
* config/nds32/isr-library/restore_partial.inc: Ditto.
* config/nds32/isr-library/restore_usr_regs.inc: Ditto.
* config/nds32/isr-library/save_all.inc: Ditto.
* config/nds32/isr-library/save_mac_regs.inc: Ditto.
* config/nds32/isr-library/save_partial.inc: Ditto.
* config/nds32/isr-library/save_usr_regs.inc: Ditto.
* config/nds32/isr-library/vec_vid*.S: Consider 4-byte vector size.

From-SVN: r263493

5 years agoDaily bump.
GCC Administrator [Sun, 12 Aug 2018 00:16:29 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263492

5 years agopa.md (UNSPEC_MEMORY_BARRIER): New unspec enum.
John David Anglin [Sat, 11 Aug 2018 21:37:55 +0000 (21:37 +0000)]
pa.md (UNSPEC_MEMORY_BARRIER): New unspec enum.

gcc
* config/pa/pa.md (UNSPEC_MEMORY_BARRIER): New unspec enum.
Update comment for atomic instructions.
(atomic_storeqi, atomic_storehi, atomic_storesi, atomic_storesf,
atomic_loaddf, atomic_loaddf_1, atomic_storedf, atomic_storedf_1):
Remove.
(atomic_loaddi): Revise fence expansion to only emit fence prior to
load for __ATOMIC_SEQ_CST model.
(atomic_loaddi_1): Remove float register target.
(atomic_storedi): Handle CONST_INT values.
(atomic_storedi_1): Remove float register source.  Add special case
for zero value.
(memory_barrier): New expander and insn.

libgcc
* config/pa/linux-atomic.c: Update comment.
(FETCH_AND_OP_2, OP_AND_FETCH_2, FETCH_AND_OP_WORD, OP_AND_FETCH_WORD,
COMPARE_AND_SWAP_2, __sync_val_compare_and_swap_4,
SYNC_LOCK_TEST_AND_SET_2, __sync_lock_test_and_set_4): Use
__ATOMIC_RELAXED for atomic loads.
(SYNC_LOCK_RELEASE_1): New define.  Use __sync_synchronize() and
unordered store to release lock.
(__sync_lock_release_8): Likewise.
(SYNC_LOCK_RELEASE_2): Remove define.

From-SVN: r263488

5 years agore PR tree-optimization/86835 (Bogus "is used uninitialized" warning with -ffast...
Jakub Jelinek [Sat, 11 Aug 2018 11:29:12 +0000 (13:29 +0200)]
re PR tree-optimization/86835 (Bogus "is used uninitialized" warning with -ffast-math)

PR tree-optimization/86835
* tree-ssa-math-opts.c (insert_reciprocals): Even when inserting
new_stmt after def_gsi, make sure to insert new_square_stmt after
that stmt, not 2 stmts before it.

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

From-SVN: r263487

5 years agoPR c++/86728 - C variadic generic lambda.
Jason Merrill [Sat, 11 Aug 2018 10:47:03 +0000 (06:47 -0400)]
PR c++/86728 - C variadic generic lambda.

* parser.c (cp_parser_parameter_declaration): Don't turn 'auto' into
a pack if it's followed by a declarator-id.

From-SVN: r263484

5 years agoDaily bump.
GCC Administrator [Sat, 11 Aug 2018 00:16:30 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263483

5 years agoPR libstdc++/68210 adjust operator new and delete for LWG 206
Jonathan Wakely [Fri, 10 Aug 2018 20:20:27 +0000 (21:20 +0100)]
PR libstdc++/68210 adjust operator new and delete for LWG 206

Ensure that nothrow versions of new and delete call the ordinary
versions of new or delete, instead of calling malloc or free directly.

These files are all compiled with -std=gnu++14 so can use noexcept and
nullptr to make the code more readable.

PR libstdc++/68210
* doc/xml/manual/intro.xml: Document LWG 206 change.
* libsupc++/del_op.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
* libsupc++/del_opa.cc: Likewise.
* libsupc++/del_opant.cc: Likewise.
* libsupc++/del_opnt.cc: Likewise. Call operator delete(ptr) instead
of free(ptr).
* libsupc++/del_ops.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
* libsupc++/del_opsa.cc: Likewise.
* libsupc++/del_opva.cc: Likewise.
* libsupc++/del_opvant.cc: Likewise.
* libsupc++/del_opvnt.cc: Likewise. Call operator delete[](ptr)
instead of operator delete(ptr).
* libsupc++/del_opvs.cc: Replace _GLIBCXX_USE_NOEXCEPT with noexcept.
* libsupc++/del_opvsa.cc: Likewise.
* libsupc++/new_op.cc: Use __builtin_expect in check for zero size.
* libsupc++/new_opa.cc: Use nullptr instead of literal 0.
* libsupc++/new_opant.cc: Likewise. Replace _GLIBCXX_USE_NOEXCEPT
with noexcept.
* libsupc++/new_opnt.cc: Likewise. Call operator new(sz) instead of
malloc(sz).
* libsupc++/new_opvant.cc: Use nullptr and noexcept.
* libsupc++/new_opvnt.cc: Likewise. Call operator new[](sz) instead of
operator new(sz, nothrow).
* testsuite/18_support/new_nothrow.cc: New test.

From-SVN: r263478

5 years agoFix formatting in ChangeLog
Jonathan Wakely [Fri, 10 Aug 2018 19:04:01 +0000 (20:04 +0100)]
Fix formatting in ChangeLog

From-SVN: r263476

5 years agore PR fortran/57160 (short-circuit IF only with -ffrontend-optimize)
Janus Weil [Fri, 10 Aug 2018 14:08:53 +0000 (16:08 +0200)]
re PR fortran/57160 (short-circuit IF only with -ffrontend-optimize)

2018-08-10  Janus Weil  <janus@gcc.gnu.org>

PR fortran/57160
* invoke.texi (frontend-optimize): Mention short-circuiting.
* options.c (gfc_post_options): Disable -ffrontend-optimize with -Og.
* resolve.c (resolve_operator): Warn about short-circuiting only with
-ffrontend-optimize.
* trans-expr.c (gfc_conv_expr_op): Use short-circuiting operators only
with -ffrontend-optimize. Without that flag, make sure that both
operands are evaluated.

2018-08-10  Janus Weil  <janus@gcc.gnu.org>

PR fortran/57160
* gfortran.dg/actual_pointer_function_1.f90: Fix invalid test case.
* gfortran.dg/inline_matmul_23.f90: Add option "-ffrontend-optimize".
* gfortran.dg/short_circuiting_2.f90: New test case.
* gfortran.dg/short_circuiting_3.f90: New test case.

From-SVN: r263471

5 years agoRemove not needed __builtin_expect due to malloc predictor.
Martin Liska [Fri, 10 Aug 2018 11:40:40 +0000 (13:40 +0200)]
Remove not needed __builtin_expect due to malloc predictor.

2018-08-10  Martin Liska  <mliska@suse.cz>

* libsupc++/new_op.cc (new): Remove __builtin_expect as malloc
        predictor can handle that.
* libsupc++/new_opa.cc: Likewise.
* libsupc++/new_opnt.cc (new): Likewise.

From-SVN: r263470

5 years agoFix wrongly removed line.
Martin Liska [Fri, 10 Aug 2018 11:38:12 +0000 (13:38 +0200)]
Fix wrongly removed line.

2018-08-10  Martin Liska  <mliska@suse.cz>

* MAINTAINERS: Revert change in previous commit and
        join lines.

From-SVN: r263469

5 years agoFix extra line in MAINTAINERS.
Martin Liska [Fri, 10 Aug 2018 10:36:12 +0000 (12:36 +0200)]
Fix extra line in MAINTAINERS.

2018-08-10  Martin Liska  <mliska@suse.cz>

* MAINTAINERS: Remove extra line.

From-SVN: r263468

5 years agoi386: do not use SImode mul-highpart on 64-bit (PR 82418)
Alexander Monakov [Fri, 10 Aug 2018 10:13:37 +0000 (13:13 +0300)]
i386: do not use SImode mul-highpart on 64-bit (PR 82418)

PR target/82418
* config/i386/i386.md (<s>mul<mode>3_highpart): Use DWIH mode iterator
instead of SWI48.

testsuite/
* gcc.target/i386/pr82418.c: New test.

From-SVN: r263467

5 years agoIntroduce __builtin_expect_with_probability (PR target/83610).
Martin Liska [Fri, 10 Aug 2018 09:43:06 +0000 (11:43 +0200)]
Introduce __builtin_expect_with_probability (PR target/83610).

2018-08-10  Martin Liska  <mliska@suse.cz>

        PR target/83610
* builtin-types.def (BT_FN_LONG_LONG_LONG_DOUBLE): Add new
        function type.
* builtins.c (expand_builtin_expect_with_probability):
        New function.
(expand_builtin_expect_with_probability): New function.
(build_builtin_expect_predicate): Add new argumnet probability
        for BUILT_IN_EXPECT_WITH_PROBABILITY.
(fold_builtin_expect):
(fold_builtin_2):
(fold_builtin_3):
* builtins.def (BUILT_IN_EXPECT_WITH_PROBABILITY):
* builtins.h (fold_builtin_expect): Set new argument.
* doc/extend.texi: Document __builtin_expect_with_probability.
* doc/invoke.texi: Likewise.
* gimple-fold.c (gimple_fold_call): Pass new argument.
* ipa-fnsummary.c (find_foldable_builtin_expect): Handle
        also BUILT_IN_EXPECT_WITH_PROBABILITY.
* predict.c (get_predictor_value): New function.
(expr_expected_value): Add new argument probability. Assume
        that predictor and probability are always non-null.
(expr_expected_value_1): Likewise.  For __builtin_expect and
        __builtin_expect_with_probability set probability.  Handle
        combination in binary expressions.
(tree_predict_by_opcode): Simplify code by simply calling
        get_predictor_value.
(pass_strip_predict_hints::execute): Add handling of
        BUILT_IN_EXPECT_WITH_PROBABILITY.
* predict.def (PRED_BUILTIN_EXPECT_WITH_PROBABILITY): Add
        new predictor.
* tree.h (DECL_BUILT_IN_P): New function.
2018-08-10  Martin Liska  <mliska@suse.cz>

        PR target/83610
* gcc.dg/predict-17.c: New test.
* gcc.dg/predict-18.c: New test.
* gcc.dg/predict-19.c: New test.

From-SVN: r263466

5 years agoStrip only selected predictors after early tree passes (PR tree-optimization/85799).
Martin Liska [Fri, 10 Aug 2018 09:31:51 +0000 (11:31 +0200)]
Strip only selected predictors after early tree passes (PR tree-optimization/85799).

2018-08-10  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/85799
* passes.def: Add argument for pass_strip_predict_hints.
* predict.c (class pass_strip_predict_hints): Add new argument
        early_p.
(strip_predictor_early): New function.
(pass_strip_predict_hints::execute): Call the function to
        strip predictors.
(strip_predict_hints): New function.
* predict.def: Fix comment.
2018-08-10  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/85799
* gcc.dg/pr85799.c: New test.

From-SVN: r263465

5 years agoClarify source of tm.texi to copy for GFDL grant
Thomas Preud'homme [Fri, 10 Aug 2018 08:48:34 +0000 (08:48 +0000)]
Clarify source of tm.texi to copy for GFDL grant

When tm.texi.in is updated in the source tree, the following message
gets displayed:

Verify that you have permission to grant a GFDL license for all
new text in tm.texi, then copy it to <gcc src dir>/gcc/doc/tm.texi.

Having been myself and some colleagues confused several time by that
message as to what tm.texi to copy, I think it would be clearer to
indicate the absolute path for the source as well. This patch achieves
that.

2018-08-10  Thomas Preud'homme  <thomas.preudhomme@linaro.org>

    gcc/
    * Makefile.in: Clarify which tm.texi to copy over to assert the
    right to grant a GFDL license for all.

From-SVN: r263464

5 years agolibstdc++-v3: Have aligned_alloc() on Newlib
Sebastian Huber [Fri, 10 Aug 2018 06:27:35 +0000 (06:27 +0000)]
libstdc++-v3: Have aligned_alloc() on Newlib

While building for Newlib, some configure checks must be hard coded.
The aligned_alloc() is supported since 2015 in Newlib.

libstdc++-v3/

PR target/85904
* configure.ac: Define HAVE_ALIGNED_ALLOC if building for
Newlib.
* configure: Regenerate.

From-SVN: r263461

5 years agoDaily bump.
GCC Administrator [Fri, 10 Aug 2018 00:16:29 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263460

5 years agoDefine aliases for containers using polymorphic_allocator
Jonathan Wakely [Thu, 9 Aug 2018 23:25:53 +0000 (00:25 +0100)]
Define aliases for containers using polymorphic_allocator

These aliases are placed in the top-level header, e.g. <vector> not
<bits/stl_vector.h>. This ensures that they refer to whichever of
std::vector or __debug::vector or __profile::vector is in use when the
header is included.

* include/std/deque (std::pmr::deque): Declare alias.
* include/std/forward_list (std::pmr::forward_list): Likewise.
* include/std/list (std::pmr::list): Likewise.
* include/std/map (std::pmr::map, std::pmr::multimap): Likewise.
* include/std/regex (std::pmr::match_results, std::pmr::cmatch)
(std::pmr::smatch, std::pmr::wcmatch, std::pmr::wsmatch): Likewise.
* include/std/set (std::pmr::set, std::pmr::multiset): Likewise.
* include/std/string (std::pmr::basic_string, std::pmr::string)
(std::pmr::u16string, std::pmr::u32string, std::pmr::wstring):
Likewise.
* include/std/unordered_map (std::pmr::unordered_map)
(std::pmr::unordered_multimap): Likewise.
* include/std/unordered_set (std::pmr::unordered_set)
(std::pmr::unordered_multiset): Likewise.
* include/std/vector (std::pmr::vector): Likewise.
* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: New test.
* testsuite/23_containers/deque/types/pmr_typedefs.cc: New test.
* testsuite/23_containers/forward_list/pmr_typedefs.cc: New test.
* testsuite/23_containers/list/pmr_typedefs.cc: New test.
* testsuite/23_containers/map/pmr_typedefs.cc: New test.
* testsuite/23_containers/multimap/pmr_typedefs.cc: New test.
* testsuite/23_containers/multiset/pmr_typedefs.cc: New test.
* testsuite/23_containers/set/pmr_typedefs.cc: New test.
* testsuite/23_containers/unordered_map/pmr_typedefs.cc: New test.
* testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: New
test.
* testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: New
test.
* testsuite/23_containers/unordered_set/pmr_typedefs.cc: New test.
* testsuite/23_containers/vector/pmr_typedefs.cc: New test.
* testsuite/28_regex/match_results/pmr_typedefs.cc: New test.

From-SVN: r263456

5 years agom68k.c (m68k_adjust_decorated_operand): Remove unused variable.
Jeff Law [Thu, 9 Aug 2018 17:18:43 +0000 (11:18 -0600)]
m68k.c (m68k_adjust_decorated_operand): Remove unused variable.

* config/m68k/m68k.c (m68k_adjust_decorated_operand): Remove
unused variable.

From-SVN: r263455

5 years agore PR middle-end/86897 (gcc.dg/uninit-suppress_2.c FAILs)
Jeff Law [Thu, 9 Aug 2018 17:11:45 +0000 (11:11 -0600)]
re PR middle-end/86897 (gcc.dg/uninit-suppress_2.c FAILs)

PR middle-end/86897
* gcc.dg/uninit-suppress_2.c: Disable DOM.

From-SVN: r263454

5 years agoAdd missing PR to Nios fix for CVE-2017-5753
Richard Earnshaw [Thu, 9 Aug 2018 16:53:48 +0000 (16:53 +0000)]
Add missing PR to Nios fix for CVE-2017-5753

I nearly missed this patch for my accumulated back-porting list since
it didn't have the PR number in it.

Just adding it so that I can track things properly.  The original
commit landed as r263301.

From-SVN: r263453

5 years agom68k-protos.h (m68k_final_prescan_insn): Remove prototype.
Andreas Schwab [Thu, 9 Aug 2018 16:25:12 +0000 (16:25 +0000)]
m68k-protos.h (m68k_final_prescan_insn): Remove prototype.

* config/m68k/m68k-protos.h (m68k_final_prescan_insn): Remove
prototype.

From-SVN: r263452

5 years agoAllow inner-loop reductions with variable-length vectors
Richard Sandiford [Thu, 9 Aug 2018 16:03:25 +0000 (16:03 +0000)]
Allow inner-loop reductions with variable-length vectors

While working on PR 86871, I noticed we were being overly restrictive
when handling variable-length vectors.  For:

  for (i : ...)
    {
      res = ...;
      for (j : ...)
        res op= ...;
      a[i] = res;
    }

we don't need a reduction operation (although we do for double
reductions like:

  res = ...;
  for (i : ...)
    for (j : ...)
      res op= ...;
  a[i] = res;

which must still be rejected).

2018-08-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-loop.c (vectorizable_reduction): Allow inner-loop
reductions for variable-length vectors.

gcc/testsuite/
* gcc.target/aarch64/sve/reduc_8.c: New test.

From-SVN: r263451

5 years agodiagnostics: add line numbers to source (PR other/84889)
David Malcolm [Thu, 9 Aug 2018 15:32:13 +0000 (15:32 +0000)]
diagnostics: add line numbers to source (PR other/84889)

This patch adds a left margin to the lines of source (and annotations)
printed by diagnostic_show_locus, so that e.g. rather than:

test.c: In function 'test':
test.c:12:15: error: 'struct foo' has no member named 'm_bar'; did you mean 'bar'?
   return ptr->m_bar;
               ^~~~~
               bar

we print:

test.c: In function 'test':
test.c:12:15: error: 'struct foo' has no member named 'm_bar'; did you mean 'bar'?
12 |   return ptr->m_bar;
   |               ^~~~~
   |               bar

Similarly, for a multiline case (in C++ this time), this:

bad-binary-ops.C: In function 'int test_2()':
bad-binary-ops.C:26:4: error: no match for 'operator+' (operand types are 's' and 't')
   return (some_function ()
           ~~~~~~~~~~~~~~~~
    + some_other_function ());
    ^~~~~~~~~~~~~~~~~~~~~~~~

becomes:

bad-binary-ops.C: In function 'int test_2()':
bad-binary-ops.C:26:4: error: no match for 'operator+' (operand types are 's' and 't')
25 |   return (some_function ()
   |           ~~~~~~~~~~~~~~~~
26 |    + some_other_function ());
   |    ^~~~~~~~~~~~~~~~~~~~~~~~

I believe this slightly improves the readability of the output, in that it:
- distinguishes between the user's source code vs the annotation lines
  that we're adding (the underlinings and fix-it hints here)
- shows the line numbers in another place (potentially helpful for
  multiline diagnostics, where the user can see the line numbers directly,
  rather than have to figure them out relative to the caret: in the 2nd
  example, note how the diagnostic is reported at line 26, but the first
  line printed is actually line 25)

I'm not sure that this is the precise format we want to go with [1], but
I think it's an improvement over the status quo, and we're in stage 1
of gcc 9, so there's plenty of time to shake out issues.

I've turned it on by default; it can be disabled via
-fno-diagnostics-show-line-numbers (it's also turned off in the testsuite, to
avoid breaking numerous existing test cases).

[1] Some possible variants:
  - maybe just "LL|" rather than "LL | "
  - maybe ':' rather than '|'
  - maybe we should have some leading indentation, to better split up
    the diagnostics visually via the left-hand column
  - etc

gcc/ChangeLog:
PR other/84889
* common.opt (fdiagnostics-show-line-numbers): New option.
* diagnostic-show-locus.c (class layout): Add fields
"m_show_line_numbers_p" and "m_linenum_width";
(num_digits): New function.
(test_num_digits): New function.
(layout::layout): Initialize new fields.  Update m_x_offset
logic to handle any left margin.
(layout::print_source_line): Print line number when requested.
(layout::start_annotation_line): New member function.
(layout::print_annotation_line): Call it.
(layout::print_leading_fixits): Likewise.
(layout::print_trailing_fixits): Likewise.  Update calls to
move_to_column for new parameter.
(layout::get_x_bound_for_row): Add "add_left_margin" param and use
it to potentially call start_annotation_line.
(layout::show_ruler): Call start_annotation_line.
(selftest::test_line_numbers_multiline_range): New selftest.
(selftest::diagnostic_show_locus_c_tests): Call test_num_digits
and selftest::test_line_numbers_multiline_range.
* diagnostic.c (diagnostic_initialize): Initialize
show_line_numbers_p.
* diagnostic.h (struct diagnostic_context): Add field
"show_line_numbers_p".
* doc/invoke.texi (Diagnostic Message Formatting Options): Add
-fno-diagnostics-show-line-numbers.
* dwarf2out.c (gen_producer_string): Add
OPT_fdiagnostics_show_line_numbers to the ignored options.
* lto-wrapper.c (merge_and_complain): Likewise to the "pick
one setting" options.
(append_compiler_options): Likewise to the dropped options.
(append_diag_options): Likewise to the passed-on options.
* opts.c (common_handle_option): Handle the new option.
* toplev.c (general_init): Set up global_dc->show_line_numbers_p.

gcc/testsuite/ChangeLog:
PR other/84889
* gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c: New
test.
* gcc.dg/plugin/diagnostic-test-show-locus-color-line-numbers.c:
New test.
* gcc.dg/plugin/plugin.exp (plugin_test_list): Add the new tests.
* lib/prune.exp: Add -fno-diagnostics-show-line-numbers to
TEST_ALWAYS_FLAGS.

From-SVN: r263450

5 years agoextend.texi (PowerPC AltiVec Built-in Functions Available on ISA 2.07): Correct spell...
Kelvin Nilsen [Thu, 9 Aug 2018 15:01:55 +0000 (15:01 +0000)]
extend.texi (PowerPC AltiVec Built-in Functions Available on ISA 2.07): Correct spelling of bcdsub to be __builtin_bcdsub.

gcc/ChangeLog:

2018-08-09  Kelvin Nilsen  <kelvin@gcc.gnu.org>

* doc/extend.texi (PowerPC AltiVec Built-in Functions Available on
ISA 2.07): Correct spelling of bcdsub to be __builtin_bcdsub.  Add
third argument of type "const signed char" to descriptions of
__builtin_bcdadd, __builtin_bcdadd_lt, __builtin_bcdadd_eq,
__builtin_bcdadd_gt, __builtin_bcdadd_ov, __builtin_bcdsub,
__builtin_bcdsub_lt, __builtin_bcdsub_eq, __builtin_bcdsub_gt,
__builtin_bcdsub_ov functions.

From-SVN: r263449

5 years agoRestore flow_bb_inside_loop_p tests (PR 86858)
Richard Sandiford [Thu, 9 Aug 2018 14:45:02 +0000 (14:45 +0000)]
Restore flow_bb_inside_loop_p tests (PR 86858)

The series to remove vinfo_for_stmt also removed tests of
flow_bb_inside_loop_p if the call was simply testing whether the
statement was in the vectorisation region.  I'd tried to keep calls
that were testing whether the statement was in a particular loop
(inner or outer), but messed up in vect_is_simple_reduction and
removed calls that were actually needed.  This patch restores them.

I double-checked the other removed calls and I think these are
the only ones affected.

2018-08-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR tree-optimization/86858
* tree-vect-loop.c (vect_is_simple_reduction): Restore
flow_bb_inside_loop_p calls.

gcc/testsuite/
PR tree-optimization/86858
* gcc.dg/vect/pr86858.c: New test.

From-SVN: r263448

5 years agoFix invalid assumption in vect_transform_stmt (PR 86871)
Richard Sandiford [Thu, 9 Aug 2018 14:37:24 +0000 (14:37 +0000)]
Fix invalid assumption in vect_transform_stmt (PR 86871)

The handling of outer-loop uses of inner-loop definitions assumed
that anything that wasn't a PHI would be a gassign.  It's also
possible for it to be a gcall.

2018-08-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR tree-optimization/86871
* tree-vect-stmts.c (vect_transform_stmt): Use gimple_get_lhs
instead of gimple_assign_lhs.

gcc/testsuite/
PR tree-optimization/86871
* gcc.dg/vect/pr86871.c: New test.

From-SVN: r263447

5 years agoaarch64 - PR target/86887 Fix missing register constraints in carryin patterns
Richard Earnshaw [Thu, 9 Aug 2018 13:39:17 +0000 (13:39 +0000)]
aarch64 - PR target/86887 Fix missing register constraints in carryin patterns

Some of the carryin insn patterns are missing a register constraint.
That means that the register allocator can pick practically anything
to hold that value, including memory locations, or registers of the
wrong class.

PR target/86887
* config/aarch64/aarch64.md (add<mode>3_carryinC_zero): Add missing
register constraint to operand 0.
(add<mode>3_carryinC): Likewise.
(add<mode>3_carryinV_zero, add<mode>3_carryinV): Likewise.

From-SVN: r263446

5 years agop784.C: Add -fpermissive.
Paolo Carlini [Thu, 9 Aug 2018 11:49:26 +0000 (11:49 +0000)]
p784.C: Add -fpermissive.

2018-08-09  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.old-deja/g++.mike/p784.C: Add -fpermissive.

From-SVN: r263445

5 years agoRemove extra line in common.opt (PR c/86895).
Martin Liska [Thu, 9 Aug 2018 10:37:02 +0000 (12:37 +0200)]
Remove extra line in common.opt (PR c/86895).

2018-08-09  Martin Liska  <mliska@suse.cz>

        PR c/86895
* common.opt: Remove extra line.

From-SVN: r263444

5 years agoS/390: Fix target attribute tests
Andreas Krebbel [Thu, 9 Aug 2018 08:47:39 +0000 (08:47 +0000)]
S/390: Fix target attribute tests

These broke after removing G5 and G6 CPUs from the processor
enumeration.

gcc/testsuite/ChangeLog:

2018-08-09  Andreas Krebbel  <krebbel@linux.ibm.com>

* gcc.target/s390/target-attribute/tattr-arch-tune-1.c: Decrement
arch and tune numbers by 2.
* gcc.target/s390/target-attribute/tattr-arch-tune-2.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-1.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-10.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-11.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-12.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-13.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-14.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-15.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-16.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-17.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-18.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-19.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-2.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-20.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-21.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-22.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-23.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-24.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-25.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-26.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-27.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-28.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-29.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-3.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-30.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-31.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-32.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-4.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-5.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-6.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-7.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-8.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m31-9.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-1.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-10.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-11.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-12.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-13.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-14.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-15.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-16.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-17.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-18.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-19.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-2.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-20.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-21.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-22.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-23.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-24.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-25.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-26.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-27.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-28.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-29.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-3.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-30.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-31.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-32.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-33.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-4.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-5.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-6.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-7.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-8.c: Likewise.
* gcc.target/s390/target-attribute/tattr-m64-9.c: Likewise.

From-SVN: r263443

5 years agoFix typos in params.def.
Martin Liska [Thu, 9 Aug 2018 08:08:44 +0000 (10:08 +0200)]
Fix typos in params.def.

2018-08-09  Martin Liska  <mliska@suse.cz>

* params.def (PARAM_ALIGN_LOOP_ITERATIONS): Remove double dots
        at the end of a line, make first letter capital and end up
        a sentence with a dot.
(PARAM_LOOP_INTERCHANGE_STRIDE_RATIO): Likewise.
(PARAM_LOOP_BLOCK_TILE_SIZE): Likewise.
(PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS): Likewise.
(PARAM_GRAPHITE_MAX_ARRAYS_PER_SCOP): Likewise.
(PARAM_MAX_ISL_OPERATIONS): Likewise.
(PARAM_GRAPHITE_ALLOW_CODEGEN_ERRORS): Likewise.
(PARAM_PROFILE_FUNC_INTERNAL_ID): Likewise.
(PARAM_INDIR_CALL_TOPN_PROFILE): Likewise.
(PARAM_SLP_MAX_INSNS_IN_BB): Likewise.
(PARAM_IPA_CP_EVAL_THRESHOLD): Likewise.
(PARAM_IPA_CP_RECURSION_PENALTY): Likewise.
(PARAM_IPA_CP_SINGLE_CALL_PENALTY): Likewise.
(PARAM_IPA_CP_LOOP_HINT_BONUS): Likewise.
(PARAM_IPA_CP_ARRAY_INDEX_HINT_BONUS): Likewise.
(PARAM_TREE_REASSOC_WIDTH): Likewise.
(PARAM_HSA_GEN_DEBUG_STORES): Likewise.
(PARAM_MAX_SPECULATIVE_DEVIRT_MAYDEFS): Likewise.
(PARAM_MAX_VRP_SWITCH_ASSERTIONS): Likewise.

From-SVN: r263442

5 years agoS/390: Fix PR84332 ICE with stack clash protection
Andreas Krebbel [Thu, 9 Aug 2018 07:06:23 +0000 (07:06 +0000)]
S/390: Fix PR84332 ICE with stack clash protection

Our implementation of the stack probe requires the probe interval to
be used as displacement in an address operand.  The maximum probe
interval currently is 64k.  This would exceed short displacements.
Trim that value down to 4k if that happens.  This might result in too
many probes being generated only on the oldest supported machine level
z900.

gcc/ChangeLog:

2018-08-09  Andreas Krebbel  <krebbel@linux.ibm.com>

PR target/84332
* config/s390/s390.c (s390_option_override_internal): Reduce the
stack-clash-protection-probe-interval param if it would be too big
for z900.

gcc/testsuite/ChangeLog:

2018-08-09  Andreas Krebbel  <krebbel@linux.ibm.com>

PR target/84332
* gcc.target/s390/pr84332.c: New testcase.

From-SVN: r263441

5 years agoDaily bump.
GCC Administrator [Thu, 9 Aug 2018 00:16:31 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r263439

5 years ago2018-08-08 François Dumont <fdumont@gcc.gnu.org>
François Dumont [Wed, 8 Aug 2018 20:28:21 +0000 (20:28 +0000)]
2018-08-08  François Dumont  <fdumont@gcc.gnu.org>

* include/bits/stl_algo.h
(__rotate(_Ite, _Ite, _Ite, forward_iterator_tag))
(__rotate(_Ite, _Ite, _Ite, bidirectional_iterator_tag))
(__rotate(_Ite, _Ite, _Ite, random_access_iterator_tag)): Move code duplication...
(rotate(_Ite, _Ite, _Ite)): ...here.
(__stable_partition_adaptive(_FIt, _FIt, _Pred, _Dist, _Pointer, _Dist)):
Simplify rotate call.
(__rotate_adaptive(_BIt1, _BIt1, _BIt1, _Dist, _Dist, _Bit2, _Dist)):
Likewise.
(__merge_without_buffer(_BIt, _BIt, _BIt, _Dist, _Dist, _Comp)):
Likewise.

From-SVN: r263433

5 years agom68k: handle more cases of TLS symbols with offset
Andreas Schwab [Wed, 8 Aug 2018 20:01:26 +0000 (20:01 +0000)]
m68k: handle more cases of TLS symbols with offset

PR target/46179
* config/m68k/m68k.h (FINAL_PRESCAN_INSN): Don't define.
* config/m68k/m68k.c (handle_move_double): Don't call
m68k_final_prescan_insn.
(m68k_adjust_decorated_operand): Renamed from
m68k_final_prescan_insn, remove first and third operand and
simplify.
(print_operand): Call it.
(print_operand_address): Call it.

PR target/46179
* gcc.target/m68k/tls-dimode.c: New file.

From-SVN: r263432

5 years ago[PATCH] line-map include-from representation
Nathan Sidwell [Wed, 8 Aug 2018 18:13:00 +0000 (18:13 +0000)]
[PATCH] line-map include-from representation

https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00554.html
Make linemap::included_from a location
libcpp/
* include/line-map.h (struct line_map_ordinary): Replace
included_from map index with included_at source_location.
(ORDINARY_MAP_INCLUDER_FILE_INDEX): Delete.
(LAST_SOURCE_LINE_LOCATION): Delete.
(LAST_SOURCE_LINE, LAST_SOURCE_COLUMN): Delete.
(linemap_included_from): New.
(linemap_included_from_linemap): Declare.
(MAIN_FILE_P): Adjust.
* line-map.c (linemap_included_from_linemap): New.
(lonemap_check_files_exited): Use linemap_included_at.
(linemap_add): Adjust inclusion setting.
(linemap_dump, linemap_dump_location): Adjust.
* directives.c (do_linemarker): Use linemap_included_at.
gcc/
* diagnostic.c (diagnostic_report_current_module): Use
linemap_included_from & linemap_included_from_linemap.
gcc/c-family/
* c-common.c (try_to_locate_new_include_inertion_point): Use
linemap_included_from_linemap.
* c-lex.c (fe_file_change): Use linemap_included_from.
* c-ppoutput.c (pp_file_change): Likewise.
gcc/fortran/
* cpp.c (cb_file_change): Use linemap_included_from.
gcc/testsuite/
* c-c++-common/inc-from-1a.h, c-c++-common/inc-from-1b.h,
c-c++-common/inc-from-1.c: New

From-SVN: r263429

5 years agoPrevent internal aligned_alloc clashing with libc version
Jonathan Wakely [Wed, 8 Aug 2018 15:16:43 +0000 (16:16 +0100)]
Prevent internal aligned_alloc clashing with libc version

If configure fails to detect aligned_alloc we will try to define our
own in new_opa.cc but that could clash with the libcversion in
<stdlib.h>. Use a namespace to keep them distinct.

* libsupc++/new_opa.cc (aligned_alloc): Declare inside namespace to
avoid clashing with an ::aligned_alloc function that was not detected
by configure.

From-SVN: r263409

5 years ago[libgomp, nvptx] Fall back to cuLinkAddData/cuLinkCreate if _v2 not found
Tom de Vries [Wed, 8 Aug 2018 14:26:37 +0000 (14:26 +0000)]
[libgomp, nvptx] Fall back to cuLinkAddData/cuLinkCreate if _v2 not found

Cuda driver api functions cuLinkAddData and cuLinkCreate are available starting
version 5.5.  In version 6.5, they are remapped onto _v2 versions.

The dlopen interface of the libgomp nvptx plugin uses the _v2 versions, so it
won't work with a cuda driver with driver api version lower than 6.5.

This patch fixes the problem by testing for the presence of the _v2 versions,
and falling back to the original versions in case of absence of the _v2
versions.

Build on x86_64 with nvptx accelerator and reg-tested libgomp, both with and
without --without-cuda-driver.

2018-08-08  Tom de Vries  <tdevries@suse.de>

* plugin/cuda-lib.def (cuLinkAddData_v2, cuLinkCreate_v2): Declare using
CUDA_ONE_CALL_MAYBE_NULL.
* plugin/plugin-nvptx.c (cuLinkAddData, cuLinkCreate): Undef and declare.
(cuLinkAddData_v2, cuLinkCreate_v2): Declare.
(link_ptx): Fall back to cuLinkAddData/cuLinkCreate if the _v2 versions
are not found.

From-SVN: r263408

5 years ago[libgomp, nvptx] Allow cuGetErrorString to be NULL
Tom de Vries [Wed, 8 Aug 2018 14:26:28 +0000 (14:26 +0000)]
[libgomp, nvptx] Allow cuGetErrorString to be NULL

Cuda driver api function cuGetErrorString is available in version 6.0 and
higher.

Currently, when the driver that is used does not contain this function, the
libgomp nvptx plugin will not build (PLUGIN_NVPTX_DYNAMIC == 0) or run
(PLUGIN_NVPTX_DYNAMIC == 1).

This patch fixes this problem by testing for the presence of the function, and
handling absence.

Build on x86_64 with nvptx accelerator and reg-tested libgomp, both with and
without --without-cuda-driver.

2018-08-08  Tom de Vries  <tdevries@suse.de>

* plugin/cuda-lib.def (cuGetErrorString): Use CUDA_ONE_CALL_MAYBE_NULL.
* plugin/plugin-nvptx.c (cuda_error): Handle if cuGetErrorString is not
present.

From-SVN: r263407

5 years ago[libgomp, nvptx] Remove hard-coded const in nvptx_open_device
Tom de Vries [Wed, 8 Aug 2018 14:26:19 +0000 (14:26 +0000)]
[libgomp, nvptx] Remove hard-coded const in nvptx_open_device

CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR is defined in cuda driver
api version 6.0 and higher.

Currently nvptx_open_device uses a hard-coded constant instead.

This patch fixes that by:
- defining CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR to the hardcoded
  constant at toplevel, if not present in cuda.h, and
- using CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR in nvptx_open_device

Build on x86_64 with nvptx accelerator and reg-tested libgomp.

2018-08-08  Tom de Vries  <tdevries@suse.de>

* plugin/plugin-nvptx.c
(CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR): Define.
(nvptx_open_device): Use
CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_MULTIPROCESSOR.

From-SVN: r263406

5 years ago[libgomp, nvptx] Note that cuGetErrorString is in CUDA_VERSION >= 6000
Tom de Vries [Wed, 8 Aug 2018 14:26:10 +0000 (14:26 +0000)]
[libgomp, nvptx] Note that cuGetErrorString is in CUDA_VERSION >= 6000

Cuda driver api function cuGetErrorString is available in version 6.0 and
higher.

This patch:
- removes a comment saying the declaration is not available in cuda.h 6.0
- fixes the presence test to use CUDA_VERSION < 6000
- moves the declaration to toplevel

Build on x86_64 with nvptx accelerator and reg-tested libgomp.

2018-08-08  Tom de Vries  <tdevries@suse.de>

* plugin/plugin-nvptx.c (cuda_error): Move declaration of cuGetErrorString ...
(cuGetErrorString): ... here.  Guard with CUDA_VERSION < 6000.

From-SVN: r263405

5 years ago[AArch64] Add HXT Phecda core support
Hongbo Zhang [Wed, 8 Aug 2018 14:23:59 +0000 (14:23 +0000)]
[AArch64] Add HXT Phecda core support

HXT semiconductor's CPU core Phecda, as a variant of Qualcomm qdf24xx,
reuses the same tuning structure and pipeline with it.

Applied on behalf of: Hongbo Zhang <hongbo.zhang@linaro.org>

* config/aarch64/aarch64-cores.def: Add phecda core.
* config/aarch64/aarch64-tune.md: Regenerate.
* doc/invoke.texi: Add phecda core.

From-SVN: r263404

5 years agoFix Docbook markup for table entry
Jonathan Wakely [Wed, 8 Aug 2018 13:37:24 +0000 (14:37 +0100)]
Fix Docbook markup for table entry

* doc/xml/manual/using.xml: Fix markup for empty table entry.
* doc/html/*: Regenerate.

From-SVN: r263401

5 years agoAdd missing <experimental/numeric> header to docs
Jonathan Wakely [Wed, 8 Aug 2018 13:29:25 +0000 (14:29 +0100)]
Add missing <experimental/numeric> header to docs

* doc/xml/manual/using.xml: Add missing header to table and fix typo.
* doc/html/*: Regenerate.

From-SVN: r263398

5 years agoPR libstdc++/86597 directory_entry observers should clear error_code
Jonathan Wakely [Wed, 8 Aug 2018 13:09:19 +0000 (14:09 +0100)]
PR libstdc++/86597 directory_entry observers should clear error_code

PR libstdc++/86597
* include/bits/fs_dir.h (directory_entry::_M_file_type(error_code&)):
Clear error_code when cached type is used.
* testsuite/27_io/filesystem/directory_entry/86597.cc: New test.

From-SVN: r263397

5 years agoS/390: Fix PR85295
Andreas Krebbel [Wed, 8 Aug 2018 12:38:51 +0000 (12:38 +0000)]
S/390: Fix PR85295

gcc/ChangeLog:

2018-08-08  Andreas Krebbel  <krebbel@linux.ibm.com>

PR target/85295
* config/s390/constraints.md ("NxHD0", "NxSD0"): New constraint
definitions.
* config/s390/s390.md ("movti"): Add more alternatives for
constant to GPR copies.

gcc/testsuite/ChangeLog:

2018-08-08  Andreas Krebbel  <krebbel@linux.ibm.com>

PR target/85295
* gcc.target/s390/TI-constants-lra.c: New testcase.
* gcc.target/s390/TI-constants-nolra.c: New testcase.

From-SVN: r263396

5 years agoS/390: Fix whitespace problems in the backend
Andreas Krebbel [Wed, 8 Aug 2018 11:35:45 +0000 (11:35 +0000)]
S/390: Fix whitespace problems in the backend

2018-08-08  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/s390.c: Fix whitespace damage throughout the file.
* config/s390/s390.h: Likewise.
* config/s390/tpf.h: Likewise.

From-SVN: r263395

5 years agoS/390: Remove TARGET_CPU_ZARCH
Ilya Leoshkevich [Wed, 8 Aug 2018 11:25:31 +0000 (11:25 +0000)]
S/390: Remove TARGET_CPU_ZARCH

TARGET_CPU_ZARCH allowed to distinguish between g5/g6 and newer
machines.  Since the former are now gone, we can assume that
TARGET_CPU_ZARCH is always true.  As a side-effect, branch splitting
is now completely gone.  Some parts of literal pool splitting are also
gone, but it's still there: we need to support it because floating
point and vector instructions still cannot use relative addressing.

gcc/ChangeLog:

2018-08-08  Ilya Leoshkevich  <iii@linux.ibm.com>

* config/s390/s390.c (s390_loadrelative_operand_p):
        Remove TARGET_CPU_ZARCH usages.
(s390_rtx_costs): Likewise.
(s390_legitimate_constant_p): Likewise.
(s390_cannot_force_const_mem): Likewise.
(legitimate_reload_constant_p): Likewise.
(s390_preferred_reload_class): Likewise.
(legitimize_pic_address): Likewise.
(legitimize_tls_address): Likewise.
(s390_split_branches): Removed.
(s390_add_execute): Removed.
(s390_dump_pool): Remove TARGET_CPU_ZARCH usages.
(s390_mainpool_start): Likewise.
(s390_mainpool_finish): Likewise.
(s390_mainpool_cancel): Removed.
(s390_chunkify_start): Remove TARGET_CPU_ZARCH usages.
(s390_chunkify_cancel): Likewise.
(s390_return_addr_rtx): Likewise.
(s390_register_info): Remove split_branches_pending_p uages.
(s390_optimize_register_info): Likewise.
(s390_init_frame_layout): Remove TARGET_CPU_ZARCH and
        split_branches_pending_p usages.
(s390_can_eliminate): Remove TARGET_CPU_ZARCH usages.
(s390_load_got): Likewise.
(s390_expand_split_stack_prologue): Likewise.
(output_asm_nops): Likewise.
(s390_function_profiler): Likewise.
(s390_emit_call): Likewise.
(s390_conditional_register_usage): Likewise.
(s390_optimize_prologue): Likewise.
(s390_reorg): Remove TARGET_CPU_ZARCH and
        split_branches_pending_p usages.
(s390_option_override_internal): Remove TARGET_CPU_ZARCH
        usages.
(s390_output_indirect_thunk_function): Likewise.
* config/s390/s390.h (TARGET_CPU_ZARCH): Removed.
(TARGET_CPU_ZARCH_P): Removed.
(struct machine_function): Remove split_branches_pending_p.
* config/s390/s390.md: Remove TARGET_CPU_ZARCH usages.

From-SVN: r263394

5 years agoS/390: Remove support for g5 and g6 machines
Ilya Leoshkevich [Wed, 8 Aug 2018 10:55:56 +0000 (10:55 +0000)]
S/390: Remove support for g5 and g6 machines

g5 and g6 were deprecated since gcc 6.1.0 (commit 3bd8520f).

gcc/ChangeLog:

2018-08-08  Ilya Leoshkevich  <iii@linux.ibm.com>

* common/config/s390/s390-common.c (processor_flags_table):
        Remove flags.
* config.gcc: Remove with_arch/with_tune support.
* config/s390/2064.md: Remove cpu attribute comparisons.
* config/s390/driver-native.c (s390_host_detect_local_cpu):
        Remove MTN.
* config/s390/linux.h (ASM_SPEC):
        Remove -march support.
* config/s390/s390-c.c (s390_cpu_cpp_builtins_internal):
        Use a table to get an arch level.
* config/s390/s390-opts.h (enum processor_type):
        Remove enum values.
* config/s390/s390.c
        (processor_table): Remove entries, add arch_level values.
        (s390_issue_rate): Remove cases.
        (s390_option_override): Adjust
        s390_option_override_internal() call.
(s390_option_override_internal): Remove deprecation warning.
        (s390_valid_target_attribute_tree): Adjust
        s390_option_override_internal() call.
* config/s390/s390.h (struct s390_processor):
        Share with s390-c.c, add arch_level field.
* config/s390/s390.md:
        Remove occurrences in cpu attribute.
* config/s390/s390.opt: Remove -march/-mtune support.
* config/s390/tpf.h (ASM_SPEC): Remove -march support.
* doc/invoke.texi: Remove deprecation warning.

gcc/testsuite/ChangeLog:

2018-08-08  Ilya Leoshkevich  <iii@linux.ibm.com>

* gcc.target/s390/hotpatch-8.c: Remove.
* gcc.target/s390/hotpatch-9.c: Remove.
* gcc.target/s390/mnop-mcount-m31-fpic.c: Remove.
* gcc.target/s390/mnop-mcount-m31.c: Remove.

From-SVN: r263393

5 years agoP0595R1 - is_constant_evaluated
Jakub Jelinek [Wed, 8 Aug 2018 09:00:51 +0000 (11:00 +0200)]
P0595R1 - is_constant_evaluated

P0595R1 - is_constant_evaluated
cp/
* cp-tree.h (enum cp_built_in_function): New.
(maybe_constant_init): Add pretend_const_required argument.
* typeck2.c (store_init_value): Pass true as new argument to
maybe_constant_init.
* constexpr.c (constexpr_fn_retval): Check also DECL_BUILT_IN_CLASS
for BUILT_IN_UNREACHABLE.
(struct constexpr_ctx): Add pretend_const_required field.
(cxx_eval_builtin_function_call): Use DECL_IS_BUILTIN_CONSTANT_P
macro.  Handle CP_BUILT_IN_IS_CONSTANT_EVALUATED.  Check also
DECL_BUILT_IN_CLASS for BUILT_IN_UNREACHABLE.
(cxx_eval_outermost_constant_expr): Add pretend_const_required
argument, initialize pretend_const_required field in ctx.  If the
result is TREE_CONSTANT and non_constant_p, retry with
pretend_const_required false if it was true.
(is_sub_constant_expr): Initialize pretend_const_required_field in
ctx.
(cxx_constant_value): Pass true as pretend_const_required to
cxx_eval_outermost_constant_expr.
(maybe_constant_value): Pass false as pretend_const_required to
cxx_eval_outermost_constant_expr.
(fold_non_dependent_expr): Likewise.
(maybe_constant_init_1): Add pretend_const_required argument, pass it
down to cxx_eval_outermost_constant_expr.  Pass !allow_non_constant
instead of false as strict to cxx_eval_outermost_constant_expr.
(maybe_constant_init): Add pretend_const_required argument, pass it
down to maybe_constant_init_1.
(cxx_constant_init): Pass true as pretend_const_required to
maybe_constant_init_1.
* cp-gimplify.c (cp_gimplify_expr): Handle CALL_EXPRs to
CP_BUILT_IN_IS_CONSTANT_EVALUATED.
(cp_fold): Don't fold CP_BUILT_IN_IS_CONSTANT_EVALUATED calls.
* decl.c: Include langhooks.h.
(cxx_init_decl_processing): Register __builtin_is_constant_evaluated
built-in.
* tree.c (builtin_valid_in_constant_expr_p): Return true for
CP_BUILT_IN_IS_CONSTANT_EVALUATED.
* pt.c (declare_integer_pack): Initialize DECL_FUNCTION_CODE.
testsuite/
* g++.dg/cpp2a/is-constant-evaluated1.C: New test.

From-SVN: r263392