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

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

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

From-SVN: r255818

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

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

From-SVN: r255817

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

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

* gimplify.c (gimplify_expr): Use error_operand_p.

From-SVN: r255816

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

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

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

From-SVN: r255815

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

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

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

From-SVN: r255814

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

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

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

From-SVN: r255812

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

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

From-SVN: r255811

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

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

From-SVN: r255809

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

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

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

From-SVN: r255807

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

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

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

From-SVN: r255806

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

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

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

From-SVN: r255805

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

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

From-SVN: r255804

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

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

From-SVN: r255803

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

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

From-SVN: r255802

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

From-SVN: r255795

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

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

gcc/ChangeLog:

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

gcc/testsuite/ChangeLog:

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

From-SVN: r255790

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

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

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

From-SVN: r255789

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

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

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

From-SVN: r255788

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

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

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

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

From-SVN: r255787

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

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

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

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

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

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

From-SVN: r255786

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

PR libstdc++/68430

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

From-SVN: r255785

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

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

From-SVN: r255784

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

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

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

From-SVN: r255783

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

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

From-SVN: r255782

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

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

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

From-SVN: r255781

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

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

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

From-SVN: r255780

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

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

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

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

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

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

From-SVN: r255779

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

Make sure we check the constants in all cases.

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

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

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

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

From-SVN: r255778

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

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

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

gcc/ChangeLog:

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

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

From-SVN: r255777

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

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

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

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

From-SVN: r255776

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

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

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

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

From-SVN: r255775

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

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

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

From-SVN: r255774

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

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

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

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

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

gcc/testsuite/ChangeLog:

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

gcc/ChangeLog:

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

From-SVN: r255772

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

From-SVN: r255771

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

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

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

From-SVN: r255768

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

gcc/c-family/ChangeLog:

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

From-SVN: r255767

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

From-SVN: r255766

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

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

From-SVN: r255765

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

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

From-SVN: r255764

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

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

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

Regtested on x86_64-pc-linux-gnu.

gcc/fortran/ChangeLog:

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

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

gcc/testsuite/ChangeLog:

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

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

From-SVN: r255761

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

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

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

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

From-SVN: r255760

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

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

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

From-SVN: r255759

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

From-SVN: r255758

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

gcc/c-family/ChangeLog:

PR tree-optimization/78918
* c-common.c (check_function_restrict): Avoid checking built-ins.
* c.opt (-Wrestrict): Include in -Wall.

gcc/ChangeLog:

PR tree-optimization/78918
* Makefile.in (OBJS): Add gimple-ssa-warn-restrict.o.
* builtins.c (check_sizes): Rename...
(check_access): ...to this.  Rename function arguments for clarity.
(check_memop_sizes): Adjust names.
(expand_builtin_memchr, expand_builtin_memcpy): Same.
(expand_builtin_memmove, expand_builtin_mempcpy): Same.
(expand_builtin_strcat, expand_builtin_stpncpy): Same.
(check_strncat_sizes, expand_builtin_strncat): Same.
(expand_builtin_strncpy, expand_builtin_memset): Same.
(expand_builtin_bzero, expand_builtin_memcmp): Same.
(expand_builtin_memory_chk, maybe_emit_chk_warning): Same.
(maybe_emit_sprintf_chk_warning): Same.
(expand_builtin_strcpy): Adjust.
(expand_builtin_stpcpy): Same.
(expand_builtin_with_bounds): Detect out-of-bounds accesses
in pointer-checking forms of memcpy, memmove, and mempcpy.
(gcall_to_tree_minimal, max_object_size): Define new functions.
* builtins.h (max_object_size): Declare.
* calls.c (alloc_max_size): Call max_object_size instead of
hardcoding ssizetype limit.
(get_size_range): Handle new argument.
* calls.h (get_size_range): Add a new argument.
* cfgexpand.c (expand_call_stmt): Propagate no-warning bit.
* doc/invoke.texi (-Wrestrict): Adjust, add example.
* gimple-fold.c (gimple_fold_builtin_memory_op): Detect overlapping
operations.
(gimple_fold_builtin_memory_chk): Same.
(gimple_fold_builtin_stxcpy_chk): New function.
* gimple-ssa-warn-restrict.c: New source.
* gimple-ssa-warn-restrict.h: New header.
* gimple.c (gimple_build_call_from_tree): Propagate location.
* passes.def (pass_warn_restrict): Add new pass.
* tree-pass.h (make_pass_warn_restrict): Declare.
* tree-ssa-strlen.c (handle_builtin_strcpy): Detect overlapping
operations.
(handle_builtin_strcat): Same.
(strlen_optimize_stmt): Rename...
(strlen_check_and_optimize_stmt): ...to this.  Handle strncat,
stpncpy, strncpy, and their checking forms.

gcc/testsuite/ChangeLog:

PR tree-optimization/78918
* c-c++-common/Warray-bounds.c: New test.
* c-c++-common/Warray-bounds-2.c: New test.
* c-c++-common/Warray-bounds-3.c: New test.
* c-c++-common/Warray-bounds-4.c: New test.
* c-c++-common/Warray-bounds-5.c: New test.
* c-c++-common/Wrestrict-2.c: New test.
* c-c++-common/Wrestrict.c: New test.
* c-c++-common/Wrestrict.s: New test.
* c-c++-common/Wsizeof-pointer-memaccess1.c: Adjust
* c-c++-common/Wsizeof-pointer-memaccess2.c: Same.
* g++.dg/torture/Wsizeof-pointer-memaccess1.C: Same.
* g++.dg/torture/Wsizeof-pointer-memaccess2.C: Same.
* gcc.dg/range.h: New header.
* gcc.dg/memcpy-6.c: New test.
* gcc.dg/pr69172.c: Adjust.
* gcc.dg/pr79223.c: Same.
* gcc.dg/pr81345.c: Adjust.
* gcc.dg/Wobjsize-1.c: Same.
* gcc.dg/Wrestrict-2.c: New test.
* gcc.dg/Wrestrict.c: New test.
* gcc.dg/Wsizeof-pointer-memaccess1.c: Adjust.
* gcc.dg/builtin-stpncpy.c: Same.
* gcc.dg/builtin-stringop-chk-1.c: Same.
* gcc.target/i386/chkp-stropt-17.c: New test.
* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Adjust.

From-SVN: r255755

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

PR tree-optimization/83239 - False positive from -Wstringop-overflow
on simple std::vector code

libstdc++/CHangeLog:
* include/bits/vector.tcc (vector::_M_default_append): Assert
        invariant to generate better code.

gcc/testsuite/ChangeLog:
* g++.dg/pr83239.C: New test case.

From-SVN: r255753

6 years agore PR libfortran/81937 (stack-buffer-overflow on memcpy in libgfortran/io/unix.c...
Jerry DeLisle [Sat, 16 Dec 2017 19:50:42 +0000 (19:50 +0000)]
re PR libfortran/81937 (stack-buffer-overflow on memcpy in libgfortran/io/unix.c on character(kind=4))

2017-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libgfortran/81937
        * io/list_read.c (next_char_internal): Don't attempt to read
        from the internal unit stream if no bytes are left. Decrement
        bytes_left in the right place.

From-SVN: r255750

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

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

From-SVN: r255749

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

2017-12-16  Jan Hubicka  <hubicka@ucw.cz>

PR rtl-optimization/82849
* modulo-sched.c (sms_schedule): Use get_estimated_loop_iterations_int
and get_max_loop_iterations_int.

From-SVN: r255748

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

This patch changes the bit size and vector count arguments to the
machmode.h functions from unsigned int to poly_uint64.

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

gcc/
* machmode.h (mode_for_size, int_mode_for_size, float_mode_for_size)
(smallest_mode_for_size, smallest_int_mode_for_size): Take the mode
size as a poly_uint64.
(mode_for_vector, mode_for_int_vector): Take the number of vector
elements as a poly_uint64.
* stor-layout.c (mode_for_size, smallest_mode_for_size): Take the mode
size as a poly_uint64.
(mode_for_vector, mode_for_int_vector): Take the number of vector
elements as a poly_uint64.

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

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

From-SVN: r255746

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

This patch adds a helper routine that constructs rtxes
for constant shift amounts, given the mode of the value
being shifted.  As well as helping with the SVE patches, this
is one step towards allowing CONST_INTs to have a real mode.

One long-standing problem has been to decide what the mode
of a shift count should be for arbitrary rtxes (as opposed to those
directly tied to a target pattern).  Realistic choices would be
the mode of the shifted elements, word_mode, QImode, or the same
mode as the shift optabs (in which case what should the mode
be when the target doesn't have a pattern?)

For now the patch picks the mode of the shifted elements,
but with a ??? comment.

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

gcc/
* emit-rtl.h (gen_int_shift_amount): Declare.
* emit-rtl.c (gen_int_shift_amount): New function.
* asan.c (asan_emit_stack_protection): Use gen_int_shift_amount
instead of GEN_INT.
* calls.c (shift_return_value): Likewise.
* cse.c (fold_rtx): Likewise.
* dse.c (find_shift_sequence): Likewise.
* expmed.c (init_expmed_one_mode, store_bit_field_1, expand_shift_1)
(expand_shift, expand_smod_pow2): Likewise.
* lower-subreg.c (shift_cost): Likewise.
* optabs.c (expand_superword_shift, expand_doubleword_mult)
(expand_unop, expand_binop, shift_amt_for_vec_perm_mask)
(expand_vec_perm_var): Likewise.
* simplify-rtx.c (simplify_unary_operation_1): Likewise.
(simplify_binary_operation_1): Likewise.
* combine.c (try_combine, find_split_point, force_int_to_mode)
(simplify_shift_const_1, simplify_shift_const): Likewise.
(change_zero_ext): Likewise.  Use simplify_gen_binary.

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

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

This patch uses a MACRO_MODE wrapper for the target macro invocations
in targhooks.c and address.h, so that macros for non-AArch64 targets
can continue to treat modes as fixed-size.

It didn't seem worth converting the address macros to hooks since
(a) they're heavily used, (b) they should be probably be replaced
with a different interface rather than converted to hooks as-is,
and most importantly (c) addresses.h already localises the problem.

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

gcc/
* machmode.h (MACRO_MODE): New macro.
* addresses.h (base_reg_class, ok_for_base_p_1): Use it.
* targhooks.c (default_libcall_value, default_secondary_reload)
(default_memory_move_cost, default_register_move_cost)
(default_class_max_nregs): Likewise.

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

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

This patch makes each target-specifc TU define an IN_TARGET_CODE macro,
which is used to decide whether poly_int<1, C> should convert to C.

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

gcc/
* doc/sourcebuild.texi: Document IN_TARGET_CODE.
* genattrtab.c (write_header): Define IN_TARGET_CODE to 1 in the
target C file.
* genautomata.c (main): Likewise.
* genconditions.c (write_header): Likewise.
* genemit.c (main): Likewise.
* genextract.c (print_header): Likewise.
* genopinit.c (main): Likewise.
* genoutput.c (output_prologue): Likewise.
* genpeep.c (main): Likewise.
* genpreds.c (write_insn_preds_c): Likewise.
* genrecog.c (writer_header): Likewise.
* config/aarch64/aarch64-builtins.c (IN_TARGET_CODE): Define.
* config/aarch64/aarch64-c.c (IN_TARGET_CODE): Likewise.
* config/aarch64/aarch64.c (IN_TARGET_CODE): Likewise.
* config/aarch64/cortex-a57-fma-steering.c (IN_TARGET_CODE): Likewise.
* config/aarch64/driver-aarch64.c (IN_TARGET_CODE): Likewise.
* config/alpha/alpha.c (IN_TARGET_CODE): Likewise.
* config/alpha/driver-alpha.c (IN_TARGET_CODE): Likewise.
* config/arc/arc-c.c (IN_TARGET_CODE): Likewise.
* config/arc/arc.c (IN_TARGET_CODE): Likewise.
* config/arc/driver-arc.c (IN_TARGET_CODE): Likewise.
* config/arm/aarch-common.c (IN_TARGET_CODE): Likewise.
* config/arm/arm-builtins.c (IN_TARGET_CODE): Likewise.
* config/arm/arm-c.c (IN_TARGET_CODE): Likewise.
* config/arm/arm.c (IN_TARGET_CODE): Likewise.
* config/arm/driver-arm.c (IN_TARGET_CODE): Likewise.
* config/avr/avr-c.c (IN_TARGET_CODE): Likewise.
* config/avr/avr-devices.c (IN_TARGET_CODE): Likewise.
* config/avr/avr-log.c (IN_TARGET_CODE): Likewise.
* config/avr/avr.c (IN_TARGET_CODE): Likewise.
* config/avr/driver-avr.c (IN_TARGET_CODE): Likewise.
* config/avr/gen-avr-mmcu-specs.c (IN_TARGET_CODE): Likewise.
* config/bfin/bfin.c (IN_TARGET_CODE): Likewise.
* config/c6x/c6x.c (IN_TARGET_CODE): Likewise.
* config/cr16/cr16.c (IN_TARGET_CODE): Likewise.
* config/cris/cris.c (IN_TARGET_CODE): Likewise.
* config/darwin.c (IN_TARGET_CODE): Likewise.
* config/epiphany/epiphany.c (IN_TARGET_CODE): Likewise.
* config/epiphany/mode-switch-use.c (IN_TARGET_CODE): Likewise.
* config/epiphany/resolve-sw-modes.c (IN_TARGET_CODE): Likewise.
* config/fr30/fr30.c (IN_TARGET_CODE): Likewise.
* config/frv/frv.c (IN_TARGET_CODE): Likewise.
* config/ft32/ft32.c (IN_TARGET_CODE): Likewise.
* config/h8300/h8300.c (IN_TARGET_CODE): Likewise.
* config/i386/djgpp.c (IN_TARGET_CODE): Likewise.
* config/i386/driver-i386.c (IN_TARGET_CODE): Likewise.
* config/i386/driver-mingw32.c (IN_TARGET_CODE): Likewise.
* config/i386/host-cygwin.c (IN_TARGET_CODE): Likewise.
* config/i386/host-i386-darwin.c (IN_TARGET_CODE): Likewise.
* config/i386/host-mingw32.c (IN_TARGET_CODE): Likewise.
* config/i386/i386-c.c (IN_TARGET_CODE): Likewise.
* config/i386/i386.c (IN_TARGET_CODE): Likewise.
* config/i386/intelmic-mkoffload.c (IN_TARGET_CODE): Likewise.
* config/i386/msformat-c.c (IN_TARGET_CODE): Likewise.
* config/i386/winnt-cxx.c (IN_TARGET_CODE): Likewise.
* config/i386/winnt-stubs.c (IN_TARGET_CODE): Likewise.
* config/i386/winnt.c (IN_TARGET_CODE): Likewise.
* config/i386/x86-tune-sched-atom.c (IN_TARGET_CODE): Likewise.
* config/i386/x86-tune-sched-bd.c (IN_TARGET_CODE): Likewise.
* config/i386/x86-tune-sched-core.c (IN_TARGET_CODE): Likewise.
* config/i386/x86-tune-sched.c (IN_TARGET_CODE): Likewise.
* config/ia64/ia64-c.c (IN_TARGET_CODE): Likewise.
* config/ia64/ia64.c (IN_TARGET_CODE): Likewise.
* config/iq2000/iq2000.c (IN_TARGET_CODE): Likewise.
* config/lm32/lm32.c (IN_TARGET_CODE): Likewise.
* config/m32c/m32c-pragma.c (IN_TARGET_CODE): Likewise.
* config/m32c/m32c.c (IN_TARGET_CODE): Likewise.
* config/m32r/m32r.c (IN_TARGET_CODE): Likewise.
* config/m68k/m68k.c (IN_TARGET_CODE): Likewise.
* config/mcore/mcore.c (IN_TARGET_CODE): Likewise.
* config/microblaze/microblaze-c.c (IN_TARGET_CODE): Likewise.
* config/microblaze/microblaze.c (IN_TARGET_CODE): Likewise.
* config/mips/driver-native.c (IN_TARGET_CODE): Likewise.
* config/mips/frame-header-opt.c (IN_TARGET_CODE): Likewise.
* config/mips/mips.c (IN_TARGET_CODE): Likewise.
* config/mmix/mmix.c (IN_TARGET_CODE): Likewise.
* config/mn10300/mn10300.c (IN_TARGET_CODE): Likewise.
* config/moxie/moxie.c (IN_TARGET_CODE): Likewise.
* config/msp430/driver-msp430.c (IN_TARGET_CODE): Likewise.
* config/msp430/msp430-c.c (IN_TARGET_CODE): Likewise.
* config/msp430/msp430.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32-cost.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32-fp-as-gp.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32-intrinsic.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32-isr.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32-md-auxiliary.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32-memory-manipulation.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32-pipelines-auxiliary.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32-predicates.c (IN_TARGET_CODE): Likewise.
* config/nds32/nds32.c (IN_TARGET_CODE): Likewise.
* config/nios2/nios2.c (IN_TARGET_CODE): Likewise.
* config/nvptx/mkoffload.c (IN_TARGET_CODE): Likewise.
* config/nvptx/nvptx.c (IN_TARGET_CODE): Likewise.
* config/pa/pa.c (IN_TARGET_CODE): Likewise.
* config/pdp11/pdp11.c (IN_TARGET_CODE): Likewise.
* config/powerpcspe/driver-powerpcspe.c (IN_TARGET_CODE): Likewise.
* config/powerpcspe/host-darwin.c (IN_TARGET_CODE): Likewise.
* config/powerpcspe/host-ppc64-darwin.c (IN_TARGET_CODE): Likewise.
* config/powerpcspe/powerpcspe-c.c (IN_TARGET_CODE): Likewise.
* config/powerpcspe/powerpcspe-linux.c (IN_TARGET_CODE): Likewise.
* config/powerpcspe/powerpcspe.c (IN_TARGET_CODE): Likewise.
* config/riscv/riscv-builtins.c (IN_TARGET_CODE): Likewise.
* config/riscv/riscv-c.c (IN_TARGET_CODE): Likewise.
* config/riscv/riscv.c (IN_TARGET_CODE): Likewise.
* config/rl78/rl78-c.c (IN_TARGET_CODE): Likewise.
* config/rl78/rl78.c (IN_TARGET_CODE): Likewise.
* config/rs6000/driver-rs6000.c (IN_TARGET_CODE): Likewise.
* config/rs6000/host-darwin.c (IN_TARGET_CODE): Likewise.
* config/rs6000/host-ppc64-darwin.c (IN_TARGET_CODE): Likewise.
* config/rs6000/rs6000-c.c (IN_TARGET_CODE): Likewise.
* config/rs6000/rs6000-linux.c (IN_TARGET_CODE): Likewise.
* config/rs6000/rs6000-p8swap.c (IN_TARGET_CODE): Likewise.
* config/rs6000/rs6000-string.c (IN_TARGET_CODE): Likewise.
* config/rs6000/rs6000.c (IN_TARGET_CODE): Likewise.
* config/rx/rx.c (IN_TARGET_CODE): Likewise.
* config/s390/driver-native.c (IN_TARGET_CODE): Likewise.
* config/s390/s390-c.c (IN_TARGET_CODE): Likewise.
* config/s390/s390.c (IN_TARGET_CODE): Likewise.
* config/sh/sh-c.c (IN_TARGET_CODE): Likewise.
* config/sh/sh-mem.cc (IN_TARGET_CODE): Likewise.
* config/sh/sh.c (IN_TARGET_CODE): Likewise.
* config/sh/sh_optimize_sett_clrt.cc (IN_TARGET_CODE): Likewise.
* config/sh/sh_treg_combine.cc (IN_TARGET_CODE): Likewise.
* config/sparc/driver-sparc.c (IN_TARGET_CODE): Likewise.
* config/sparc/sparc-c.c (IN_TARGET_CODE): Likewise.
* config/sparc/sparc.c (IN_TARGET_CODE): Likewise.
* config/spu/spu-c.c (IN_TARGET_CODE): Likewise.
* config/spu/spu.c (IN_TARGET_CODE): Likewise.
* config/stormy16/stormy16.c (IN_TARGET_CODE): Likewise.
* config/tilegx/mul-tables.c (IN_TARGET_CODE): Likewise.
* config/tilegx/tilegx-c.c (IN_TARGET_CODE): Likewise.
* config/tilegx/tilegx.c (IN_TARGET_CODE): Likewise.
* config/tilepro/mul-tables.c (IN_TARGET_CODE): Likewise.
* config/tilepro/tilepro-c.c (IN_TARGET_CODE): Likewise.
* config/tilepro/tilepro.c (IN_TARGET_CODE): Likewise.
* config/v850/v850-c.c (IN_TARGET_CODE): Likewise.
* config/v850/v850.c (IN_TARGET_CODE): Likewise.
* config/vax/vax.c (IN_TARGET_CODE): Likewise.
* config/visium/visium.c (IN_TARGET_CODE): Likewise.
* config/vms/vms-c.c (IN_TARGET_CODE): Likewise.
* config/vms/vms-f.c (IN_TARGET_CODE): Likewise.
* config/vms/vms.c (IN_TARGET_CODE): Likewise.
* config/xtensa/xtensa.c (IN_TARGET_CODE): Likewise.

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

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

The repeated checks for MEM_REF made this code hard to convert to
poly_ints as-is.  Hopefully the new structure also makes it clearer
at a glance what the two cases are.

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

gcc/
* tree-ssa-sccvn.c (vn_reference_lookup_3): Avoid repeated
checks for MEM_REF.

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

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

Similarly to the VEC_DUPLICATE_EXPR, this patch adds a tree code
equivalent of the VEC_SERIES rtx code: VEC_SERIES_EXPR.

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

gcc/
* doc/generic.texi (VEC_SERIES_EXPR): Document.
* doc/md.texi (vec_series@var{m}): Document.
* tree.def (VEC_SERIES_EXPR): New tree code.
* tree.h (build_vec_series): Declare.
* tree.c (build_vec_series): New function.
* cfgexpand.c (expand_debug_expr): Handle VEC_SERIES_EXPR.
* tree-pretty-print.c (dump_generic_node): Likewise.
* gimple-pretty-print.c (dump_binary_rhs): Likewise.
* tree-inline.c (estimate_operator_cost): Likewise.
* expr.c (expand_expr_real_2): Likewise.
* optabs-tree.c (optab_for_tree_code): Likewise.
* tree-cfg.c (verify_gimple_assign_binary): Likewise.
* fold-const.c (const_binop): Fold VEC_SERIES_EXPRs of constants.
* expmed.c (make_tree): Handle VEC_SERIES.
* optabs.def (vec_series_optab): New optab.
* optabs.h (expand_vec_series_expr): Declare.
* optabs.c (expand_vec_series_expr): New function.
* tree-vect-generic.c (expand_vector_operations_1): Check that
the operands also have vector type.

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

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

SVE needs a way of broadcasting a scalar to a variable-length vector.
This patch adds VEC_DUPLICATE_EXPR for when CONSTRUCTOR would be used
for fixed-length vectors; this is the tree equivalent of the existing
rtl code VEC_DUPLICATE.

The patch also adds a vec_duplicate_optab to go with VEC_DUPLICATE_EXPR.

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

gcc/
* doc/generic.texi (VEC_DUPLICATE_EXPR): Document.
(VEC_COND_EXPR): Add missing @tindex.
* doc/md.texi (vec_duplicate@var{m}): Document.
* tree.def (VEC_DUPLICATE_EXPR): New tree codes.
* tree.c (build_vector_from_val): Add stubbed-out handling of
variable-length vectors, using VEC_DUPLICATE_EXPR.
(uniform_vector_p): Handle VEC_DUPLICATE_EXPR.
* cfgexpand.c (expand_debug_expr): Likewise.
* tree-cfg.c (verify_gimple_assign_unary): Likewise.
* tree-inline.c (estimate_operator_cost): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-vect-generic.c (ssa_uniform_vector_p): Likewise.
* fold-const.c (const_unop): Fold VEC_DUPLICATE_EXPRs of a constant.
(test_vec_duplicate_folding): New function.
(fold_const_c_tests): Call it.
* optabs.def (vec_duplicate_optab): New optab.
* optabs-tree.c (optab_for_tree_code): Handle VEC_DUPLICATE_EXPR.
* optabs.h (expand_vector_broadcast): Declare.
* optabs.c (expand_vector_broadcast): Make non-static.  Try using
vec_duplicate_optab.
* expr.c (store_constructor): Try using vec_duplicate_optab for
uniform vectors.
(expand_expr_real_2): Handle VEC_DUPLICATE_EXPR.

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

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

2017-12-15  Markus Trippelsdorf  <markus@trippelsdorf.de>

PR target/83358
* config/i386/x86-tune-costs.h (skylake_cost, core_cost): Increase
div/mod latencies a bit.

        PR target/83358
* gcc.target/i386/pr83358-1.c: New test.
* gcc.target/i386/pr83358-2.c: New test.

From-SVN: r255739

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

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

From-SVN: r255738

6 years agosyscall: emulate Flock on AIX
Ian Lance Taylor [Sat, 16 Dec 2017 01:45:45 +0000 (01:45 +0000)]
syscall: emulate Flock on AIX

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

From-SVN: r255737

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

From-SVN: r255734

6 years agore PR middle-end/36550 (Wrong "may be used uninitialized" warning (conditional PHIs))
Jeff Law [Fri, 15 Dec 2017 22:35:51 +0000 (15:35 -0700)]
re PR middle-end/36550 (Wrong "may be used uninitialized" warning (conditional PHIs))

PR tree-optimization/36550
* tree-ssa-threadupdate.c (count_stmts_and_phis_in_block): New.
(mark_threaded_blocks): Rewrite code to avoid block copying when
optimizing for size.  Don't pessimize blocks which will be
copied, but all the statements will be dead.

PR tree-optimization/36550
* gcc.dg/tree-ssa/pr36550.c: New test.

From-SVN: r255731

6 years agore PR tree-optimization/81165 (Regression in GCC-8.0.0's optimizer)
Jeff Law [Fri, 15 Dec 2017 22:11:06 +0000 (15:11 -0700)]
re PR tree-optimization/81165 (Regression in GCC-8.0.0's optimizer)

PR tree-optimization/81165
* tree-ssa-threadupdate.c (uses_in_bb): New.
(estimate_threading_killed_stmts): New.
* tree-ssa-threadupdate.h (estimate_threading_killed_stmts): Prototype.
* tree-ssa-threadedge.c
(record_temporary_equivalences_from_stmts_at_dest): Expand limit
when its hit.

PR tree-optimization/81165
* gcc.dg/pr81165.c: New.

From-SVN: r255724

6 years agore PR c++/83205 (ICE on structured binding with ill-formed negative std::tuple_size...
Jakub Jelinek [Fri, 15 Dec 2017 21:40:45 +0000 (22:40 +0100)]
re PR c++/83205 (ICE on structured binding with ill-formed negative std::tuple_size<T>::value)

PR c++/83205
* decl.c (cp_finish_decomp): Handle the case when tsize is not
error_mark_node, but doesn't fit into uhwi.  Split up count != eltscnt
and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n
to handle plural forms properly.

* g++.dg/cpp1z/decomp3.C: Adjust for structured binding count
mismatch diagnostics split into error and warning with plural
forms.
* g++.dg/cpp1z/decomp10.C: Likewise.
* g++.dg/cpp1z/decomp32.C: New test.

From-SVN: r255706

6 years agore PR c++/81197 (ICE with structured binding and lifetime-extended temporaries)
Jakub Jelinek [Fri, 15 Dec 2017 21:39:20 +0000 (22:39 +0100)]
re PR c++/81197 (ICE with structured binding and lifetime-extended temporaries)

PR c++/81197
* cp-tree.h (cp_maybe_mangle_decomp): Declare.
* decl.c (cp_maybe_mangle_decomp): New function.
(cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here.
* parser.c (cp_convert_range_for,
cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp.
* pt.c (tsubst_expr): Likewise.
* mangle.c (find_decomp_unqualified_name): New function.
(write_unqualified_name): Handle DECL_DECOMPOSITION_P
where DECL_ASSEMBLER_NAME is already set.

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

From-SVN: r255705

6 years agore PR c++/80135 (ICE in output_constructor_regular_field, at varasm.c:4968)
Jakub Jelinek [Fri, 15 Dec 2017 20:20:00 +0000 (21:20 +0100)]
re PR c++/80135 (ICE in output_constructor_regular_field, at varasm.c:4968)

PR c++/80135
PR c++/81922
* typeck2.c (digest_init_r): Change nested argument type from bool to
int.  Use code instead of TREE_CODE (type) where possible.  If
nested == 2, diagnose initialization of flexible array member with
STRING_CST.  Pass nested to process_init_constructor.  Formatting fix.
(digest_init, digest_init_flags): Adjust digest_init_r caller.
(massage_init_elt): Add nested argument.  Pass 2 instead of 1 to
digest_init_r's nested argument if nested is non-zero.
(process_init_constructor_array): Add nested argument.  If nested == 2,
diagnose initialization of flexible array member with non-empty
braced enclosed list.  Pass nested to massage_init_elt.
(process_init_constructor_record, process_init_constructor_union): Add
nested argument, pass it to massage_init_elt.
(process_init_constructor): Add nested argument, pass it to
process_init_constructor_{array,record,union}.
* init.c (find_field_init): Renamed to ...
(find_flexarray_init): ... this.  Return NULL_TREE if init is
error_mark_node.  Don't look through nested CONSTRUCTORs.
(warn_placement_new_too_small): Adjust caller.

* g++.dg/warn/Wplacement-new-size-1.C (fBx1): Initialize nested
flexible array member only with {}.  Add dg-warning.
(fBx2, fBx3): Remove.
* g++.dg/warn/Wplacement-new-size-2.C (fBx1): Initialize nested
flexible array member only with {}.  Add dg-warning.
(fBx2, fBx3): Remove.
* g++.dg/warn/Wplacement-new-size-6.C: New test.
* g++.dg/ext/flexary13.C (main): Remove test for initialization
of nested flexible array member with non-empty initializer.
* g++.dg/ext/flexary25.C: New test.
* g++.dg/ext/flexary26.C: New test.
* g++.dg/ext/flexary27.C: New test.
* g++.dg/parse/pr43765.C: Expect diagnostics about initialization
of nested flexible array member with non-empty initializer.  Expect
C++2A diagnostics about mixing of designated and non-designated
initializers.

From-SVN: r255703

6 years agore PR c++/83217 (Compiler segfault: structured binding by reference to a templated...
Jakub Jelinek [Fri, 15 Dec 2017 19:41:45 +0000 (20:41 +0100)]
re PR c++/83217 (Compiler segfault: structured binding by reference to a templated type via a pointer)

PR c++/83217
* decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
call complete_type (TREE_TYPE (type)).

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

From-SVN: r255702

6 years agore PR tree-optimization/80631 (Compiling with -O3 -mavx2 gives wrong code)
Jakub Jelinek [Fri, 15 Dec 2017 17:51:36 +0000 (18:51 +0100)]
re PR tree-optimization/80631 (Compiling with -O3 -mavx2 gives wrong code)

PR tree-optimization/80631
* gcc.target/i386/avx2-pr80631.c: New test.

From-SVN: r255701

6 years agore PR tree-optimization/83410 (libgomp.graphite/force-parallel-4.c etc. FAIL)
Jeff Law [Fri, 15 Dec 2017 16:19:22 +0000 (09:19 -0700)]
re PR tree-optimization/83410 (libgomp.graphite/force-parallel-4.c etc. FAIL)

PR tree-optimization/83410
* tree-ssa-threadupdate.c (thread_block_1): Avoid certain jump
threads when parallelizing loops.

From-SVN: r255700

6 years agotree-core.h (struct attribute_spec): Swap affects_type_identity and handler fields.
Jakub Jelinek [Fri, 15 Dec 2017 15:13:12 +0000 (16:13 +0100)]
tree-core.h (struct attribute_spec): Swap affects_type_identity and handler fields.

* tree-core.h (struct attribute_spec): Swap affects_type_identity and
handler fields.
* config/alpha/alpha.c (vms_attribute_table): Swap
affects_type_identity and handler fields, adjust comments.
* config/mips/mips.c (mips_attribute_table): Likewise.
* config/visium/visium.c (visium_attribute_table): Likewise.
* config/epiphany/epiphany.c (epiphany_attribute_table): Likewise.
* config/microblaze/microblaze.c (microblaze_attribute_table):
Likewise.
* config/spu/spu.c (spu_attribute_table): Likewise.
* config/mcore/mcore.c (mcore_attribute_table): Likewise.
* config/arc/arc.c (arc_attribute_table): Likewise.
* config/m68k/m68k.c (m68k_attribute_table): Likewise.
* config/v850/v850.c (v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): Formatting fixes.
(v850_attribute_table): Swap affects_type_identity and handler
fields, adjust comments.
* config/m32r/m32r.c (m32r_attribute_table): Likewise.
* config/arm/arm.c (arm_attribute_table): Likewise.
* config/avr/avr.c (avr_attribute_table): Likewise.
* config/s390/s390.c (s390_attribute_table): Likewise.
* config/sh/sh.c (sh_attribute_table): Likewise.
* config/i386/i386.c (ix86_handle_cconv_attribute,
ix86_handle_callee_pop_aggregate_return): Formatting fixes.
(ix86_attribute_table): Swap affects_type_identity and handler
fields, adjust comments.
* config/i386/cygming.h (SUBTARGET_ATTRIBUTE_TABLE): Likewise.
* config/sparc/sparc.c (sparc_attribute_table): Likewise.
* config/m32c/m32c.c (m32c_attribute_table): Likewise.
* config/sol2.h (SOLARIS_ATTRIBUTE_TABLE): Likewise.
* config/ia64/ia64.c (ia64_attribute_table): Likewise.
* config/msp430/msp430.c (msp430_attribute_table): Likewise.
* config/rx/rx.c (rx_attribute_table): Likewise.
* config/cr16/cr16.c (cr16_attribute_table): Likewise.
* config/h8300/h8300.c (h8300_attribute_table): Likewise.
* config/nvptx/nvptx.c (nvptx_attribute_table): Likewise.
* config/powerpcspe/powerpcspe.c (rs6000_attribute_table): Likewise.
* config/darwin.h (SUBTARGET_ATTRIBUTE_TABLE): Likewise.
* config/stormy16/stormy16.c (xstormy16_attribute_table): Likewise.
* config/bfin/bfin.c (bfin_attribute_table): Likewise.
* config/rs6000/rs6000.c (rs6000_attribute_table): Likewise.
* config/rl78/rl78.c (rl78_attribute_table): Likewise.
* config/nds32/nds32.c (nds32_attribute_table): Likewise.
* doc/plugins.texi (user_attr): Likewise.  Add NULL for
exclude.
* attribs.c (empty_attribute_table): Swap affects_type_identity and
handler fields.
(register_scoped_attributes, decl_attributes): Formatting fixes.
ada/
* gcc-interface/utils.c (gnat_internal_attribute_table): Swap
affects_type_identity and handler fields, adjust comments.
brig/
* brig-lang.c (brig_attribute_table): Swap affects_type_identity
and handler fields, adjust comments.
c-family/
* c-attribs.c (c_common_attribute_table,
c_common_format_attribute_table): Swap affects_type_identity
and handler fields, adjust comments.
cp/
* tree.c (cxx_attribute_table, std_attribute_table): Swap
affects_type_identity and handler fields, adjust comments.
fortran/
* f95-lang.c (gfc_attribute_table): Swap affects_type_identity
and handler fields, adjust comments.
lto/
* lto-lang.c (lto_attribute_table, lto_format_attribute_table): Swap
affects_type_identity and handler fields, adjust comments.
testsuite/
* g++.dg/plugin/attribute_plugin.c (user_attr): Swap
affects_type_identity and handler fields, add NULL for exclude.

From-SVN: r255699

6 years ago[PR C++/59930] template friend classes & default args
Nathan Sidwell [Fri, 15 Dec 2017 15:04:59 +0000 (15:04 +0000)]
[PR C++/59930] template friend classes & default args

https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01055.html
PR c++/59930
* decl.c (xref_tag_1): Correct comments about template friends and
default args.
* friend.c (make_friend_class): Move comments concerning
self-friendliness to code dealing with such.
* pt.c (check_default_tmpl_args): Deal with template friend
classes too.
(push_template_decl_real): Check default args for non-function
template friends.

PR c++/59930
* g++.dg/cpp0x/temp_default4.C: Adjust diagnostic.
* g++.old-deja/g++.pt/friend23.C: Likewise.
* g++.old-deja/g++.pt/friend24.C: Delete.

From-SVN: r255698

6 years agore PR tree-optimization/83269 (Wrong constant folding)
Jakub Jelinek [Fri, 15 Dec 2017 14:37:52 +0000 (15:37 +0100)]
re PR tree-optimization/83269 (Wrong constant folding)

PR tree-optimization/83269
* fold-const.c (fold_binary_loc): Perform (-A) - B -> (-B) - A
subtraction in arg0's type if type is signed and arg0 is unsigned.
Formatting fix.

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

From-SVN: r255697

6 years agore PR sanitizer/81281 (UBSAN: false positive, dropped promotion to long type.)
Jakub Jelinek [Fri, 15 Dec 2017 14:36:26 +0000 (15:36 +0100)]
re PR sanitizer/81281 (UBSAN: false positive, dropped promotion to long type.)

PR sanitizer/81281
* match.pd ((T)(P + A) - (T)P -> (T) A): Use @@0 instead of @0 and
convert? on @0 instead of convert.  Check type of @1, not @0.
((T)P - (T)(P + A) -> -(T) A): Use @@0 instead of @0 and
convert? on @0 instead of convert.  Check type of @1, not @0.
((T)(P + A) - (T)(P + B) -> (T)A - (T)B): Use @@0 instead of @0,
only optimize if either both @1 and @2 types are narrower
precision, or both are wider or equal precision, and in the former
case only if both have undefined overflow.

* gcc.dg/pr81281-3.c: New test.

From-SVN: r255696

6 years agoexp_aggr.adb (Aggr_Assignment_OK_For_Backend): Use Component_Size of the innermost...
Pierre-Marie de Rodat [Fri, 15 Dec 2017 14:09:02 +0000 (14:09 +0000)]
exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Use Component_Size of the innermost array instead of Esize of its component...

gcc/ada/

2017-12-15  Eric Botcazou  <ebotcazou@adacore.com>

* exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Use Component_Size of
the innermost array instead of Esize of its component type to exclude
inappropriate array types, including packed array types.

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_prag.adb (Analyze_Input_Item): Allow concurrent types to appear
within the input list of Initializes. Remove the uses of Input_OK.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* exp_ch4.adb (Expand_N_In): Do not replace a membership test on a
scalar type with a validity test when the membership appears in a
predicate expression, to prevent a spurious error when predicate is
specified static.
* sem_ch13.adb (Build_Predicate_Functions): Add warning if a static
predicate, after constant-folding, reduces to True and is this
redundant.
* par-ch4.adb: Typo fixes and minor reformattings.

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_elab.adb (Ensure_Prior_Elaboration_Static): Mark the generated
with clause as being implicit for an instantiation in order to
circumvent an issue with 'W' and 'Z' line encodings in ALI files.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* sem_util.adb (Is_Potentially_Unevaluated): Detect further cases of
misuse of 'Old that appear within an expression that is potentially
unevaluated, when the prefix of the attribute does not statically
designate an object (e.g. a function call).

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (Conformking_Types): Two incomplete types are conforming
when one of them is used as a generic actual, but only within an
instantiation.
* einfo.ads: Clarify use of flag Used_As_Generic_Actual.

2017-12-15  Justin Squirek  <squirek@adacore.com>

* sem_attr.adb (Resolve_Attribute): Modify check for aliased view on
prefix to use the prefix's original node to avoid looking at expanded
conversions for certain array types.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* sem_res.adb (Resolve_Membership_Op): Add warning on a membership
operation on a scalar type for which there is a user-defined equality
operator.

2017-12-15  Yannick Moy  <moy@adacore.com>

* doc/gnat_rm/implementation_defined_pragmas.rst: Add Ghost assertion
policy.

gcc/testsuite/

2017-12-15  Justin Squirek  <squirek@adacore.com>

* gnat.dg/aliasing4.adb: New testcase.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* gnat.dg/incomplete6.adb, gnat.dg/incomplete6.ads: New testcase.

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* gnat.dg/initializes.ads, gnat.dg/initializes.adb: New testcase.

2017-12-15  Eric Botcazou  <ebotcazou@adacore.com>

* gnat.dg/component_size.adb: New testcase.

From-SVN: r255695

6 years agore PR sanitizer/83388 (reference statement index not found error with -fsanitize...
Richard Biener [Fri, 15 Dec 2017 13:43:30 +0000 (13:43 +0000)]
re PR sanitizer/83388 (reference statement index not found error with -fsanitize=null)

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

PR lto/83388
* internal-fn.def (IFN_NOP): Add.
* internal-fn.c (expand_NOP): Do nothing.
* lto-streamer-in.c (input_function): Instead of removing
sanitizer calls replace them with IFN_NOP calls.

* gcc.dg/lto/pr83388_0.c: New testcase.

From-SVN: r255694

6 years ago[multiple changes]
Pierre-Marie de Rodat [Fri, 15 Dec 2017 13:23:10 +0000 (13:23 +0000)]
[multiple changes]

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_prag.adb (Analyze_Initialization_Item): Remove the specialized
processing for a null initialization item. Such an item is always
illegal.

2017-12-15  Bob Duff  <duff@adacore.com>

* types.ads, types.h, libgnat/a-except.adb, exp_ch11.adb
(PE_Build_In_Place_Mismatch): New reason code for raising when the
BIPalloc formal parameter is incorrect. This can happen if a compiler
bug causes a mismatch of build-in-place between caller and callee.
* exp_ch6.adb (Expand_N_Extended_Return_Statement): Use
PE_Build_In_Place_Mismatch.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* exp_ch4.ads, exp_ch4.adb (Expand_N_Reduction_Expression): New
procedure.
* exp_util.adb (Insert_Actions): Handle N_Reduction_Expression.
* expander.adb (Expand): Call Expand_N_Reduction_Expression
* par-ch4.adb (P_Reduction_Expression): New procedure.
(P_Iterated_Component_Assoc_Or_Reduction): New precedure, extension of
P_Iterated_Component_Association.
(OK_Reduction_Expression_Parameter): New procedure.
(P_Aggregate_Or_Paren_Expr): Improve error message for malformed delta
aggregate.
* sem.adb (Analyze): Call Analyze_Reduction_Expression and
Analyze_Reduction_Expression_Parameter
* sinfo.ads, sinfo.adb: New node kinds N_Reduction_Expression and
N_Reduction_Expression_Parameter.
* sem_ch4.ads, sem_ch4.adb (Analyze_Reduction_Expression,
Analyze_Reduction_Expression_Parameter): New procedures.
* sem_res.adb (Resolve): Handle Reduction_Expression and
Reduction_Expression_Parameter
* sem_spark.adb: Dummy entries for Reduction_Expression and
Reduction_Expression_Parameter
* sprint.adb (Sprint_Node_Actual): Print Reduction_Expression,
Reduction_Expression_Parameter

From-SVN: r255693

6 years agoMake dse.c use offset/width instead of start/end
Richard Sandiford [Fri, 15 Dec 2017 13:12:25 +0000 (13:12 +0000)]
Make dse.c use offset/width instead of start/end

store_info and read_info_type in dse.c represented the ranges as
start/end, but a lot of the internal code used offset/width instead.
Using offset/width throughout fits better with the poly_int.h
range-checking functions.

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

gcc/
* dse.c (store_info, read_info_type): Replace begin and end with
offset and width.
(print_range): New function.
(set_all_positions_unneeded, any_positions_needed_p)
(check_mem_read_rtx, scan_stores, scan_reads, dse_step5): Update
accordingly.
(record_store): Likewise.  Optimize the case in which all positions
are unneeded.
(get_stored_val): Replace read_begin and read_end with read_offset
and read_width.
(replace_read): Update call accordingly.

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

6 years agogimple-loop-interchange.cc (STMT_COST_RATIO): New macro.
Bin Cheng [Fri, 15 Dec 2017 12:22:24 +0000 (12:22 +0000)]
gimple-loop-interchange.cc (STMT_COST_RATIO): New macro.

* gimple-loop-interchange.cc (STMT_COST_RATIO): New macro.
(loop_cand::m_num_stmts, loop_cand::m_const_init_reduc): New members.
(loop_cand::loop_cand): Initialize above members.
(loop_cand::supported_operations): Delete.
(loop_cand::can_interchange_p): Inline above function.
(loop_cand::classify_simple_reduction): Record number of constant
initialized simple reductions.
(should_interchange_loops): New parameters.  Check stmt cost of loops
to be interchange.
(tree_loop_interchange::interchange): Prepare stmt cost of outer loop.
Update call to should_interchange_loops.
(should_interchange_loop_nest): Update call to
should_interchange_loops.

From-SVN: r255691

6 years agoeinfo.ads: Comment fix.
Pierre-Marie de Rodat [Fri, 15 Dec 2017 11:34:47 +0000 (11:34 +0000)]
einfo.ads: Comment fix.

gcc/ada/

2017-12-15  Bob Duff  <duff@adacore.com>

* einfo.ads: Comment fix.

2017-12-15  Piotr Trojanek  <trojanek@adacore.com>

* s-vercon.adb: Minor style fixes.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (Freeze_Expr_Types): Do not emit a freeze node for an
itype that is the type of a discriminant-dependent component.

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_prag.adb (Analyze_Part_Of): The context-specific portion of the
analysis is now directed to several specialized routines.
(Check_Part_Of_Abstract_State): New routine.
(Check_Part_Of_Concurrent_Type): New routine. Reimplement the checks
involving the item, the single concurrent type, and their respective
contexts.
* sem_res.adb (Resolve_Entity_Name): Potential constituents of a single
concurrent type are now recorded regardless of the SPARK mode.
* sem_util.adb (Check_Part_Of_Reference): Split some of the tests in
individual predicates.  A Part_Of reference is legal when it appears
within the statement list of the object's immediately enclosing
package.
(Is_Enclosing_Package_Body): New routine.
(Is_Internal_Declaration_Or_Body): New routine.
(Is_Single_Declaration_Or_Body): New routine.
(Is_Single_Task_Pragma): New routine.

gcc/testsuite/

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* gnat.dg/expr_func2.ads, gnat.dg/expr_func2.adb: New testcase.

From-SVN: r255690

6 years agore PR target/66488 (segfault on sizeof(long) < sizeof(void*) and large GCC memory...
Eric Botcazou [Fri, 15 Dec 2017 11:30:56 +0000 (11:30 +0000)]
re PR target/66488 (segfault on sizeof(long) < sizeof(void*) and large GCC memory usage)

2017-12-15  Eric Botcazou  <ebotcazou@adacore.com>

        PR target/66488
        * ggc-page.c (HOST_BITS_PER_PTR): Do not define here...
        * hwint.h (HOST_BITS_PER_PTR): ...but here instead.
        * config/i386/xm-mingw32.h (HOST_BITS_PER_PTR): Delete.

From-SVN: r255687

6 years ago[multiple changes]
Pierre-Marie de Rodat [Fri, 15 Dec 2017 11:20:34 +0000 (11:20 +0000)]
[multiple changes]

2017-12-15  Patrick Bernardi  <bernardi@adacore.com>

* gnat_ugn.texi: Regenerate.

2017-12-15  Bob Duff  <duff@adacore.com>

* gnatvsn.ads: Minor comment fixes.

From-SVN: r255686

6 years agognat_and_program_execution.rst: Update section "Dynamic Stack Usage Analysis" to...
Pierre-Marie de Rodat [Fri, 15 Dec 2017 11:16:14 +0000 (11:16 +0000)]
gnat_and_program_execution.rst: Update section "Dynamic Stack Usage Analysis" to include more details about...

gcc/ada/

2017-12-15  Patrick Bernardi  <bernardi@adacore.com>

* doc/gnat_ugn/gnat_and_program_execution.rst: Update section "Dynamic
Stack Usage Analysis" to include more details about GNAT_STACK_LIMIT.

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* exp_util.adb (Add_Own_DIC): Ensure that the expression of the pragma
is available (Is_Verifiable_DIC_Pragma): Moved from Sem_Util.
* sem_util.adb (Has_Full_Default_Initialization):
Has_Fully_Default_Initializing_DIC_Pragma is now used to determine
whether a type has full default initialization due to pragma
Default_Initial_Condition.
(Has_Fully_Default_Initializing_DIC_Pragma): New routine.
(Is_Verifiable_DIC_Pragma): Moved to Exp_Util.
* sem_util.ads (Has_Fully_Default_Initializing_DIC_Pragma): New
routine.
(Is_Verifiable_DIC_Pragma): Moved to Exp_Util.
* sem_warn.adb (Is_OK_Fully_Initialized):
Has_Fully_Default_Initializing_DIC_Pragma is now used to determine
whether a type has full default initialization due to pragma
Default_Initial_Condition.

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_prag.adb (Match_Constituent): Do not quietly accept constants as
suitable constituents.
* exp_util.adb: Minor reformatting.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* exp_aggr.adb (In_Place_Assign_OK): Extend the predicate to recognize
an array aggregate in an allocator, when the designated type is
unconstrained and the upper bound of the aggregate belongs to the base
type of the index.

2017-12-15  Bob Duff  <duff@adacore.com>

* exp_ch6.adb (Expand_N_Extended_Return_Statement,
Expand_Simple_Function_Return): Assert that the b-i-p-ness of the
caller and callee match.  Otherwise, we would need some substantial
changes to allow b-i-p calls non-b-i-p, and vice versa.

gcc/testsuite/

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* gnat.dg/dflt_init_cond.adb, gnat.dg/dflt_init_cond_pkg.ads: New
testcase.

From-SVN: r255685

6 years agogcc/ada/ChangeLog: add entries missing from previous commit
Pierre-Marie de Rodat [Fri, 15 Dec 2017 10:28:14 +0000 (10:28 +0000)]
gcc/ada/ChangeLog: add entries missing from previous commit

From-SVN: r255684

6 years agoexp_unst.adb (Unnest_Subprograms): Nothing to do if the main unit is a generic packag...
Pierre-Marie de Rodat [Fri, 15 Dec 2017 10:21:24 +0000 (10:21 +0000)]
exp_unst.adb (Unnest_Subprograms): Nothing to do if the main unit is a generic package body.

gcc/ada/

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* exp_unst.adb (Unnest_Subprograms): Nothing to do if the main unit is
a generic package body. Unnesting is only an issue when generating
code, and if the main unit is generic then nested instance bodies have
not been created and analyzed, and unnesting will crash in the absence
of those bodies,

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* inline.adb (Add_Inlined_Body): Do not add a function which is
completed by an expression function defined in the same context as the
initial declaration because the completing body is not in a package
body.
(Is_Non_Loading_Expression_Function): New routine.

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* debug.adb: Move the functionality of -gnatdL to -gnatd_i. Restore
the behavior of -gnatdL from before revision 255412.
* sem_elab.adb: Update the section of compiler switches.
(Build_Call_Marker): Do not create a marker for a call which originates
from an expanded spec or body of an instantiated gener, does not invoke
a generic formal subprogram, the target is external to the instance,
and -gnatdL is in effect.
(In_External_Context): New routine.
(Process_Conditional_ABE_Activation_Impl): Update the uses of -gnatdL
and associated flag.
(Process_Conditional_ABE_Call): Update the uses of -gnatdL and
associated flag.
* switch-c.adb (Scan_Front_End_Switches): Switch -gnatJ now sets switch
-gnatd_i.
* exp_unst.adb: Minor typo fixes and edits.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (Possible_Freeze): Do not set Delayed_Freeze on an
subprogram instantiation, now that the enclosing wrapper package
carries an explicit freeze node. THis prevents freeze nodes for the
subprogram for appearing in the wrong scope. This is relevant when the
generic subprogram has a private or incomplete formal type and the
instance appears within a package that declares the actual type for the
instantiation, and that type has itself a delayed freeze.

2017-12-15  Patrick Bernardi  <bernardi@adacore.com>

* doc/gnat_ugn/gnat_and_program_execution.rst: Removed references to
the environment variable GNAT_STACK_LIMIT from the Stack Overflow
Checking section as it is no longer used by any of our supported
targets.

gcc/testsuite/

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* gnat.dg/expr_func_main.adb, gnat.dg/expr_func_pkg.ads,
gnat.dg/expr_func_pkg.adb: New testcase.

2017-12-15  Hristian Kirtchev  <kirtchev@adacore.com>

* gnat.dg/abe_pkg.adb, gnat.dg/abe_pkg.ads: New testcase.

2017-12-15  Ed Schonberg  <schonberg@adacore.com>

* gnat.dg/subp_inst.adb, gnat.dg/subp_inst_pkg.adb,
gnat.dg/subp_inst_pkg.ads: New testcase.

From-SVN: r255683

6 years ago[multiple changes]
Pierre-Marie de Rodat [Fri, 15 Dec 2017 09:44:22 +0000 (09:44 +0000)]
[multiple changes]

2017-12-15  Bob Duff  <duff@adacore.com>

* exp_ch6.adb (Expand_N_Extended_Return_Statement): If the
Init_Assignment is rewritten, we need to set Assignment_OK on the new
node.  Otherwise, we will get spurious errors when initializing via
assignment statement.

2017-12-15  Arnaud Charlet  <charlet@adacore.com>

* exp_unst.adb (Visit_Node): Refine handling of 'Access to ignore non
relevant nodes.
(Has_Non_Null_Statements): Moved to sem_util for later reuse.

2017-12-15  Eric Botcazou  <ebotcazou@adacore.com>

* exp_attr.adb (Is_Inline_Floating_Point_Attribute): Fix comment.
* libgnat/s-fatgen.adb (Model): Use Machine attribute.
(Truncation): Likewise.

2017-12-15  Bob Duff  <duff@adacore.com>

* exp_ch7.adb (Expand_Cleanup_Actions): Make sure the block and handled
statement sequence generated for certain extended return statements
have a Sloc that is not No_Location. Otherwise, the back end doesn't
set any location and ends up reading uninitialized variables.

From-SVN: r255680

6 years agotypes.ads, [...]: Partly revert r255414, committed by mistake.
Bob Duff [Fri, 15 Dec 2017 09:36:12 +0000 (09:36 +0000)]
types.ads, [...]: Partly revert r255414, committed by mistake.

2017-12-15  Bob Duff  <duff@adacore.com>

* types.ads, exp_ch6.adb, libgnat/s-regexp.ads, opt.ads: Partly revert
r255414, committed by mistake.

From-SVN: r255679

6 years agoEnable VAES support [5/5]
Julia Koval [Fri, 15 Dec 2017 05:04:33 +0000 (06:04 +0100)]
Enable VAES support [5/5]

gcc/
* config/i386/i386-builtin.def (__builtin_ia32_vaesenclast_v16qi,
__builtin_ia32_vaesenclast_v32qi, __builtin_ia32_vaesenclast_v64qi): New.
* config/i386/sse.md (vaesenclast_<mode>): New pattern.
* config/i386/vaesintrin.h (_mm256_aesenclast_epi128,
_mm512_aesenclast_epi128, _mm_aesenclast_epi128): New intrinsics.

gcc/testsuite/
* gcc.target/i386/avx512f-aesenclast-2.c: New test.
* gcc.target/i386/avx512vl-aesenclast-2.c: Ditto.
* gcc.target/i386/avx512fvl-vaes-1.c: Handle new intrinsics.

From-SVN: r255676

6 years agoEnable VAES support [4/5]
Julia Koval [Fri, 15 Dec 2017 04:31:08 +0000 (05:31 +0100)]
Enable VAES support [4/5]

gcc/
* config/i386/i386-builtin.def (__builtin_ia32_vaesenc_v16qi,
__builtin_ia32_vaesenc_v32qi, __builtin_ia32_vaesenc_v64qi): New.
* config/i386/sse.md (vaesenc_<mode>): New pattern.
* config/i386/vaesintrin.h (_mm256_aesenc_epi128, _mm512_aesenc_epi128,
_mm_aesenc_epi128): New intrinsics.

gcc/testsuite/
* gcc.target/i386/avx512f-aesenc-2.c: New test.
* gcc.target/i386/avx512vl-aesenc-2.c: Ditto.
* gcc.target/i386/avx512fvl-vaes-1.c: Handle new intrinsics.

From-SVN: r255675

6 years agoEnable VAES support [3/5]
Julia Koval [Fri, 15 Dec 2017 04:05:17 +0000 (05:05 +0100)]
Enable VAES support [3/5]

gcc/
* config/i386/i386-builtin.def (__builtin_ia32_vaesdeclast_v16qi,
__builtin_ia32_vaesdeclast_v32qi, __builtin_ia32_vaesdeclast_v64qi): New.
* config/i386/sse.md (vaesdeclast_<mode>): New pattern.
* config/i386/vaesintrin.h (_mm256_aesdeclast_epi128,
_mm512_aesdeclast_epi128, _mm_aesdeclast_epi128): New intrinsics.

gcc/testsuite/
* gcc.target/i386/avx512f-aesdeclast-2.c: New test.
* gcc.target/i386/avx512vl-aesdeclast-2.c
* gcc.target/i386/avx512fvl-vaes-1.c: Handle new intrinsics.

From-SVN: r255674

6 years agoFix ChangeLog entry date
Peter Bergner [Fri, 15 Dec 2017 03:46:02 +0000 (21:46 -0600)]
Fix ChangeLog entry date

From-SVN: r255673

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

From-SVN: r255670

6 years agoPR libstdc++/83279 handle sendfile not copying entire file
Jonathan Wakely [Thu, 14 Dec 2017 21:49:03 +0000 (21:49 +0000)]
PR libstdc++/83279 handle sendfile not copying entire file

PR libstdc++/83279
* src/filesystem/std-ops.cc (do_copy_file): Handle sendfile not
copying entire file.

From-SVN: r255666

6 years agoPR libstdc++/68519 use native duration to avoid rounding errors
Jonathan Wakely [Thu, 14 Dec 2017 20:41:52 +0000 (20:41 +0000)]
PR libstdc++/68519 use native duration to avoid rounding errors

PR libstdc++/68519
* include/std/condition_variable (condition_variable::wait_for):
Convert duration to native clock's duration before addition.
* testsuite/30_threads/condition_variable/members/68519.cc: New test.

From-SVN: r255665

6 years agogimple-ssa-strength-reduction.c (analyze_increments): Distinguish replacement costs...
Bill Schmidt [Thu, 14 Dec 2017 20:40:21 +0000 (20:40 +0000)]
gimple-ssa-strength-reduction.c (analyze_increments): Distinguish replacement costs for constant strides from those for unknown strides.

2017-12-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

* gimple-ssa-strength-reduction.c (analyze_increments):
Distinguish replacement costs for constant strides from those for
unknown strides.

From-SVN: r255664

6 years ago* var-tracking.c (variable_tracking_main_1): Formatting fix.
Jakub Jelinek [Thu, 14 Dec 2017 20:12:38 +0000 (21:12 +0100)]
* var-tracking.c (variable_tracking_main_1): Formatting fix.

From-SVN: r255663

6 years agoinvoke.texi: Document -Wcast-function-type.
Bernd Edlinger [Thu, 14 Dec 2017 18:59:24 +0000 (18:59 +0000)]
invoke.texi: Document -Wcast-function-type.

gcc:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * doc/invoke.texi: Document -Wcast-function-type.
        * recog.h (stored_funcptr): Change signature.
        * tree-dump.c (dump_node): Avoid warning.
        * typed-splay-tree.h (typed_splay_tree): Avoid warning.

libcpp:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * internal.h (maybe_print_line): Change signature.

c-family:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * c.opt (Wcast-function-type): New warning option.
        * c-lex.c (get_fileinfo): Avoid warning.
        * c-ppoutput.c (scan_translation_unit_directives_only): Remove cast.

c:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * c-typeck.c (c_safe_arg_type_equiv_p,
        c_safe_function_type_cast_p): New function.
        (build_c_cast): Implement -Wcast-function-type.

cp:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * decl2.c (start_static_storage_duration_function): Avoid warning.
        * typeck.c (cxx_safe_arg_type_equiv_p,
        cxx_safe_function_type_cast_p): New function.
        (build_reinterpret_cast_1): Implement -Wcast-function-type.

testsuite:
2017-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * c-c++-common/Wcast-function-type.c: New test.
        * g++.dg/Wcast-function-type.C: New test.

From-SVN: r255661

6 years agoMakefile.am (IFUNC_OPTIONS): Change aarch64 option from -march=armv8.1-a to -march...
Steve Ellcey [Thu, 14 Dec 2017 18:30:38 +0000 (18:30 +0000)]
Makefile.am (IFUNC_OPTIONS): Change aarch64 option from -march=armv8.1-a to -march=armv8-a+lse.

2017-12-14  Steve Ellcey  <sellcey@cavium.com>

* Makefile.am (IFUNC_OPTIONS): Change aarch64
option from -march=armv8.1-a to -march=armv8-a+lse.
* configure.ac (*aarch64*): Check to see if
compiler understands -march=armv8-a+lse option.
* configure.tgt (*aarch64*): Only set try_ifunc
if compiler understands -march=armv8-a+lse option.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* configure: Regenerate.
* aclocal.m4: Regenerate.

From-SVN: r255659

6 years agoPatch for middle-end/PR79538
Qing Zhao [Thu, 14 Dec 2017 17:37:20 +0000 (17:37 +0000)]
Patch for middle-end/PR79538
missing -Wformat-overflow with %s and non-member array arguments

-Wformat-overflow uses the routine "get_range_strlen" to decide the
maximum string length, however, currently "get_range_strlen" misses
the handling of non-member arrays.

Adding the handling of non-member array resolves the issue.
Adding test case pr79538.c into gcc.dg.

During gcc bootstrap, 2 source files (c-family/c-cppbuiltin.c,
fortran/class.c) were detected new warnings by -Wformat-overflow
due to the new handling of non-member array in "get_range_strlen".
in order to avoid these new warnings and continue with bootstrap,
updating these 2 files to avoid the warnings.

in c-family/c-cppbuiltin.c, the warning is following:

../../latest_gcc_2/gcc/c-family/c-cppbuiltin.c:1627:15: note:
‘sprintf’ output 2 or more bytes (assuming 257) into a destination
of size 256
       sprintf (buf1, "%s=%s", macro, buf2);
       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
in the above, buf1 and buf2 are declared as:
char buf1[256], buf2[256];

i.e, buf1 and buf2 have same size. adjusting the size of buf1 and
buf2 resolves the warning.

fortran/class.c has the similar issue as above. Instead of adjusting
size of the buffers, replacing sprintf with xasprintf is a better
solution for these cases.

From-SVN: r255654

6 years ago* gcc-interface/Makefile.in: Generalize support for symbolic traces.
Eric Botcazou [Thu, 14 Dec 2017 17:32:56 +0000 (17:32 +0000)]
* gcc-interface/Makefile.in: Generalize support for symbolic traces.

From-SVN: r255653

6 years agoPR libstdc++/83427 detect weak result type from noexcept functions
Jonathan Wakely [Thu, 14 Dec 2017 17:18:22 +0000 (17:18 +0000)]
PR libstdc++/83427 detect weak result type from noexcept functions

PR libstdc++/83427
* include/bits/refwrap.h (_Maybe_unary_or_binary_function): Move here
from <bits/std_function.h>.
(_Mem_fn_traits_base, _Mem_fn_traits): Move here, from <functional>.
(_Weak_result_type_impl, _Reference_wrapper_base): Deduce noexcept
for function types. Remove partial specializations for member
functions.
(_Weak_result_type_impl): Remove unused partial specializations for
non-referenceable function types and for references to functions.
(_Weak_result_type_memfun, _Reference_wrapper_base_memfun): New
helpers to handle member functions via _Mem_fn_traits.
(_Weak_result_type, reference_wrapper): Derive from new helpers.
* include/bits/std_function.h (_Maybe_unary_or_binary_function): Move
to <bits/refwrap.h>.
* include/std/functional (_Pack, _AllConvertible, _NotSame): Remove.
(_Mem_fn_traits_base, _Mem_fn_traits): Move to <bits/refwrap.h>.
* testsuite/20_util/bind/83427.cc: New test.
* testsuite/20_util/bind/refqual.cc: Add noexcept to functions and
check for weak result types.
* testsuite/20_util/reference_wrapper/83427.cc: New test.

From-SVN: r255651