François Dumont [Sat, 7 Nov 2020 09:04:31 +0000 (10:04 +0100)]
libstdc++: Remove <debug/array>
Add _GLIBCXX_ASSERTIONS assert in normal std::array and remove __gnu_debug::array
implementation.
libstdc++-v3/ChangeLog:
* include/debug/array: Remove.
* include/Makefile.am: Remove <debug/array>.
* include/Makefile.in: Regenerate.
* include/experimental/functional: Adapt.
* include/std/array: Move to _GLIBCXX_INLINE_VERSION namespace.
* include/std/functional: Adapt.
* include/std/span: Adapt.
* testsuite/23_containers/array/debug/back1_neg.cc:
Remove dg-require-debug-mode. Add -D_GLIBCXX_ASSERTIONS option.
* testsuite/23_containers/array/debug/back2_neg.cc: Likewise.
* testsuite/23_containers/array/debug/front1_neg.cc: Likewise.
* testsuite/23_containers/array/debug/front2_neg.cc: Likewise.
* testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc:
Likewise.
* testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc:
Likewise.
* testsuite/23_containers/array/element_access/60497.cc
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
Remove.
* testsuite/23_containers/array/tuple_interface/get_neg.cc
* testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
Jason Merrill [Fri, 6 Nov 2020 20:51:10 +0000 (15:51 -0500)]
c++: Call tsubst_pack_expansion from tsubst.
This was unnecessary (and incomplete) code duplication.
gcc/cp/ChangeLog:
* pt.c (tsubst): Replace *_ARGUMENT_PACK code with
a call to tsubst_argument_pack.
Jason Merrill [Sat, 7 Nov 2020 01:41:54 +0000 (20:41 -0500)]
c++: Improve error location for class using-decl.
We should use the location of the using-declaration, not the location of the
class.
gcc/cp/ChangeLog:
* class.c (handle_using_decl): Add an iloc_sentinel.
gcc/testsuite/ChangeLog:
* g++.dg/lookup/using26.C: Adjust location.
* g++.old-deja/g++.other/using1.C: Adjust location.
François Dumont [Tue, 21 Jan 2020 18:12:29 +0000 (19:12 +0100)]
libstdc++: Make _GLIBCXX_DEBUG checks constexpr compatible
libstdc++-v3/ChangeLog:
* include/debug/assertions.h (__glibcxx_requires_non_empty_range):
Remove __builtin_expect.
(__glibcxx_requires_subscript): Likewise.
(__glibcxx_requires_nonempty): Likewise.
* include/debug/formatter.h (__check_singular): Add C++11 constexpr
qualification.
* include/debug/helper_functions.h (__check_singular): Likewise. Skip
check if constant evaluated.
(__valid_range): Do not skip check if constant evaluated.
* include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_COND_AT): Add
__builtin_expect.
(_GLIBCXX_DEBUG_VERIFY_AT_F): Use __glibcxx_assert_1.
* testsuite/21_strings/basic_string_view/element_access/char/back_constexpr_neg.cc:
New test.
* testsuite/21_strings/basic_string_view/element_access/char/constexpr.cc: New test.
* testsuite/21_strings/basic_string_view/element_access/char/constexpr_neg.cc: New test.
* testsuite/21_strings/basic_string_view/element_access/char/front_back_constexpr.cc:
New test.
* testsuite/21_strings/basic_string_view/element_access/char/front_constexpr_neg.cc:
New test.
* testsuite/21_strings/basic_string_view/element_access/wchar_t/back_constexpr_neg.cc:
New test.
* testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr.cc: New test.
* testsuite/21_strings/basic_string_view/element_access/wchar_t/constexpr_neg.cc: New test.
* testsuite/21_strings/basic_string_view/element_access/wchar_t/front_constexpr_neg.cc:
New test.
* testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc: New test.
* testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc: New test.
* testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc: New test.
* testsuite/25_algorithms/lower_bound/debug/partitioned_neg.cc: New test.
* testsuite/25_algorithms/lower_bound/debug/partitioned_pred_neg.cc: New test.
* testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc: New test.
* testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc: New test.
* testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc: New test.
* testsuite/25_algorithms/upper_bound/debug/partitioned_neg.cc: New test.
* testsuite/25_algorithms/upper_bound/debug/partitioned_pred_neg.cc: New test.
Marek Polacek [Mon, 9 Nov 2020 15:19:07 +0000 (10:19 -0500)]
c++: Fix -Wvexing-parse ICE with omitted int [PR97762]
For declarations like
long f();
decl_specifiers->type will be NULL, but I neglected to handle this case,
therefore we ICE. So handle this case by pretending we've seen 'int',
which is good enough for -Wvexing-parse's purposes.
gcc/cp/ChangeLog:
PR c++/97762
* parser.c (warn_about_ambiguous_parse): Handle the case when
there is no type in the decl-specifiers.
gcc/testsuite/ChangeLog:
PR c++/97762
* g++.dg/warn/Wvexing-parse8.C: New test.
Patrick Palka [Mon, 9 Nov 2020 16:14:00 +0000 (11:14 -0500)]
c-family: Avoid unnecessary work when -Wpragmas is being ignored
This speeds up handle_pragma_diagnostic by avoiding computing a spelling
suggestion for an unrecognized option inside a #pragma directive when
-Wpragmas warnings are being suppressed.
In the range-v3 library, which contains many instances of
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wfoo"
...
#pragma GCC diagnostic pop
(where -Wfoo stands for a warning option we don't recognize), this
reduces compile time by 33% for some of its tests.
gcc/c-family/ChangeLog:
* c-pragma.c (handle_pragma_diagnostic): Split the
unknown-option -Wpragmas diagnostic into a warning and a
subsequent note containing a spelling suggestion. Avoid
computing the suggestion if -Wpragmas warnings are being
suppressed.
gcc/testsuite/ChangeLog:
* gcc.dg/pragma-diag-6.c: Adjust expected diagnostics
accordingly.
Patrick Palka [Mon, 9 Nov 2020 16:09:42 +0000 (11:09 -0500)]
c-family: Fix regression in location-overflow-test-1.c [PR97117]
The r11-3266 patch that added macro support to -Wmisleading-indentation
accidentally suppressed the column-tracking diagnostic in
get_visual_column in some cases, e.g. in the location-overflow-test-1.c
testcase.
More generally, when all three tokens are on the same line and we've run
out of locations with column info, then their location_t values will be
equal, and we exit early from should_warn_for_misleading_indentation due
to the new check
/* Give up if the loci are not all distinct. */
if (guard_loc == body_loc || body_loc == next_stmt_loc)
return false;
before we ever call get_visual_column.
[ This new check is needed to detect and give up on analyzing code
fragments where exactly two out of the three tokens come from the same
macro expansion, e.g.
#define MACRO \
if (a) \
foo ();
MACRO; bar ();
Here, guard_loc and body_loc will be equal and point to the macro
expansion point (and next_stmt_loc will point to 'bar'). The heuristics
that the warning uses are not really valid in scenarios like these. ]
In order to restore the column-tracking diagnostic, this patch moves the
the diagnostic code out from get_visual_column to earlier in
should_warn_for_misleading_indentation. Moreover, it tests the three
locations for a zero column all at once, which I suppose should make us
issue the diagnostic more consistently.
gcc/c-family/ChangeLog:
PR testsuite/97117
* c-indentation.c (get_visual_column): Remove location_t
parameter. Move the column-tracking diagnostic code from here
to ...
(should_warn_for_misleading_indentation): ... here, before the
early exit for when the loci are not all distinct. Don't pass a
location_t argument to get_visual_column.
(assert_get_visual_column_succeeds): Don't pass a location_t
argument to get_visual_column.
(assert_get_visual_column_fails): Likewise.
Claudiu Zissulescu [Mon, 9 Nov 2020 15:34:13 +0000 (17:34 +0200)]
arc: Improve/add instruction patterns to better use MAC instructions.
ARC MYP7+ instructions adds MAC instructions for either vector and
scalar data types. This patch adds a madd pattern for 16it datum using
the 32bit MAC instruction, and dot_prod patterns for v4hi vector
types. The 64bit moves are also upgraded by using vadd2 instuction.
2020-11-09 Claudiu Zissulescu <claziss@synopsys.com>
gcc/
* config/arc/arc.c (arc_split_move): Recognize vadd2 instructions.
* config/arc/arc.md (movdi_insn): Update pattern to use vadd2
instructions.
(movdf_insn): Likewise.
(maddhisi4): New pattern.
(umaddhisi4): Likewise.
* config/arc/simdext.md (mov<mode>_int): Update pattern to use
vadd2.
(sdot_prodv4hi): New pattern.
(udot_prodv4hi): Likewise.
(arc_vec_<V_US>mac_hi_v4hi): Update/renamed to
arc_vec_<V_US>mac_v2hiv2si.
(arc_vec_<V_US>mac_v2hiv2si_zero): New pattern.
* config/arc/constraints.md (Ral): Accumulator register
constraint.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Aldy Hernandez [Mon, 9 Nov 2020 13:18:12 +0000 (14:18 +0100)]
Clean up irange self tests.
Currently we have all the irange and range-op tests in range-op.cc.
This patch splits them up into the appropriate file (irange
tests in value-range.cc and range-op tests in range-op.cc). The patch
also splits up the tests themselves by functionality. It's not perfect,
but significantly better than the mess we had.
gcc/ChangeLog:
* function-tests.c (test_ranges): Call range_op_tests.
* range-op.cc (build_range3): Move to value-range.cc.
(range3_tests): Same.
(int_range_max_tests): Same.
(multi_precision_range_tests): Same.
(range_tests): Same.
(operator_tests): Split up...
(range_op_tests): Split up...
(range_op_cast_tests): ...here.
(range_op_lshift_tests): ...here.
(range_op_rshift_tests): ...here.
(range_op_bitwise_and_tests): ...here.
* selftest.h (range_op_tests): New.
* value-range.cc (build_range3): New.
(range_tests_irange3): New.
(range_tests_int_range_max): New.
(range_tests_legacy): New.
(range_tests_misc): New.
(range_tests): New.
Tobias Burnus [Mon, 9 Nov 2020 15:16:44 +0000 (16:16 +0100)]
Fortran: Fix OpenACC in specification-part checks [PR90111]
OpenACC's routine and declare directives can appear anywhere in the
specification part, i.e. before/after use-stmts, import-stmt, implicit-part,
or declaration-constructs.
gcc/fortran/ChangeLog:
PR fortran/90111
* parse.c (case_decl): Move ST_OACC_ROUTINE and ST_OACC_DECLARE to ...
(case_omp_decl): ... here.
(verify_st_order): Update comment.
gcc/testsuite/ChangeLog:
PR fortran/90111
* gfortran.dg/goacc/specification-part.f90: New test.
Jonathan Wakely [Mon, 9 Nov 2020 14:32:45 +0000 (14:32 +0000)]
libstdc++: Improve comment on _Power_of_2 helper function
libstdc++-v3/ChangeLog:
* include/bits/uniform_int_dist.h (__detail::_Power_of_2):
Document that true result for zero is intentional.
Jonathan Wakely [Mon, 9 Nov 2020 14:31:13 +0000 (14:31 +0000)]
libstdc++: Remove redundant check for zero in std::__popcount
The popcount built-ins work fine for zero, so there's no need to check
for it.
libstdc++-v3/ChangeLog:
* include/std/bit (__popcount): Remove redundant check for zero.
Richard Biener [Mon, 9 Nov 2020 13:32:41 +0000 (14:32 +0100)]
tree-optimization/97761 - fix SLP live calculation
This removes a premature end of the DFS walk.
2020-11-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/97761
* tree-vect-slp.c (vect_bb_slp_mark_live_stmts): Remove
premature end of DFS walk.
* gfortran.dg/vect/pr97761.f90: New testcase.
Aldy Hernandez [Mon, 9 Nov 2020 12:12:55 +0000 (13:12 +0100)]
Cleanup irange::set.
[This is actually part of a larger patch that actually changes
behavior, but I thought I'd commit the non-invasive cleanups first
which will simplify the upcoming work.]
irange::set was doing more work than it should for legacy ranges.
I cleaned up various unnecessary calls to swap_out_of_order_endpoints,
as well as some duplicate code that could be done with normalize_min_max.
I also removed an obsolete comment wrt sticky infinite overflows.
Not only did the -INF/+INF(OVF) code get removed in 2017,
but normalize_min_max() uses wide ints, which ignored overflows
altogether.
gcc/ChangeLog:
* value-range.cc (irange::swap_out_of_order_endpoints): Rewrite
into static function.
(irange::set): Cleanup redundant manipulations.
* value-range.h (irange::normalize_min_max): Modify object
in-place instead of modifying arguments.
Andrea Corallo [Fri, 6 Nov 2020 16:17:32 +0000 (16:17 +0000)]
aarch64: Do not alter force_reg returned register expanding fcmla
2020-11-06 Andrea Corallo <andrea.corallo@arm.com>
* config/aarch64/aarch64-builtins.c
(aarch64_expand_fcmla_builtin): Do not alter force_reg returned
register.
Jonathan Wakely [Mon, 9 Nov 2020 10:16:07 +0000 (10:16 +0000)]
libstdc++: Use 'inline' consistently in std::exception_ptr [PR 97729]
With PR c++/67453 fixed we can rely on the 'used' attribute to emit
inline constructors and destructors in libsupc++/eh_ptr.cc. This means
we don't need to suppress the 'inline' keyword on them in that file, and
don't need to force 'always_inline' on them in other files.
libstdc++-v3/ChangeLog:
PR libstdc++/97729
* libsupc++/exception_ptr.h (exception_ptr::exception_ptr())
(exception_ptr::exception_ptr(const exception_ptr&))
(exception_ptr::~exception_ptr()): Remove 'always_inline'
attributes. Use 'inline' unconditionally.
Jonathan Wakely [Mon, 9 Nov 2020 10:09:51 +0000 (10:09 +0000)]
libstdc++: Include <typeinfo> even for -fno-rtti [PR 97758]
The std::function code now uses std::type_info* even when RTTI is
disabled, so it should include <typeinfo> unconditionally. Without this,
Clang can't compile <functional> with -fno-rtti (it works with GCC
because std::type_info gets declared automatically by the compiler).
libstdc++-v3/ChangeLog:
PR libstdc++/97758
* include/bits/std_function.h [!__cpp_rtti]: Include <typeinfo>.
Jonathan Wakely [Wed, 14 Oct 2020 15:15:50 +0000 (16:15 +0100)]
config-ml.in: Suppress output from multi-do recipes
The FIXME comments saying "Leave out until this is tested a bit more"
are from 1997. I think they've been sufficiently tested.
ChangeLog:
* config-ml.in (multi-do, multi-clean): Add @ to silence recipes.
Remove FIXME comments.
Richard Biener [Mon, 9 Nov 2020 13:03:14 +0000 (14:03 +0100)]
tree-optimization/97753 - fix SLP induction vect
This fixes updating of the step vectors when filling up to group_size.
2020-11-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/97753
* tree-vect-loop.c (vectorizable_induction): Fill vec_steps
when CSEing inside the group.
* gcc.dg/vect/pr97753.c: New testcase.
Richard Biener [Mon, 9 Nov 2020 12:55:11 +0000 (13:55 +0100)]
tree-optimization/97746 - fix order of mask precision computes
This fixes the order of walking PHIs and stmts for BB mask
precision compute.
2020-11-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/97746
* tree-vect-patterns.c (vect_determine_precisions): First walk PHIs.
* gcc.dg/vect/bb-slp-pr97746.c: New testcase.
Nathan Sidwell [Mon, 9 Nov 2020 12:59:59 +0000 (04:59 -0800)]
c++: ADL refactor
This refactors the ADL lookup. It just so happens the refactoring
makes dropping modules in simpler :) We break apart the namespace and
class fn processing, and move scope iteration to an outer function.
It'll also become possible to find the same enum in multiple place, so
we need to handle that idempotently.
gcc/cp/
* cp-tree.h (LOOKUP_FOUND_P): Add ENUMERAL_TYPE.
* name-lookup.c (class name_lookup): Add comments.
(name_lookup::adl_namespace_only): Replace with ...
(name_lookup::adl_class_fns): ... this and ...
(name_lookup::adl_namespace_fns): ... this.
(name_lookup::adl_namespace): Deal with inline nests here.
(name_lookup::adl_class): Complete the type here.
(name_lookup::adl_type): Call broken-out enum ..
(name_lookup::adl_enum): New. No need to call the namespace adl
if it is class-scope.
(name_lookup::search_adl): Iterate over collected scopes here.
Nathan Sidwell [Fri, 6 Nov 2020 20:11:01 +0000 (12:11 -0800)]
c++: Consistently expose singleton overloads
This is a patch from my name-lookup overhaul. I noticed the parser
and one path in name-lookup looked through an overload of a single
known decl. It seems more consistent to do that in both paths through
name-lookup, and not in the parser itself.
gcc/cp/
* name-lookup.c (lookup_qualified_name): Expose an overload of a
singleton with known type.
(lookup_name_1): Just check the overload's type to expose it.
* parser.c (cp_parser_lookup_name): Do not do that check here.
Richard Biener [Mon, 9 Nov 2020 10:26:24 +0000 (11:26 +0100)]
CSE VN_INFO calls in PRE and VN
The following CSEs VN_INFO calls which nowadays are hashtable queries.
2020-11-09 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (get_representative_for): CSE VN_INFO calls.
(create_expression_by_pieces): Likewise.
(insert_into_preds_of_block): Likewsie.
(do_pre_regular_insertion): Likewsie.
* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_insert):
Likewise.
(eliminate_dom_walker::eliminate_stmt): Likewise.
Richard Biener [Mon, 9 Nov 2020 10:09:01 +0000 (11:09 +0100)]
Use a per-edge PRE PHI translation cache
This changes the phi translation cache to be per edge which
pushes it off the profiling radar. For larger testcases the
combined hashtable causes a load of cache misses and making it
per edge allows to shrink the entry further.
2020-11-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/97765
* tree-ssa-pre.c (bb_bitmap_sets::phi_translate_table): Add.
(PHI_TRANS_TABLE): New macro.
(phi_translate_table): Remove.
(expr_pred_trans_d::pred): Remove.
(expr_pred_trans_d::hash): Simplify.
(expr_pred_trans_d::equal): Likewise.
(phi_trans_add): Adjust.
(phi_translate): Likewise. Remove hash-table expansion
detection and optimization.
(phi_translate_set): Allocate PHI_TRANS_TABLE here.
(init_pre): Adjsust.
(fini_pre): Free PHI_TRANS_TABLE.
Andrea Corallo [Thu, 5 Nov 2020 08:57:03 +0000 (08:57 +0000)]
arm: [testcase] Better narrow some bfloat16 testcase
2020-11-05 Andrea Corallo <andrea.corallo@arm.com>
* gcc.target/arm/simd/vld1_lane_bf16_1.c: Require target to
support and add -mfloat-abi=hard flag.
* gcc.target/arm/simd/vld1_lane_bf16_indices_1.c: Likewise.
* gcc.target/arm/simd/vld1q_lane_bf16_indices_1.c: Likewise.
* gcc.target/arm/simd/vst1_lane_bf16_1.c: Likewise.
* gcc.target/arm/simd/vst1_lane_bf16_indices_1.c: Likewise.
* gcc.target/arm/simd/vstq1_lane_bf16_indices_1.c: Likewise.
Cui,Lili [Wed, 4 Nov 2020 06:20:31 +0000 (14:20 +0800)]
Enable MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG for march=tremont
1. Enable MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG for march=tremont
2. Move PREFETCHW from march=broadwell to march=silvermont.
3. Add PREFETCHWT1 to march=knl
gcc/ChangeLog:
2020-11-09 Lili Cui <lili.cui@intel.com>
PR target/97685
* config/i386/i386.h:
(PTA_BROADWELL): Delete PTA_PRFCHW.
(PTA_SILVERMONT): Add PTA_PRFCHW.
(PTA_KNL): Add PTA_PREFETCHWT1.
(PTA_TREMONT): Add PTA_MOVDIRI, PTA_MOVDIR64B, PTA_CLDEMOTE and PTA_WAITPKG.
* doc/invoke.texi: Delete PREFETCHW for broadwell, skylake, knl, knm,
skylake-avx512, cannonlake, icelake-client, icelake-server, cascadelake,
cooperlake, tigerlake and sapphirerapids.
Add PREFETCHW for silvermont, goldmont, goldmont-plus and tremont.
Add XSAVEC and XSAVES for goldmont, goldmont-plus and tremont.
Add MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG for tremont.
Add KEYLOCKER and HREST for alderlake.
Add AMX-BF16, AMX-TILE, AMX-INT8 and UINTR for sapphirerapids.
Add KEYLOCKER for tigerlake.
Christophe Lyon [Mon, 9 Nov 2020 07:10:48 +0000 (07:10 +0000)]
libiberty/pex-win32.c: Initialize orig_err
Initializing orig_err avoids a warning: "may be used uninitialized".
See 97108.
2020-09-14 Torbjörn SVENSSON <torbjorn.svensson@st.com>
Christophe Lyon <christophe.lyon@linaro.org>
libiberty/
* pex-win32.c (pex_win32_exec_child): Initialize orig_err.
Kewen Lin [Mon, 9 Nov 2020 02:35:21 +0000 (20:35 -0600)]
ira: Recompute regstat as max_regno changes [PR97705]
As PR97705 shows, the commit r11-4637 caused some dumping
comparison difference error on pass ira. It exposed one
issue about the newly introduced function remove_scratches,
which can increase the largest pseudo reg number if it
succeeds, later some function will use the max_reg_num()
to get the latest max_regno, when iterating the numbers
we can access some data structures which are allocated as
the previous max_regno, some out of array bound accesses
can occur, the failure can be random since the values
beyond the array could be random.
This patch is to free/reinit/recompute the relevant data
structures that is regstat_n_sets_and_refs and reg_info_p
to ensure we won't access beyond some array bounds.
Bootstrapped/regtested on powerpc64le-linux-gnu P9 and
powerpc64-linux-gnu P8.
gcc/ChangeLog:
PR rtl-optimization/97705
* ira.c (ira): Refactor some regstat free/init/compute invocation
into lambda function regstat_recompute_for_max_regno, and call it
when max_regno increases as remove_scratches succeeds.
GCC Administrator [Mon, 9 Nov 2020 00:16:25 +0000 (00:16 +0000)]
Daily bump.
Iain Sandoe [Wed, 4 Nov 2020 23:52:12 +0000 (23:52 +0000)]
Objective-C/C++ : Handle parsing @property 'class' attribute.
This attribute states that a property is one manipulated by class
methods (it requires a static variable and the setter and getter
must be provided explicitly, they cannot be @synthesized).
gcc/c-family/ChangeLog:
* c-common.h (OBJC_IS_PATTR_KEYWORD): Add class to the list
of keywords accepted in @property attribute contexts.
* c-objc.h (enum objc_property_attribute_group): Add
OBJC_PROPATTR_GROUP_CLASS.
(enum objc_property_attribute_kind): Add
OBJC_PROPERTY_ATTR_CLASS.
gcc/cp/ChangeLog:
* parser.c (cp_parser_objc_at_property_declaration): Handle
class keywords in @property attribute context.
gcc/objc/ChangeLog:
* objc-act.c (objc_prop_attr_kind_for_rid): Handle class
attribute.
(objc_add_property_declaration): Likewise.
* objc-act.h (PROPERTY_CLASS): Record class attribute state.
gcc/testsuite/ChangeLog:
* obj-c++.dg/property/at-property-4.mm: Test handling class
attributes.
* objc.dg/property/at-property-4.m: Likewise.
Iain Sandoe [Sun, 8 Nov 2020 09:34:36 +0000 (09:34 +0000)]
testsuite, Darwin, PPC : Skip zero scratch regs tests.
XFAIL-ing these is not sufficient, unfortunately, we need to
skip them completely.
gcc/testsuite/ChangeLog:
* c-c++-common/zero-scratch-regs-10.c: Skip for powerpc
Darwin.
* c-c++-common/zero-scratch-regs-11.c: Likewise.
* c-c++-common/zero-scratch-regs-8.c: Likewise.
* c-c++-common/zero-scratch-regs-9.c: Likewise.
Iain Sandoe [Sun, 8 Nov 2020 09:09:32 +0000 (09:09 +0000)]
testsuite, Darwin, X86 : Add target requires native tls to test.
The builtin_thread_pointer test does not work for emulated TLS.
Add a target requires to cover this.
gcc/testsuite/ChangeLog:
* gcc.target/i386/builtin_thread_pointer.c: Require native TLS.
David Edelsohn [Sun, 8 Nov 2020 01:38:38 +0000 (20:38 -0500)]
rs6000: Fix bootstrap after r11-4793.
The patch omitted a change for rs6000.c, fixed thus.
gcc/ChangeLog:
* config/rs6000/rs6000.c (rs6000_mangle_decl_assembler_name): Change
DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTIN.
GCC Administrator [Sun, 8 Nov 2020 00:16:31 +0000 (00:16 +0000)]
Daily bump.
Marek Polacek [Sat, 7 Nov 2020 18:28:21 +0000 (13:28 -0500)]
testsuite: Fix Wimplicit-fallthrough-20.c.
The r11-4813 patch removed "ignored" from the dg-warnings in this test,
causing this test to fail when compiled as C++.
gcc/testsuite/ChangeLog:
* c-c++-common/Wimplicit-fallthrough-20.c: Adjust dg-warning.
Lewis Hyatt [Sat, 7 Nov 2020 14:36:42 +0000 (09:36 -0500)]
libcpp: Update cpp_wcwidth() to Unicode 13.0.0
generated_cpp_wcwidth.h was regenerated using Unicode 13.0.0 data files. No
material changes to the parsing scripts (either GCC- or glibc-sourced) were
necessary; glibc's utf8_gen.py was tweaked slightly by glibc and matched here.
contrib/ChangeLog:
* unicode/EastAsianWidth.txt: Update to Unicode 13.0.0.
* unicode/PropList.txt: Likewise.
* unicode/README: Likewise.
* unicode/UnicodeData.txt: Likewise.
* unicode/from_glibc/unicode_utils.py: Update to latest glibc version.
* unicode/from_glibc/utf8_gen.py: Likewise.
libcpp/ChangeLog:
* generated_cpp_wcwidth.h: Regenerated from Unicode 13.0.0 data.
Iain Sandoe [Mon, 2 Nov 2020 21:12:38 +0000 (21:12 +0000)]
Objective-C/C++ (C-family) : Add missing 'atomic' property attribute.
This is the default, but it is still legal in user code and therefore
we should handle it in parsing. Fix whitespace issues in the lines
affected.
gcc/c-family/ChangeLog:
* c-common.c (c_common_reswords): Add 'atomic' property
attribute.
* c-common.h (enum rid): Add RID_PROPATOMIC for atomic
property attributes.
gcc/objc/ChangeLog:
* objc-act.c (objc_prop_attr_kind_for_rid): Handle
RID_PROPATOMIC.
gcc/testsuite/ChangeLog:
* obj-c++.dg/property/at-property-4.mm: Test atomic property
attribute.
* objc.dg/property/at-property-4.m: Likewise.
Iain Sandoe [Sat, 24 Oct 2020 14:51:46 +0000 (15:51 +0100)]
Objective-C : Implement NSObject attribute.
This attribute allows pointers to be marked as pointers to
an NSObject-compatible object. This allows for additional
checking of assignment etc. when refering to pointers to
opaque types.
gcc/c-family/ChangeLog:
* c-attribs.c (handle_nsobject_attribute): New.
* c.opt: Add WNSObject-attribute.
gcc/objc/ChangeLog:
* objc-act.c (objc_compare_types): Handle NSObject type
attributes.
(objc_type_valid_for_messaging): Likewise.
gcc/testsuite/ChangeLog:
* obj-c++.dg/attributes/nsobject-01.mm: New test.
* objc.dg/attributes/nsobject-01.m: New test.
Eric Botcazou [Sat, 7 Nov 2020 10:07:11 +0000 (11:07 +0100)]
Fix Ada build failure for the SuSE PowerPC64/Linux compiler
gcc/ada/ChangeLog:
* gcc-interface/Makefile.in: Force target_cpu to powerpc if the
nominal target is powerpc64-suse-linux.
Iain Sandoe [Sat, 7 Nov 2020 09:20:54 +0000 (09:20 +0000)]
testsuite, Darwin, PPC : XFAIL zero-scratch-regs tests.
These tests fail because of an unimplemented 'sorry'; there
is no plan to implement this in the short term, so XFAILing
the tests to reduce noise.
gcc/testsuite/ChangeLog:
* c-c++-common/zero-scratch-regs-10.c: XFAIL for
powerpc-darwin.
* c-c++-common/zero-scratch-regs-11.c: Likewise.
* c-c++-common/zero-scratch-regs-8.c: Likewise.
* c-c++-common/zero-scratch-regs-9.c: Likewise.
Iain Sandoe [Sat, 7 Nov 2020 08:43:37 +0000 (08:43 +0000)]
Ada : Fix bootstrap after r11-4793.
The patch omitted a change for Ada, fixed thus.
gcc/ada/ChangeLog:
* gcc-interface/misc.c (gnat_printable_name): Change
DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTIN.
Martin Uecker [Fri, 6 Nov 2020 23:48:33 +0000 (00:48 +0100)]
C Parser: Implement mixing of labels and code.
Implement mixing of labels and code as adopted for C2X
and process some std-attributes on labels.
2020-11-06 Martin Uecker <muecker@gwdg.de>
gcc/
* doc/extend.texi: Document mixing labels and code.
* doc/invoke.texi: Likewise.
gcc/c/
* c-parser.c (c_parser_label): Implement mixing of labels and code.
(c_parser_all_labels): Likewise.
gcc/testsuite/
* c-c++-common/attr-fallthrough-2.c: Update compiler flags.
* c-c++-common/Wimplicit-fallthrough-20.c: Adapt test.
* gcc.dg/
20031223-1.c: Update compiler flags and adapt test.
* gcc.dg/c11-labels-1.c: New test.
* gcc.dg/c11-labels-2.c: New test.
* gcc.dg/c11-labels-3.c: New test.
* gcc.dg/c2x-attr-syntax-3.c: Adapt test.
* gcc.dg/c2x-labels-1.c: New test.
* gcc.dg/c2x-labels-2.c: New test.
* gcc.dg/c2x-labels-3.c: New test.
* gcc.dg/decl-9.c: Update compiler flags and add error.
* gcc.dg/gomp/barrier-2.c: Update compiler flags and add warning.
* gcc.dg/gomp/declare-simd-5.c: Update compiler flags and adapt test.
* gcc.dg/gomp/declare-variant-2.c: Update compiler flags and add error.
* gcc.dg/label-compound-stmt-1.c: Update compiler flags.
* gcc.dg/parse-decl-after-label.c: Update compiler flags.
Liu Hao [Thu, 8 Oct 2020 02:26:13 +0000 (10:26 +0800)]
libsupc++: Make the destructor parameter to `__cxa_thread_atexit()` use the `__thiscall` calling convention for i686-w64-mingw32
The mingw-w64 implementations of `__cxa_thread_atexit()` and `__cxa_atexit()` have been
using `__thiscall` since two years ago. Using the default calling convention (which is
`__cdecl`) causes crashes as explained in PR83562.
Calling conventions have no effect on x86_64-w64-mingw32.
Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562
Reference: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/crt/cxa_thread_atexit.c
Reference: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/
f3e0fbb40cbc9f8821db8bd8a0c4dae8ff671e9f/
Reference: https://github.com/msys2/MINGW-packages/issues/7071
Signed-off-by: Liu Hao <lh_mouse@126.com>
2020-10-08 Liu Hao <lh_mouse@126.com>
libstdc++-v3:
* libsupc++/cxxabi.h: (__cxa_atexit): mark with _GLIBCXX_CDTOR_CALLABI
(__cxa_thread_atexit): ditto
* libsupc++/atexit_thread.cc: (__cxa_atexit): mark with
_GLIBCXX_CDTOR_CALLABI
(__cxa_thread_atexit): ditto
(elt): ditto
GCC Administrator [Sat, 7 Nov 2020 00:16:39 +0000 (00:16 +0000)]
Daily bump.
Segher Boessenkool [Fri, 2 Oct 2020 00:06:56 +0000 (00:06 +0000)]
rs6000: Don't use operands[] for temporaries in define_expand
In
ac001f5ce604 Alan fixed my thinko using operands that do not refer
to anything mentioned in the RTL pattern. Instead, it just uses fresh
new local rtxes for those.
This patch takes that a tiny bit further: it uses local rtx for all
temporaries used in the expanders. As a bonus that simplifies the code
a tiny bit as well.
2020-11-06 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.md (@tablejump<mode>_normal): Don't abuse
operands[].
(@tablejump<mode>_nospec): Ditto.
Martin Uecker [Fri, 6 Nov 2020 23:28:01 +0000 (00:28 +0100)]
MAINTAINERS: Update my email address.
2020-11-07 Martin Uecker <muecker@gwdg.de>
* MAINTAINERS: Update my email address.
Peter Bergner [Fri, 6 Nov 2020 22:49:37 +0000 (16:49 -0600)]
rs6000: Use the correct minimized testcase
Use the correct minimized test case source rather than the large test
source.
gcc/testsuite/
* gcc.target/powerpc/pr64505.c: Run everywhere. Use correct minimized
test case.
Peter Bergner [Fri, 6 Nov 2020 23:00:49 +0000 (17:00 -0600)]
rs6000: Fix default alignment ABI break caused by MMA base support
As part of the MMA base support, we incremented BIGGEST_ALIGNMENT in
order to align the __vector_pair and __vector_quad types to 256 and 512
bytes respectively. This had the unintended effect of changing the
default alignment used by __attribute__ ((__aligned__)) which causes
an ABI break because of some dodgy code in GLIBC's struct pthread.
The fix is to revert the BIGGEST_ALIGNMENT change and to force the
alignment on the type itself rather than the mode used by the type.
2020-11-06 Peter Bergner <bergner@linux.ibm.com>
gcc/
* config/rs6000/rs6000.h (BIGGEST_ALIGNMENT): Revert previous commit
so as not to break the ABI.
* config/rs6000/rs6000-call.c (rs6000_init_builtins): Set the ABI
mandated alignment for __vector_pair and __vector_quad types.
gcc/testsuite/
* gcc.target/powerpc/mma-alignment.c: New test.
Jeff Law [Fri, 6 Nov 2020 22:38:00 +0000 (17:38 -0500)]
Fix stack pointer handling in ms_hook_prologue functions for i386 target.
gcc/
PR target/91489
* config/i386/i386.md (simple_return): Also check
for ms_hook_prologue function attribute.
* config/i386/i386.c (ix86_can_use_return_insn_p):
Also check for ms_hook_prologue function attribute.
* config/i386/i386-protos.h (ix86_function_ms_hook_prologue): Declare.
gcc/testsuite
PR target/91489
* gcc.target/i386/ms_hook_prologue.c: Expand testcase
to reproduce PR target/91489 issue.
Segher Boessenkool [Fri, 6 Nov 2020 12:50:35 +0000 (12:50 +0000)]
rs6000: Fix TARGET_POWERPC64 vs. TARGET_64BIT confusion
I gave Ke Wen bad advice, luckily David corrected me: it is true that we
cannot use TARGET_POWERPC64 on many 32-bit OSes, since either the kernel
or userland does not save the top half of the 64-bit integer registers,
but we do not have to care about that in separate patterns or related
code. The flag is automatically not enabled by default on targets that
do not handle this correctly.
This patch fixes it.
Segher
2020-11-06 Segher Boessenkool <segher@kernel.crashing.org>
PR target/96933
* config/rs6000/rs6000.c (rs6000_expand_vector_init): Use
TARGET_POWERPC64 instead of TARGET_64BIT.
Joseph Myers [Fri, 6 Nov 2020 21:55:19 +0000 (21:55 +0000)]
builtins: Add DFP signaling NaN built-in functions
Add built-in functions __builtin_nansd32, __builtin_nansd64 and
__builtin_nansd128 to return signaling NaNs of decimal floating-point
types, analogous to the functions already present for binary
floating-point types.
This patch, independent of
<https://gcc.gnu.org/pipermail/gcc-patches/2020-October/557136.html>
(pending review), is in preparation for adding the <float.h> macros
for such signaling NaNs that are in C2x, analogous to the macros for
other types that are in that patch.
Bootstrapped with no regressions for x86_64-pc-linux-gnu. Also ran
the new tests for powerpc64le-linux-gnu to confirm they do work in the
case (hardware DFP) where floating-point exceptions are supported for
DFP.
gcc/
2020-11-06 Joseph Myers <joseph@codesourcery.com>
* builtins.def (BUILT_IN_NANSD32, BUILT_IN_NANSD64)
(BUILT_IN_NANSD128): New built-in functions.
* fold-const-call.c (fold_const_call): Handle the new built-in
functions.
* doc/extend.texi (__builtin_nansd32, __builtin_nansd64)
(__builtin_nansd128): Document.
* doc/sourcebuild.texi (Effective-Target Keywords): Document
fenv_exceptions_dfp.
gcc/testsuite/
2020-11-06 Joseph Myers <joseph@codesourcery.com>
* lib/target-supports.exp
(check_effective_target_fenv_exceptions_dfp): New.
* gcc.dg/dfp/builtin-snan-1.c, gcc.dg/dfp/builtin-snan-2.c: New
tests.
Marek Polacek [Fri, 6 Nov 2020 02:46:06 +0000 (21:46 -0500)]
c++: Small tweak to can_convert_eh [PR81660]
While messing with check_handlers_1, I spotted this bug report which
complains that we don't warn about the case when we have two duplicated
handlers of type int. can_convert_eh implements [except.handle] and
that says: A handler is a match for an exception object of type E if
- The handler is of type cv T or cv T& and E and T are the same type
(ignoring the top-level cv-qualifiers), or [...]
but we don't implement this bullet properly for non-class types. The
fix therefore seems pretty obvious. Also change the return type to
bool when we're only returning yes/no.
gcc/cp/ChangeLog:
PR c++/81660
* except.c (can_convert_eh): Change the return type to bool. If
the type TO and FROM are the same, return true.
gcc/testsuite/ChangeLog:
PR c++/81660
* g++.dg/warn/Wexceptions3.C: New test.
* g++.dg/eh/pr42859.C: Add dg-warning.
* g++.dg/torture/pr81659.C: Likewise.
Bin Cheng [Fri, 6 Nov 2020 21:19:40 +0000 (16:19 -0500)]
Improve uninitialized warning with value range info
Function use_pred_not_overlap_with_undef_path_pred of
pass_late_warn_uninitialized
checks if predicate of variable use overlaps with predicate of undefined
control flow path.
For now, it only checks ssa_var comparing against constant, this can be
improved where
ssa_var compares against another ssa_var with value range info, as described in
comment:
+ /* Check value range info of rhs, do following transforms:
+ flag_var < [min, max] -> flag_var < max
+ flag_var > [min, max] -> flag_var > min
+
+ We can also transform LE_EXPR/GE_EXPR to LT_EXPR/GT_EXPR:
+ flag_var <= [min, max] -> flag_var < [min, max+1]
+ flag_var >= [min, max] -> flag_var > [min-1, max]
+ if no overflow/wrap. */
gcc/
* tree-ssa-uninit.c (find_var_cmp_const): New function.
(use_pred_not_overlap_with_undef_path_pred): Call above.
Jonathan Wakely [Fri, 6 Nov 2020 19:53:36 +0000 (19:53 +0000)]
libstdc++: Fix symbol version conflict in linker script
The change in r11-4748-
50b840ac5e1d6534e345c3fee9a97ae45ced6bc7 causes
a build error on Solaris, due to the new explicit instantiation matching
patterns for two different symbol versions.
libstdc++-v3/ChangeLog:
* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Tighten up patterns
for basic_stringbuf that refer to __xfer_bufptrs.
Iain Sandoe [Sun, 25 Oct 2020 17:34:29 +0000 (17:34 +0000)]
Objective-C/C++ : Allow visibility prefix attributes on interfaces.
This passes visibiliy through without warning (so that, for example,
__attribute__((__visibility("default"))) does not result in any
diagnostic).
gcc/objc/ChangeLog:
* objc-act.c (start_class): Accept visibility attributes
without warning.
Iain Sandoe [Sat, 31 Oct 2020 20:53:34 +0000 (20:53 +0000)]
Objective-C/C++ (parsers) : Update @property attribute parsing.
At present, we are missing parsing and checking for around
half of the property attributes in use. The existing ad hoc scheme
for the parser's communication with the Objective C validation
is not suitable for extending to cover all the missing cases.
Additionally:
1/ We were declaring errors in two cases that the reference
implementation warns (or is silent).
I've elected to warn for both those cases, (Wattributes) it
could be that we should implement Wobjc-xxx-property warning
masks (TODO).
2/ We were emitting spurious complaints about missing property
attributes when these were not being parsed because we gave
up on the first syntax error.
3/ The quality of the diagnostic locations was poor (that's
true for much of Objective-C, we will have to improve it as
we modernise areas).
We continue to attempt to keep the code, warning and error output
similar (preferably identical output) between the C and C++ front
ends.
The interface to the Objective-C-specific parts of the parsing is
simplified to a vector of parsed (but not fully-checked) property
attributes, this will simplify the addition of new attributes.
gcc/c-family/ChangeLog:
* c-objc.h (enum objc_property_attribute_group): New
(enum objc_property_attribute_kind): New.
(OBJC_PROPATTR_GROUP_MASK): New.
(struct property_attribute_info): Small class encapsulating
parser output from property attributes.
(objc_prop_attr_kind_for_rid): New
(objc_add_property_declaration): Simplify interface.
* stub-objc.c (enum rid): Dummy type.
(objc_add_property_declaration): Simplify interface.
(objc_prop_attr_kind_for_rid): New.
gcc/c/ChangeLog:
* c-parser.c (c_parser_objc_at_property_declaration):
Improve parsing fidelity. Associate better location info
with @property attributes. Clean up the interface to
objc_add_property_declaration ().
gcc/cp/ChangeLog:
* parser.c (cp_parser_objc_at_property_declaration):
Improve parsing fidelity. Associate better location info
with @property attributes. Clean up the interface to
objc_add_property_declaration ().
gcc/objc/ChangeLog:
* objc-act.c (objc_prop_attr_kind_for_rid): New.
(objc_add_property_declaration): Adjust to consume the
parser output using a vector of parsed attributes.
gcc/testsuite/ChangeLog:
* obj-c++.dg/property/at-property-1.mm: Adjust expected
diagnostics.
* obj-c++.dg/property/at-property-29.mm: Likewise.
* obj-c++.dg/property/at-property-4.mm: Likewise.
* obj-c++.dg/property/property-neg-2.mm: Likewise.
* objc.dg/property/at-property-1.m: Likewise.
* objc.dg/property/at-property-29.m: Likewise.
* objc.dg/property/at-property-4.m: Likewise.
* objc.dg/property/at-property-5.m: Likewise.
* objc.dg/property/property-neg-2.m: Likewise.
Jakub Jelinek [Fri, 6 Nov 2020 19:33:39 +0000 (20:33 +0100)]
c++: Propagate attributes to clones in duplicate_decls [PR67453]
On the following testcase where the cdtor attributes aren't on the
in-class declaration but on an out-of-class definition, the cdtors
have their clones created from the in-class declaration, and later on
duplicate_decls updates attributes on the abstract cdtors, but nothing
propagates them to the clones.
2020-11-06 Jakub Jelinek <jakub@redhat.com>
PR c++/67453
* decl.c (duplicate_decls): Propagate DECL_ATTRIBUTES and
DECL_PRESERVE_P from olddecl to its clones if any.
* g++.dg/ext/attr-used-2.C: New test.
Iain Sandoe [Fri, 31 Jul 2020 20:05:28 +0000 (21:05 +0100)]
Darwin: Darwin 20 is to be macOS 11 (Big Sur).
As per Nigel Tufnel's assertion "... this one goes to 11".
The various parts of the code that deal with mapping Darwin versions
to macOS (X) versions need updating to deal with a major version of
11.
So now we have, for example:
Darwin 4 => macOS (X) 10.0
…
Darwin 14 => macOS (X) 10.10
...
Darwin 19 => macOS (X) 10.15
Darwin 20 => macOS 11.0
Because of the historical duplication of the "10" in macOSX 10.xx and
the number of tools that expect this, it is likely that system tools will
allow macos11.0 and/or macosx11.0 (despite that the latter makes little
sense).
Update the link test to cover Catalina (Darwin19/10.15) and
Big Sur (Darwin20/11.0).
gcc/ChangeLog:
* config/darwin-c.c: Allow for Darwin20 to correspond to macOS 11.
* config/darwin-driver.c: Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/darwin-minversion-link.c: Allow for Darwin19 (macOS 10.15)
and Darwin20 (macOS 11.0).
Richard Biener [Fri, 6 Nov 2020 15:57:05 +0000 (16:57 +0100)]
rework PRE PHI translation cache
Turns out its size and time requirements can be stripped down
dramatically.
2020-11-06 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (expr_pred_trans_d): Modify so elements
are embedded rather than allocated. Remove hashval member,
make all members integers.
(phi_trans_add): Adjust accordingly.
(phi_translate): Likewise. Deal with re-allocation
of the table.
Andrew MacLeod [Fri, 6 Nov 2020 19:14:46 +0000 (14:14 -0500)]
Combine new calculated ranges with existing range.
When a range is recalculated, retain what was previously known as IL changes
can produce different results from un-executed code. This also paves
the way for external injection of ranges.
gcc/
PR tree-optimization/97737
PR tree-optimization/97741
* gimple-range.cc: (gimple_ranger::range_of_stmt): Intersect newly
calculated ranges with the existing known global range.
gcc/testsuite/
* gcc.dg/pr97737.c: New.
* gcc.dg/pr97741.c: New.
Darius Galis [Fri, 6 Nov 2020 18:54:20 +0000 (11:54 -0700)]
Add PC as control register
gcc/
* config/rx/rx.md (CTRLREG_PC): Add.
* config/rx/rx.c (CTRLREG_PC): Add
(rx_expand_builtin_mvtc): Add warning: PC register cannot
be used as dest.
Nathan Sidwell [Fri, 6 Nov 2020 17:59:21 +0000 (09:59 -0800)]
core: Rename DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTIN
In cleaning up C++'s handling of hidden decls, I renamed its
DECL_BUILTIN_P, which checks for loc == BUILTINS_LOCATION to
DECL_UNDECLARED_BUILTIN_P, because the location gets updated, if user
source declares the builtin, and the predicate no longer holds. The
original name was confusing me. (The builtin may still retain builtin
properties in the redeclaration, and other predicates can still detect
that.)
I discovered that tree.h had its own variant 'DECL_IS_BUILTIN', which
behaves in (almost) the same manner. And therefore has the same
mutating behaviour.
This patch deletes the C++ one, and renames tree.h's to
DECL_IS_UNDECLARED_BUILTIN, to emphasize its non-constantness. I
guess _IS_ wins over _P
gcc/
* tree.h (DECL_IS_BUILTIN): Rename to ...
(DECL_IS_UNDECLARED_BUILTIN): ... here. No need to use SOURCE_LOCUS.
* calls.c (maybe_warn_alloc_args_overflow): Adjust for rename.
* cfgexpand.c (pass_expand::execute): Likewise.
* dwarf2out.c (base_type_die, is_naming_typedef_decl): Likewise.
* godump.c (go_decl, go_type_decl): Likewise.
* print-tree.c (print_decl_identifier): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Likewise.
* xcoffout.c (xcoff_assign_fundamental_type_number): Likewise.
gcc/c-family/
* c-ada-spec.c (collect_ada_nodes): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
(collect_ada_node): Likewise.
(dump_forward_type): Likewise.
* c-common.c (set_underlying_type): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
(user_facing_original_type, c_common_finalize_early_debug): Likewise.
gcc/c/
* c-decl.c (diagnose_mismatched_decls): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
(warn_if_shadowing, implicitly_declare, names_builtin_p)
(collect_source_refs): Likewise.
* c-typeck.c (inform_declaration, inform_for_arg)
(convert_for_assignment): Likewise.
gcc/cp/
* cp-tree.h (DECL_UNDECLARED_BUILTIN_P): Delete.
* cp-objcp-common.c (names_bultin_p): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
* decl.c (decls_match): Likewise. Replace
DECL_UNDECLARED_BUILTIN_P with DECL_IS_UNDECLARED_BUILTIN.
(duplicate_decls): Likewise.
* decl2.c (collect_source_refs): Likewise.
* name-lookup.c (anticipated_builtin_p, print_binding_level)
(do_nonmember_using_decl): Likewise.
* pt.c (builtin_pack_fn_p): Likewise.
* typeck.c (error_args_num): Likewise.
gcc/lto/
* lto-symtab.c (lto_symtab_merge_decls_1): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
gcc/go/
* go-gcc.cc (Gcc_backend::call_expression): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
libcc1/
* libcc1plugin.cc (address_rewriter): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
* libcp1plugin.cc (supplement_binding): Likewise.
David Candler [Fri, 6 Nov 2020 17:53:03 +0000 (17:53 +0000)]
aarch64: Use intrinsics for upper saturating shift right
The use of vqshrn_high_n_s32 was triggering an unneeded register move, because
sqshrn2 is destructive but was declared as inline assembly in arm_neon.h. This
patch implements sqshrn2 and uqshrn2 as actual intrinsics which do not trigger
the unnecessary move, along with new tests to cover them.
gcc/ChangeLog
2020-11-06 David Candler <david.candler@arm.com>
* config/aarch64/aarch64-builtins.c
(TYPES_SHIFT2IMM): Add define.
(TYPES_SHIFT2IMM_UUSS): Add define.
(TYPES_USHIFT2IMM): Add define.
* config/aarch64/aarch64-simd.md
(aarch64_<sur>q<r>shr<u>n2_n<mode>): Add new insn for upper saturating shift right.
* config/aarch64/aarch64-simd-builtins.def: Add intrinsics.
* config/aarch64/arm_neon.h:
(vqrshrn_high_n_s16): Expand using intrinsic rather than inline asm.
(vqrshrn_high_n_s32): Likewise.
(vqrshrn_high_n_s64): Likewise.
(vqrshrn_high_n_u16): Likewise.
(vqrshrn_high_n_u32): Likewise.
(vqrshrn_high_n_u64): Likewise.
(vqrshrun_high_n_s16): Likewise.
(vqrshrun_high_n_s32): Likewise.
(vqrshrun_high_n_s64): Likewise.
(vqshrn_high_n_s16): Likewise.
(vqshrn_high_n_s32): Likewise.
(vqshrn_high_n_s64): Likewise.
(vqshrn_high_n_u16): Likewise.
(vqshrn_high_n_u32): Likewise.
(vqshrn_high_n_u64): Likewise.
(vqshrun_high_n_s16): Likewise.
(vqshrun_high_n_s32): Likewise.
(vqshrun_high_n_s64): Likewise.
gcc/testsuite/ChangeLog
2020-11-06 David Candler <david.candler@arm.com>
* gcc.target/aarch64/advsimd-intrinsics/vqrshrn_high_n.c: New testcase.
* gcc.target/aarch64/advsimd-intrinsics/vqrshrun_high_n.c: Likewise.
* gcc.target/aarch64/advsimd-intrinsics/vqshrn_high_n.c: Likewise.
* gcc.target/aarch64/advsimd-intrinsics/vqshrun_high_n.c: Likewise.
* gcc.target/aarch64/narrow_high-intrinsics.c: Update expected assembler
for sqshrun2, sqrshrun2, sqshrn2, uqshrn2, sqrshrn2 and uqrshrn2.
Nathan Sidwell [Fri, 6 Nov 2020 16:53:31 +0000 (08:53 -0800)]
libcpp: Provide date routine
Joseph pointed me at cb_get_source_date_epoch, which allows repeatable
builds and solves a FIXME I had on the modules branch. Unfortunately
it's used exclusively to generate __DATE__ and __TIME__ values, which
fallback to using a time(2) call. It'd be nicer if the preprocessor
made whatever time value it determined available to the rest of the
compiler. So this patch adds a new cpp_get_date function, which
abstracts the call to the get_source_date_epoch hook, or uses time
directly. The value is cached. Thus the timestamp I end up putting
on CMI files matches __DATE__ and __TIME__ expansions. That seems
worthwhile.
libcpp/
* include/cpplib.h (enum class CPP_time_kind): New.
(cpp_get_date): Declare.
* internal.h (struct cpp_reader): Replace source_date_epoch with
time_stamp and time_stamp_kind.
* init.c (cpp_create_reader): Initialize them.
* macro.c (_cpp_builtin_macro_text): Use cpp_get_date.
(cpp_get_date): Broken out from _cpp_builtin_macro_text and
genericized.
Richard Sandiford [Fri, 6 Nov 2020 16:49:28 +0000 (16:49 +0000)]
aarch64: Support permutes on unpacked SVE vectors
This patch adds support for permuting unpacked SVE vectors using:
- DUP
- EXT
- REV[BHW]
- REV
- TRN[12]
- UZP[12]
- ZIP[12]
This involves rewriting the REV[BHW] permute code so that the inputs
and outputs of the insn pattern have the same mode as the vectors
being permuted. This is different from the ACLE form, where the
reversal happens within individual elements rather than within
groups of multiple elements.
The patch does not add a conditional version of REV[BHW]. I'll come
back to that once we have partial-vector comparisons and selects.
The patch is really just enablement, adding an extra tool to the
toolbox. It doesn't bring any significant vectorisation opportunities
on its own. However, the patch does have one artificial example that
is now vectorised in a better way than before.
gcc/
* config/aarch64/aarch64-modes.def (VNx2BF, VNx4BF): Adjust nunits
and alignment based on the current VG.
* config/aarch64/iterators.md (SVE_ALL, SVE_24, SVE_2, SVE_4): Add
partial SVE BF modes.
(UNSPEC_REVBHW): New unspec.
(Vetype, Vesize, Vctype, VEL, Vel, vwcore, V_INT_CONTAINER)
(v_int_container, VPRED, vpred): Handle partial SVE BF modes.
(container_bits, Vcwtype): New mode attributes.
* config/aarch64/aarch64-sve.md
(@aarch64_sve_revbhw_<SVE_ALL:mode><PRED_HSD:mode>): New pattern.
(@aarch64_sve_dup_lane<mode>): Extended from SVE_FULL to SVE_ALL.
(@aarch64_sve_rev<mode>, @aarch64_sve_<perm_insn><mode>): Likewise.
(@aarch64_sve_ext<mode>): Likewise.
* config/aarch64/aarch64.c (aarch64_classify_vector_mode): Handle
E_VNx2BFmode and E_VNx4BFmode.
(aarch64_evpc_rev_local): Base the analysis on the container size
instead of the element size. Use the new aarch64_sve_revbhw
patterns for SVE.
(aarch64_evpc_dup): Handle partial SVE data modes. Use the
container size instead of the element size when applying the
SVE immediate limit. Fix a previously incorrect bounds check.
(aarch64_expand_vec_perm_const_1): Handle partial SVE data modes.
gcc/testsuite/
* gcc.target/aarch64/sve/dup_lane_2.c: New test.
* gcc.target/aarch64/sve/dup_lane_3.c: Likewise.
* gcc.target/aarch64/sve/ext_4.c: Likewise.
* gcc.target/aarch64/sve/rev_2.c: Likewise.
* gcc.target/aarch64/sve/revhw_1.c: Likewise.
* gcc.target/aarch64/sve/revhw_2.c: Likewise.
* gcc.target/aarch64/sve/slp_perm_8.c: Likewise.
* gcc.target/aarch64/sve/trn1_2.c: Likewise.
* gcc.target/aarch64/sve/trn2_2.c: Likewise.
* gcc.target/aarch64/sve/uzp1_2.c: Likewise.
* gcc.target/aarch64/sve/uzp2_2.c: Likewise.
* gcc.target/aarch64/sve/zip1_2.c: Likewise.
* gcc.target/aarch64/sve/zip2_2.c: Likewise.
Martin Liska [Fri, 2 Oct 2020 12:12:06 +0000 (14:12 +0200)]
Add -fbit-tests option.
gcc/ChangeLog:
* common.opt: Add new -fbit-tests option.
* doc/invoke.texi: Document the option.
* tree-switch-conversion.c (bit_test_cluster::find_bit_tests):
Use the option.
* tree-switch-conversion.h (is_enabled): New function.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/switch-4.c: New test.
Richard Biener [Fri, 6 Nov 2020 14:13:56 +0000 (15:13 +0100)]
make PRE constant value IDs negative
This separates constant and non-constant value-ids to allow for
a more efficient constant_value_id_p and for more efficient bit-packing
inside the bitmap sets which never contain any constant values.
There's further optimization opportunities but at this stage
I'll do small refactorings.
2020-11-06 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.h (get_max_constant_value_id): Declare.
(get_next_constant_value_id): Likewise.
(value_id_constant_p): Inline and simplify.
* tree-ssa-sccvn.c (constant_value_ids): Remove.
(next_constant_value_id): Add.
(get_or_alloc_constant_value_id): Adjust.
(value_id_constant_p): Remove definition.
(get_max_constant_value_id): Define.
(get_next_value_id): Add assert for overflow.
(get_next_constant_value_id): Define.
(run_rpo_vn): Adjust.
(free_rpo_vn): Likewise.
(do_rpo_vn): Initialize next_constant_value_id.
* tree-ssa-pre.c (constant_value_expressions): New.
(add_to_value): Split into constant/non-constant value
handling. Avoid exact re-allocation.
(vn_valnum_from_value_id): Adjust.
(phi_translate_1): Remove spurious exact re-allocation.
(bitmap_find_leader): Adjust. Make sure we return
a CONSTANT value for a constant value id.
(do_pre_regular_insertion): Use 2 auto-elements for avail.
(do_pre_partial_partial_insertion): Likewise.
(init_pre): Allocate constant_value_expressions.
(fini_pre): Release constant_value_expressions.
Richard Biener [Thu, 5 Nov 2020 11:34:42 +0000 (12:34 +0100)]
tree-optimization/97706 - handle PHIs in pattern recog mask precison
This adds handling of PHIs to mask precision compute which is
eventually needed to detect a bool pattern when the def chain
contains such a PHI node.
2020-11-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/97706
* tree-vect-patterns.c (possible_vector_mask_operation_p):
PHIs are possible mask operations.
(vect_determine_mask_precision): Handle PHIs.
(vect_determine_precisions): Walk PHIs in BB analysis.
* gcc.dg/vect/bb-slp-pr97706.c: New testcase.
Nathan Sidwell [Fri, 6 Nov 2020 13:57:34 +0000 (05:57 -0800)]
c++: Parser tweaks
We need to adjust the wording for 'export'. Between c++11 and c++20
it is deprecated. Outside those ranges it is unsupported (at the
moment). While here, there's also an unneeded setting of a bool --
it's inside an if block that just checked it was true.
gcc/cp/
* parser.c (cp_parser_template_declaration): Adjust 'export' warning.
(cp_parser_explicit_specialization): Remove unneeded bool setting.
Kewen Lin [Fri, 6 Nov 2020 13:45:06 +0000 (14:45 +0100)]
testsuite: fix malloc alignment in test
gcc/testsuite/ChangeLog:
PR gcov-profile/97461
* gcc.dg/tree-prof/pr97461.c: Return aligned memory.
Thomas Schwinge [Tue, 27 Oct 2020 09:43:27 +0000 (10:43 +0100)]
[Fortran] Remove OpenACC 'loop' inside 'parallel' special-case code
Instead, use the generic middle-end code, like already used for Fortran OpenACC
'loop' inside other compute constructs, orphaned 'loop' constructs, and C, C++
generally.
gcc/fortran/
* openmp.c (oacc_is_parallel, resolve_oacc_params_in_parallel):
Remove.
(resolve_oacc_loop_blocks): Don't call the former.
gcc/testsuite/
* gfortran.dg/goacc/loop-2-parallel-3.f95: Adjust.
Thomas Schwinge [Tue, 27 Oct 2020 06:26:24 +0000 (07:26 +0100)]
Remove 'gfortran.dg/goacc/loop-6.f95'
What it's testing is adequately covered in other
'gfortran.dg/goacc/loop-2-parallel-*.f95' testcases.
gcc/testsuite/
* gfortran.dg/goacc/loop-6.f95: Remove.
Thomas Schwinge [Tue, 27 Oct 2020 09:16:29 +0000 (10:16 +0100)]
Remove 'gfortran.dg/goacc/loop-5.f95'
What it's testing is adequately covered in other
'gfortran.dg/goacc/loop-2-*-tile.f95' testcases.
gcc/testsuite/
* gfortran.dg/goacc/loop-5.f95: Remove.
Martin Liska [Thu, 5 Nov 2020 11:33:25 +0000 (12:33 +0100)]
gcc-changelog: prevent double cherry-pick line
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Add new check.
* gcc-changelog/test_email.py: Test it.
* gcc-changelog/test_patches.txt: Add new patch.
Richard Biener [Fri, 6 Nov 2020 11:44:47 +0000 (12:44 +0100)]
refactor SLP analysis
This passes down the graph entry kind down to vect_analyze_slp_instance
which simplifies it and makes it a shallow wrapper around
vect_build_slp_instance.
2020-11-06 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_analyze_slp): Pass down the
SLP graph entry kind.
(vect_analyze_slp_instance): Simplify.
(vect_build_slp_instance): Adjust.
(vect_slp_check_for_constructors): Perform more
eligibility checks here.
Jan Hubicka [Fri, 6 Nov 2020 12:30:39 +0000 (13:30 +0100)]
Move ipa-refs from ggc to heap.
gcc/ChangeLog:
* ipa-ref.h (enum ipa_ref_use): Remove GTY marker.
(struct ipa_ref): Remove GTY marker; reorder for better packing.
(struct ipa_ref_list): Remove GTY marker; turn references
nad referring to va_heap, vl_ptr vectors; update accesors.
* cgraph.h (symtab_node::iterate_reference): Update.
* ipa-ref.c (ipa_ref::remove_reference): Update.
* symtab.c (symtab_node::create_reference): Update.
(symtab_node::remove_all_references): Update.
(symtab_node::resolve_alias): Update.
gcc/cp/ChangeLog:
* tree.c (cp_fix_function_decl_p): Do not access ipa_ref_list dirrectly.
Jakub Jelinek [Fri, 6 Nov 2020 12:20:51 +0000 (13:20 +0100)]
ipa-modref: Fix comment typos
2020-11-06 Jakub Jelinek <jakub@redhat.com>
* ipa-modref-tree.h: Fix comment typos.
* ipa-modref.c: Likewise.
Andreas Krebbel [Fri, 6 Nov 2020 11:58:59 +0000 (12:58 +0100)]
IBM Z: Remove override of inline params
We have pretty aggressive values for inline-min-speedup and
max-inline-insns-auto. This unfortunately made more maybe
uninitialized warnings to appear when building on Z.
With the patch we go back to the default values.
gcc/ChangeLog:
* config/s390/s390.c (s390_option_override_internal): Remove
override of inline params.
Richard Biener [Fri, 6 Nov 2020 10:11:42 +0000 (11:11 +0100)]
tree-optimization/97706 - part one, refactor vect_determine_mask_precision
This computes vect_determine_mask_precision in a RPO forward walk
rather than in a backward walk and using a worklist. It will make
fixing PR97706 easier but for bisecting I wanted it to be separate.
2020-11-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/97706
* tree-vect-patterns.c (vect_determine_mask_precision):
Remove worklist operation.
(vect_determine_stmt_precisions): Do not call
vect_determine_mask_precision here.
(vect_determine_precisions): Compute mask precision
in a forward walk.
Tobias Burnus [Fri, 6 Nov 2020 11:30:20 +0000 (12:30 +0100)]
OpenACC/Fortran: Reject '!$acc atomic update capture'
gcc/fortran/ChangeLog:
* openmp.c (gfc_match_oacc_atomic): No longer accept 'update capture'.
gcc/testsuite/ChangeLog:
* gfortran.dg/goacc-gomp/goacc-gomp.exp: New.
* gfortran.dg/goacc-gomp/atomic.f90: New test.
* gfortran.dg/goacc/atomic.f90: New test.
Tobias Burnus [Fri, 6 Nov 2020 10:13:47 +0000 (11:13 +0100)]
OpenACC (C/C++): Fix 'acc atomic' parsing
gcc/c/ChangeLog:
* c-parser.c (c_parser_omp_atomic): Add openacc parameter and update
OpenACC matching.
(c_parser_omp_construct): Update call.
gcc/cp/ChangeLog:
* parser.c (cp_parser_omp_atomic): Add openacc parameter and update
OpenACC matching.
(cp_parser_omp_construct): Update call.
gcc/testsuite/ChangeLog:
* c-c++-common/goacc-gomp/atomic.c: New test.
* c-c++-common/goacc/atomic.c: New test.
Richard Biener [Fri, 6 Nov 2020 08:35:27 +0000 (09:35 +0100)]
tree-optimization/97732 - fix init of SLP induction vectorization
This PR exposes two issues - one that the vector builder treats
&x as eligible for VECTOR_CST elements and one that SLP induction
vectorization forgets to convert init elements to the vector
component type which makes a difference for pointer vs. integer.
2020-11-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/97732
* tree-vect-loop.c (vectorizable_induction): Convert the
init elements to the vector component type.
* gimple-fold.c (gimple_build_vector): Use CONSTANT_CLASS_P
rather than TREE_CONSTANT to determine if elements are
eligible for VECTOR_CSTs.
* gcc.dg/vect/bb-slp-pr97732.c: New testcase.
Olivier Hainque [Fri, 28 Feb 2020 10:57:20 +0000 (10:57 +0000)]
Add dg-require-profiling directives to gcc.target/i386 tests
This patch adds /* { dg-require-profiling "-pg" } */
to a few tests in gcc.target/i386 that use -pg explicitly, to
prevent them from failing during runs for VxWorks targets.
2020-10-29 Olivier Hainque <hainque@adacore.com>
gcc/testsuite/
* gcc.target/i386/fentryname1.c: Add dg-require-profiling.
* gcc.target/i386/fentryname2.c: Likewise.
* gcc.target/i386/fentryname3.c: Likewise.
* gcc.target/i386/returninst1.c: Likewise.
* gcc.target/i386/returninst2.c: Likewise.
* gcc.target/i386/returninst3.c: Likewise.
Olivier Hainque [Wed, 26 Feb 2020 17:55:09 +0000 (17:55 +0000)]
Add dg-require-effective-target fpic to g++ tests
Add missing dg-require-effective-target fpic to few
g++.dg tests.
2020-11-02 Olivier Hainque <hainque@adacore.com>
gcc/testsuite/
* g++.dg/pr57878.C: Add dg-require-effective-target fpic.
* g++.dg/pr65032.C: Likewise.
* g++.dg/pr84279.C: Likewise.
* g++.dg/inherit/thunk8.C: Likewise.
* g++.dg/opt/pr64411.C: Likewise.
Jan Hubicka [Fri, 6 Nov 2020 09:23:58 +0000 (10:23 +0100)]
Add fnspec handling to ipa mode of ipa-modef.
gcc/:
* attr-fnspec.h (attr_fnspec::get_str): New accessor
* ipa-fnsummary.c (read_ipa_call_summary): Store also parm info
for builtins.
* ipa-modref.c (class fnspec_summary): New type.
(class fnspec_summaries_t): New type.
(modref_summary::modref_summary): Initialize writes_errno.
(struct modref_summary_lto): Add writes_errno.
(modref_summary_lto::modref_summary_lto): Initialize writes_errno.
(modref_summary::dump): Check for NULL pointers.
(modref_summary_lto::dump): Dump writes_errno.
(collapse_loads): Move up in source file.
(collapse_stores): New function.
(process_fnspec): Handle also internal calls.
(analyze_call): Likewise.
(analyze_stmt): Store fnspec string if needed.
(analyze_function): Initialize fnspec_sumarries.
(modref_summaries_lto::duplicate): Copy writes_errno.
(modref_write): Store writes_errno and fnspec summaries.
(read_section): Read writes_errno and fnspec summaries.
(modref_read): Initialize fnspec summaries.
(update_signature): Fix formating.
(compute_parm_map): Return true if sucessful.
(get_parm_type): New function.
(get_access_for_fnspec): New function.
(propagate_unknown_call): New function.
(modref_propagate_in_scc): Use it.
(pass_ipa_modref::execute): Delete fnspec_summaries.
(ipa_modref_c_finalize): Delete fnspec_summaries.
* ipa-prop.c: Include attr-fnspec.h.
(ipa_compute_jump_functions_for_bb): Also compute jump functions
for functions with fnspecs.
(ipa_read_edge_info): Read jump functions for builtins.
gcc/testsuite/ChangeLog:
* gcc.dg/ipa/modref-2.c: New test.
* gcc.dg/lto/modref-2_0.c: New test.
Jan Hubicka [Fri, 6 Nov 2020 09:05:11 +0000 (10:05 +0100)]
Move size time tables from GGC to heap
this patch moves size time tables out of ggc allocated memory. This makes
sources bit cleaner and saves about 60MB of GGC memory that turns to about 45MB
of heap memory for cc1plus LTO build.
* ipa-fnsummary.h (class size_time_entry): Do not GTY annotate.
(class ipa_fnsummary): Turn size_time_table to auto_vec and
call_size_time_table to effecient vec; update constructors.
* ipa-fnsummary.c (ipa_fn_summary::account_size_time): Update.
(ipa_fn_summary::~ipa_fn_summary): Update.
(ipa_fn_summary_t::duplicate): Update.
(ipa_dump_fn_summary): Update.
(set_switch_stmt_execution_predicate): Update.
(analyze_function_body): Update.
(estimate_calls_size_and_time): Update.
(ipa_call_context::estimate_size_and_time): Update.
(ipa_merge_fn_summary_after_inlining): Update.
(ipa_update_overall_fn_summary): Update.
(inline_read_section): Update.
(ipa_fn_summary_write): Update.
Jakub Jelinek [Fri, 6 Nov 2020 08:52:59 +0000 (09:52 +0100)]
c-common: Remove DEBUG_FUNCTION from verify_sequence_points
While perhaps the function name might suggest that it is a verification/debugging
only routine, it is actually implementation of the -Wsequence-point warning
and so doesn't need the DEBUG_FUNCTION macro on it.
2020-11-06 Jakub Jelinek <jakub@redhat.com>
* c-common.c (verify_sequence_points): Remove DEBUG_FUNCTION.
Richard Biener [Fri, 6 Nov 2020 07:34:16 +0000 (08:34 +0100)]
tree-optimization/97733 - fix SLP of reductions with zero relevant
This adds a missing check.
2020-11-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/97733
* tree-vect-slp.c (vect_analyze_slp_instance): If less
than two reductions were relevant or live do nothing.
Tobias Burnus [Fri, 6 Nov 2020 07:26:51 +0000 (08:26 +0100)]
Fortran: Fix type-decl for PDT / wrong-code pdt_14.f03 issue [PR97652]
Parameterized derived types are handled in a special way and start with 'Pdt'.
If the 'P' is not uppercase, gfc_get_derived_type (which calls
gfc_get_module_backend_decl) does not find the existing declaration and
builds a new type. The middle end then sees those types as being different
and nonalising, creating an endless loop for pdt_14.f03.
gcc/fortran/ChangeLog:
PR fortran/97652
* module.c (mio_symbol): Fix symbol name for pdt_type.
Jeff Law [Fri, 6 Nov 2020 03:42:17 +0000 (20:42 -0700)]
Improve overflow check
Convert
x < (short) ((unsigned short)x + const)
to
x <= SHORT_MAX – const
(and similarly for other integral types) if const is not 0.
gcc/
PR tree-optimization/97223
* match.pd (overflow detection and optimization): Handle conversions.
gcc/testsuite/
* gcc.dg/no-strict-overflow-4.c: Adjust expected output.
Eugene Rozenfeld [Fri, 6 Nov 2020 03:35:45 +0000 (20:35 -0700)]
Simplify x >> x to 0. This fixes PR96701.
gcc/
* match.pd (x >> x): New pattern.
gcc/testsuite
* gcc.dg/self-right-shift.c: New test.
Kito Cheng [Fri, 6 Nov 2020 03:05:50 +0000 (11:05 +0800)]
RISC-V: Mark non-export symbol static and const in riscv-common.c
gcc/ChangeLog:
* common/config/riscv/riscv-common.c (riscv_implied_info):
Add static and const.
(riscv_subset_list::handle_implied_ext): Add const due to
riscv_implied_info changed to const.
Kito Cheng [Mon, 5 Oct 2020 06:01:04 +0000 (14:01 +0800)]
PR target/96307: Fix KASAN option checking.
- Disable kasan if target is unsupported and -fasan-shadow-offset= is not
given, no matter `--param asan-stack=1` is given or not.
- Moving KASAN option checking testcase to gcc.dg, those testcase could be
useful for all other target which not support asan.
- Verifed on riscv and x86.
gcc/ChangeLog:
PR target/96307
* toplev.c (process_options): Remove param_asan_stack checking for kasan
option checking.
gcc/testsuite/ChangeLog:
PR target/96307
* gcc.dg/pr96307.c: New.
* gcc.target/riscv/pr96260.c: Move this test case from here to ...
* gcc.dg/pr96260.c: ... here.
* gcc.target/riscv/pr91441.c: Move this test case from here to ...
* gcc.dg/pr91441.c: ... here.
* lib/target-supports.exp (check_effective_target_no_fsanitize_address):
New proc.
liuhongt [Fri, 6 Nov 2020 01:27:10 +0000 (09:27 +0800)]
MAINTAINERS: Add myself for write after approval.
ChangeLog:
2019-03-17 Hongtao Liu <hongtao.liu@intel.com>
* MAINTAINERS (Write After Approval): Add myself.
GCC Administrator [Fri, 6 Nov 2020 00:16:34 +0000 (00:16 +0000)]
Daily bump.
Marek Polacek [Thu, 5 Nov 2020 23:23:56 +0000 (18:23 -0500)]
c++: Add auto_diagnostic_group to check_handlers_1.
This was missing.
gcc/cp/ChangeLog:
* except.c (check_handlers_1): Add auto_diagnostic_group.
Marek Polacek [Tue, 3 Nov 2020 20:10:31 +0000 (15:10 -0500)]
c++: Fix decltype(auto) deduction with rvalue ref [PR78209]
Here's a small deficiency in decltype(auto). [dcl.type.auto.deduct]/5:
If the placeholder-type-specifier is of the form decltype(auto), [...]
the type deduced for T is determined [...] as though E had been the operand
of the decltype. So:
int &&i = 0;
decltype(auto) j = i; // should behave like int &&j = i; error
We deduce j's type in do_auto_deduction via finish_decltype_type which
takes an 'id' argument. Currently we compute 'id' as false, because
stripped_init is *i (a REFERENCE_REF_P). But it seems to me we should
rather set 'id' to true here, by looking through the REFERENCE_REF_P,
so that finish_decltype_type DTRT.
gcc/cp/ChangeLog:
PR c++/78209
* pt.c (do_auto_deduction): If init is REFERENCE_REF_P, use its
first operand.
gcc/testsuite/ChangeLog:
PR c++/78209
* g++.dg/cpp1y/decltype-auto1.C: New test.
Marek Polacek [Tue, 3 Nov 2020 22:46:23 +0000 (17:46 -0500)]
c++: Add -Wexceptions warning option [PR97675]
This PR asks that we add a warning option for an existing (very old)
warning, so that it can be disabled selectively. clang++ uses
-Wexceptions for this, so I added this new option rather than using
e.g. -Wnoexcept.
gcc/c-family/ChangeLog:
PR c++/97675
* c.opt (Wexceptions): New option.
gcc/cp/ChangeLog:
PR c++/97675
* except.c (check_handlers_1): Use OPT_Wexceptions for the
warning. Use inform for the second part of the warning.
gcc/ChangeLog:
PR c++/97675
* doc/invoke.texi: Document -Wexceptions.
gcc/testsuite/ChangeLog:
PR c++/97675
* g++.old-deja/g++.eh/catch10.C: Adjust dg-warning.
* g++.dg/warn/Wexceptions1.C: New test.
* g++.dg/warn/Wexceptions2.C: New test.
Marek Polacek [Fri, 2 Oct 2020 13:46:30 +0000 (09:46 -0400)]
c++: Implement -Wvexing-parse [PR25814]
This patch implements the -Wvexing-parse warning to warn about the
sneaky most vexing parse rule in C++: the cases when a declaration
looks like a variable definition, but the C++ language requires it
to be interpreted as a function declaration. This warning is on by
default (like clang++). From the docs:
void f(double a) {
int i(); // extern int i (void);
int n(int(a)); // extern int n (int);
}
Another example:
struct S { S(int); };
void f(double a) {
S x(int(a)); // extern struct S x (int);
S y(int()); // extern struct S y (int (*) (void));
S z(); // extern struct S z (void);
}
You can find more on this in [dcl.ambig.res].
I spent a fair amount of time on fix-it hints so that GCC can recommend
various ways to resolve such an ambiguity. Sometimes that's tricky.
E.g., suggesting default-initialization when the class doesn't have
a default constructor would not be optimal. Suggesting {}-init is also
not trivial because it can use an initializer-list constructor if no
default constructor is available (which ()-init wouldn't do). And of
course, pre-C++11, we shouldn't be recommending {}-init at all.
I also uncovered a bug in cp_parser_declarator, where we were setting
*parenthesized_p to true despite the comment saying the exact opposite.
gcc/c-family/ChangeLog:
PR c++/25814
* c.opt (Wvexing-parse): New option.
gcc/cp/ChangeLog:
PR c++/25814
* cp-tree.h (enum cp_tree_index): Add CPTI_EXPLICIT_VOID_LIST.
(explicit_void_list_node): Define.
(PARENTHESIZED_LIST_P): New macro.
(struct cp_declarator): Add function::parens_loc.
* decl.c (cxx_init_decl_processing): Initialize explicit_void_list_node.
(grokparms): Also break when explicit_void_list_node.
* parser.c (make_call_declarator): New location_t parameter. Use it
to set declarator->u.function.parens_loc.
(cp_parser_lambda_declarator_opt): Pass UNKNOWN_LOCATION to
make_call_declarator.
(warn_about_ambiguous_parse): New function.
(cp_parser_init_declarator): Call warn_about_ambiguous_parse.
(cp_parser_declarator): Set *parenthesized_p to false rather than to
true.
(cp_parser_direct_declarator): Create a location for the function's
parentheses and pass it to make_call_declarator.
(cp_parser_parameter_declaration_clause): Return explicit_void_list_node
for (void).
(cp_parser_parameter_declaration_list): Set PARENTHESIZED_LIST_P
in the parameters tree.
gcc/ChangeLog:
PR c++/25814
* doc/invoke.texi: Document -Wvexing-parse.
gcc/testsuite/ChangeLog:
PR c++/25814
* g++.dg/cpp2a/fn-template16.C: Add a dg-warning.
* g++.dg/cpp2a/fn-template7.C: Likewise.
* g++.dg/lookup/pr80891-5.C: Likewise.
* g++.dg/lto/pr79050_0.C: Add extern.
* g++.dg/lto/pr84805_0.C: Likewise.
* g++.dg/parse/pr58898.C: Add a dg-warning.
* g++.dg/template/scope5.C: Likewise.
* g++.old-deja/g++.brendan/recurse.C: Likewise.
* g++.old-deja/g++.jason/template4.C: Likewise.
* g++.old-deja/g++.law/arm4.C: Likewise.
* g++.old-deja/g++.mike/for2.C: Likewise.
* g++.old-deja/g++.other/local4.C: Likewise.
* g++.old-deja/g++.pt/crash3.C: Likewise.
* g++.dg/warn/Wvexing-parse.C: New test.
* g++.dg/warn/Wvexing-parse2.C: New test.
* g++.dg/warn/Wvexing-parse3.C: New test.
* g++.dg/warn/Wvexing-parse4.C: New test.
* g++.dg/warn/Wvexing-parse5.C: New test.
* g++.dg/warn/Wvexing-parse6.C: New test.
* g++.dg/warn/Wvexing-parse7.C: New test.
libstdc++-v3/ChangeLog:
PR c++/25814
* testsuite/20_util/reference_wrapper/lwg2993.cc: Add a dg-warning.
* testsuite/25_algorithms/generate_n/87982_neg.cc: Likewise.
Andrew MacLeod [Thu, 5 Nov 2020 18:59:45 +0000 (13:59 -0500)]
Pass multi-range from range_query::value_* routines
fix range-ops equal/not_equal to not reuse the result range as intermediary.
value_query::value routines should pasa multi-range in as some other rangeop
routines build into this result, so we may need better precision.
gcc/
PR tree-optimization/97725
* range-op.cc (operator_equal::fold_range): Use new tmp value.
(operator_not_equal::fold_range): Ditto.
* value-query.cc (range_query::value_of_expr): Use int_range_max
not a value_range.
(range_query::value_on_edge): Ditto.
(range_query::value_of_stmt): Ditto.
gcc/testsuite/
* gcc.dg/pr97725.c: New.