Matthew Beliveau [Tue, 11 Jun 2019 15:03:21 +0000 (15:03 +0000)]
PR c++/90449 - add -Winaccessible-base option.
* doc/invoke.texi (Winaccessible-base): Document.
* c.opt (Winaccessible-base): Added new option.
* class.c (warn_about_ambiguous_bases): Changed name to:
maybe_warn_about_inaccessible_bases.
(maybe_warn_about_inaccessible_bases): Implemented new
Winaccessible-base warning option for both direct and virtual
base warnings.
(layout_class_type): Call to warn_about_ambiguous_bases changed to fit
new name.
* g++.dg/warn/Winaccessible-base-1.C: New file.
* g++.dg/warn/Winaccessible-base-2.C: New file.
* g++.dg/warn/Winaccessible-virtual-base-1.C: New file.
* g++.dg/warn/Winaccessible-virtual-base-2.C: New file.
Richard Biener [Tue, 11 Jun 2019 14:03:41 +0000 (14:03 +0000)]
re PR c++/90801 (A recurring hang)
2019-06-11 Richard Biener <rguenther@suse.de>
PR c++/90801
* typeck2.c (split_nonconstant_init_1): Avoid ordered remove
from CONSTRUCTOR by marking to remove elements and doing all
of them in a O(n) scan.
Richard Biener [Tue, 11 Jun 2019 08:30:47 +0000 (08:30 +0000)]
toir.cc (pop_label): Only queue labels in a vector.
2019-06-11 Richard Biener <rguenthe@suse.de>
d/90778
* toir.cc (pop_label): Only queue labels in a vector.
(cmp_labels): Label decl comparator.
(pop_binding_level): Pop labels in DECL_UID order to avoid
debug info differences.
Ian Lance Taylor [Mon, 10 Jun 2019 21:08:42 +0000 (21:08 +0000)]
compiler: make heap expression's write barrier conditional
Heap_expression::do_get_backend emits an unconditional write
barrier if the type has pointers and it is not a stack allocation.
This CL changes it to use a write barrier for the assignment only
when write barriers are enabled. While here, also change it to
call gcWriteBarrier instead of typedmemmove for pointer-shaped
types.
For this to work, Function::build needs to be adjusted so that
Heap_expression::do_get_backend is called when there is a parent
block.
Ian Lance Taylor [Mon, 10 Jun 2019 21:02:20 +0000 (21:02 +0000)]
compiler: permit inlining functions with labels and goto statements
This permits inlining functions with for loops and some switches, as
they are lowered to if and goto statements before exporting them.
This by itself only adds three new inlinable functions in the standard
library: sort.Search, context.(*emptyCtx).String, and
cmd/go/internal/work.(*Builder).disableBuildID.
Ian Lance Taylor [Mon, 10 Jun 2019 20:35:14 +0000 (20:35 +0000)]
compiler: use gcWriteBarrier for pointer-shaped struct/array
If a struct/array is pointer-shaped (i.e. having a single field
that is pointer-shaped), we can use gcWriteBarrier instead of
typedmemmove for the write barrier.
Jason Merrill [Mon, 10 Jun 2019 19:31:49 +0000 (15:31 -0400)]
Reduce constexpr_call memory consumption.
* constexpr.c (cxx_bind_parameters_in_call): Use TREE_VEC rather
than TREE_LIST.
(constexpr_call_hasher::equal, cxx_bind_parameters_in_call)
(cxx_eval_call_expression): Adjust.
Ian Lance Taylor [Mon, 10 Jun 2019 19:30:21 +0000 (19:30 +0000)]
compiler: make escape analysis work with imported inlineable functions
The escape analysis was written before we import inlineable
function bodies, and in some places it skipped functions that are
not in the local package. Now that there are imported function
bodies, make the escape analysis work with them.
Note that it is necessary for the escape analysis to run on
imported function bodies, even if they are already tagged. The
tags only have the information of the parameters (receiver,
results), but not the internal nodes, e.g. local variables. We
still need to do the analysis to get all the information. (In the
future maybe we could export/import escape info for internal
nodes also, then we don't need to redo the analysis.)
Also add assertions to ensure that if we analyze the same
function in multiple places, they'd better agree with each other.
Jonathan Wakely [Mon, 10 Jun 2019 15:55:36 +0000 (16:55 +0100)]
PR other/90695 reduce testcase to remove library dependency
This reproduces the original ICE fixed by r178857 (tested at r178852 and
r178860), without depending on a libstdc++ header that keeps changing.
The number of errors differs between C++14 and C++17 modes, so the fixed
test uses dg-excess-errors to match any number of them. The precise
errors aren't what's being tested for here anyway, the point of the test
is to verify the ICE in PR 50391 is fixed.
PR other/90695
* g++.dg/cpp0x/noexcept15.C: Remove dependency on library header.
Martin Liska [Mon, 10 Jun 2019 11:07:24 +0000 (13:07 +0200)]
Reduce SCCs in IPA postorder.
2019-06-10 Martin Liska <mliska@suse.cz>
* ipa-cp.c (ignore_edge_p): New function.
(build_toporder_info): Use it.
* ipa-inline.c (ignore_edge_p): New function/
(inline_small_functions): Use it.
* ipa-pure-const.c (ignore_edge_for_nothrow):
Verify opt_for_fn for caller and callee.
(ignore_edge_for_pure_const): Likewise.
* ipa-reference.c (ignore_edge_p): Extend to check
for opt_for_fn.
* ipa-utils.c (searchc): Refactor.
* ipa-utils.h: Fix coding style.
Martin Liska [Mon, 10 Jun 2019 07:43:11 +0000 (09:43 +0200)]
IPA ICF: enhance dump about items in a non-singular class.
2019-06-10 Martin Liska <mliska@suse.cz>
* ipa-icf.c (sem_item_optimizer::parse_nonsingleton_classes):
Update coding style.
(sem_item_optimizer::dump_cong_classes):
Print how many items are in a non-singular class. Improve
coding style.
2019-06-10 Martin Liska <mliska@suse.cz>
Martin Liska [Mon, 10 Jun 2019 07:38:59 +0000 (09:38 +0200)]
Implement N disk counters for single value and indirect call counters.
2019-06-10 Martin Liska <mliska@suse.cz>
* gcov-io.h (GCOV_DISK_SINGLE_VALUES): New.
(GCOV_SINGLE_VALUE_COUNTERS): Likewise.
* ipa-profile.c (ipa_profile_generate_summary):
Use get_most_common_single_value.
* tree-profile.c (gimple_init_gcov_profiler):
Instrument with __gcov_one_value_profiler_v2
and __gcov_indirect_call_profiler_v4.
* value-prof.c (dump_histogram_value):
Print all values for HIST_TYPE_SINGLE_VALUE.
(stream_out_histogram_value): Update assert for
N values.
(stream_in_histogram_value): Set number of
counters for HIST_TYPE_SINGLE_VALUE.
(get_most_common_single_value): New.
(gimple_divmod_fixed_value_transform):
Use get_most_common_single_value.
(gimple_ic_transform): Likewise.
(gimple_stringops_transform): Likewise.
(gimple_find_values_to_profile): Set number
of counters for HIST_TYPE_SINGLE_VALUE.
* value-prof.h (get_most_common_single_value):
New.
2019-06-10 Martin Liska <mliska@suse.cz>
Test for C++20 p0858 - ConstexprIterator requirements.
2019-06-08 Edward Smith-Rowland <3dw4rd@verizon.net>
Test for C++20 p0858 - ConstexprIterator requirements.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
New test.
* testsuite/23_containers/array/requirements/constexpr_iter.cc:
New test.
Paul Thomas [Sat, 8 Jun 2019 15:52:38 +0000 (15:52 +0000)]
re PR fortran/90786 (ICE on procedure pointer assignment to function with class pointer result)
2019-06-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/90786
* trans-expr.c (pointer_assignment_is_proc_pointer) Remove as
it is very simple and only called from one place.
(gfc_trans_pointer_assignment): Rename non_proc_pointer_assign
as non_proc_ptr_assign. Assign to it directly, rather than call
to above, deleted function and use gfc_expr_attr instead of
only checking the reference chain.
2019-06-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/90786
* gfortran.dg/proc_ptr_51.f90 : New test.
Clean up non-conforming names
* include/pstl/algorithm_impl.h (__parallel_set_union_op):
Uglfiy copy_range1 and copy_range2
(__pattern_walk2_n): Rename local n to __n
* include/pstl/parallel_backend_tbb.h (struct __binary_no_op):
Rename parameter _T to _Tp.
Integrate non-TBB serial backend support
* include/bits/c++config: Adjust TBB detection logic to select serial
PSTL backend if no TBB present.
* testsuite/utils/pstl/test_utils.h: Remove check for
_PSTL_USE_PAR_POLICIES
Mark Eggleston [Fri, 7 Jun 2019 14:25:39 +0000 (14:25 +0000)]
re PR fortran/89100 (Default widths for i, f and g format specifiers in format strings)
2019-06-07 Mark Eggleston <mark.eggleston@codethink.com>
PR fortran/89100
* gfortran.dg/fmt_f_default_field_width_3.f90: Modify dg-error
to allow use when kind=16 is not supported.
* gfortran.dg/fmt_g_default_field_width_3.f90: Modify dg-error
to allow use when kind=16 is not supported.
Normally the backend will do deadcode elimination and this is
sufficient. However, the escape analysis operates on the AST that
may have deadcode, and may cause things to escape that otherwise
do not.
This CL adds a simple deadcode elimination, run before the escape
analysis.
Jan Hubicka [Fri, 7 Jun 2019 08:14:04 +0000 (10:14 +0200)]
Make aliasing_component_refs_p to work harder when same_type_for_tbaa returns -1
* tree-ssa-alias.c (aliasing_component_refs_p): Do not give up
immediately after same_types_for_tbaa_p returns -1 and continue
looking for possible exact match; if matching types are arrays
watch for partial overlaps.
(indirect_ref_may_alias_decl_p): Watch for partial array overlaps.
(indirect_refs_may_alias_p): Do type based disambiguation first;
update comment.
* gcc.dg/lto/alias-access-path-2.0.c: New testcase.
PR tree-optimization/78902
* c-c++-common/asan/alloca_loop_unpoisoning.c: Use result
of __builtin_alloca.
* c-c++-common/asan/pr88619.c: Likewise.
* g++.dg/overload/using2.C: Likewise for malloc.
* gcc.dg/attr-alloc_size-5.c: Add new dg-warning.
* gcc.dg/nonnull-3.c: Use result of __builtin_strdup.
* gcc.dg/pr43643.c: Likewise.
* gcc.dg/pr59717.c: Likewise for calloc.
* gcc.dg/torture/pr71816.c: Likewise.
* gcc.dg/tree-ssa/pr78886.c: Likewise.
* gcc.dg/tree-ssa/pr79697.c: Likewise.
* gcc.dg/pr78902.c: New test.
go/internal/gccgoimporter: ignore unexported and imported names
Due to inlining, we can now see unexported functions and variables,
and functions and variables imported from different packages.
Ignore them rather than reporting them from this package.
Handle $hash and $equal functions consistently, so that we discard the
inline body if there is one.
Ignore names created for result parameters for inlining purposes.
compiler: permit inlining temporary statements and references
This increases the number of inlinable functions from 439 to 455.
An example is math/bits.Mul32, which uses temporaries to handle the
tuple assignment.
Iain Sandoe [Thu, 6 Jun 2019 19:16:31 +0000 (19:16 +0000)]
Darwin, c++, testsuite - adjust alignas4.C for Darwin's asm syntax.
Darwin produces aligned zerofill directives for the objects represented.
We can scan for these using "lp64" and "ilp32" to catch operation on both
X86 and PowerPC ports (the test is for the alignment which is the trailing
value in the zerofill directive, as a power of two).
gcc/testsuite/ChangeLog:
2019-06-06 Iain Sandoe <iain@sandoe.co.uk>
* g++.dg/cpp0x/alignas4.C: Amend test to check for zerofill syntax
on Darwin.
Iain Sandoe [Thu, 6 Jun 2019 19:02:54 +0000 (19:02 +0000)]
Darwin, PowerPC, libgcc - Ensure unwinder is built with altivec enabled.
When libgcc is built on Darwin, it is usually built for the earliest potential
target (Darwin8, 10.4). Build for that revision default to assuming that the
processor might be G3 (without vector ops) and there is an outlined function
used for save/restore that checks whether the processor is G3 or G4+ at run-
time. However, the unwinder itself needs to be built with the assumption of
vector usage so that the relevant outlined functions are called.
2019-06-06 Iain Sandoe <iain@sandoe.co.uk>
* config/rs6000/t-darwin: Ensure that the unwinder is built with
altivec enabled.
Martin Jambor [Thu, 6 Jun 2019 16:31:20 +0000 (18:31 +0200)]
Make SRA re-construct orginal memory accesses when easy
2019-06-06 Martin Jambor <mjambor@suse.cz>
* tree-sra.c (struct access): New field grp_same_access_path.
(dump_access): Dump it.
(build_reconstructed_reference): New function.
(build_ref_for_model): Use it if possible.
(path_comparable_for_same_access): New function.
(same_access_path_p): Likewise.
(sort_and_splice_var_accesses): Set the new flag.
(analyze_access_subtree): Likewise.
(propagate_subaccesses_across_link): Propagate zero value of the new
flag down the access tree.
Jonathan Wakely [Thu, 6 Jun 2019 15:34:56 +0000 (16:34 +0100)]
Avoid unnecessary inclusion of <stdexcept> header
This can greatly reduce the amount of preprocessed code that is included
by other headers, because <stdexcept> depends on <string> which is huge.
* include/std/array: Do not include <stdexcept>.
* include/std/optional: Include <exception> and
<bits/exception_defines.h> instead of <stdexcept>.
* testsuite/20_util/function_objects/searchers.cc: Include <cctype>
for std::isalnum.
* testsuite/20_util/tuple/cons/deduction.cc: Include <memory> for
std::allocator.
* testsuite/23_containers/map/erasure.cc: Include <string>.
* testsuite/23_containers/unordered_map/erasure.cc: Likewise.
Jonathan Wakely [Thu, 6 Jun 2019 15:34:45 +0000 (16:34 +0100)]
Fix more tests that fail in C++2a mode
* testsuite/23_containers/unordered_map/requirements/debug_container.cc:
Do not test allocator rebinding extension for C++2a.
* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Change
dg-do directive for C++17 and C++2a.
Kyrylo Tkachov [Thu, 6 Jun 2019 13:59:07 +0000 (13:59 +0000)]
[AArch64] PR tree-optimization/90332: Implement vec_init<M><N> where N is a vector mode
This patch fixes the failing gcc.dg/vect/slp-reduc-sad-2.c testcase on aarch64
by implementing a vec_init optab that can handle two half-width vectors producing a full-width one
by concatenating them.
In the gcc.dg/vect/slp-reduc-sad-2.c case it's a V8QI reg concatenated with a V8QI const_vector of zeroes.
This can be implemented efficiently using the aarch64_combinez pattern that just loads a D-register to make
use of the implicit zero-extending semantics of that load.
Otherwise it concatenates the two vector using aarch64_simd_combine.
With this patch I'm seeing the effect from richi's original patch that added gcc.dg/vect/slp-reduc-sad-2.c on aarch64
and 525.x264_r improves by about 1.5%.
Jonathan Wakely [Thu, 6 Jun 2019 13:36:27 +0000 (14:36 +0100)]
Fix tests that fail in C++2a mode
The GNU extension that allows using the wrong allocator type with a
container is disabled for C++2a mode, because the standard now requires
a diagnostic. Fix the tests that fail when -std=gnu++2a is used.
Also remove some reundant tests that are duplicates of another test
except for a target specifier of c++11. Those tests previously set
-std=gnu++11 explicitly but that was replaced globally with a target
specifier. These tests existed to verify that explicit instantiation
worked for both C++98 and C++11 modes, but now do nothing because both
copies of the test use -std=gnu++14 by default. Instead of duplicating
the test we should be regularly running the whole testsuite with
different -std options.
* testsuite/23_containers/deque/requirements/explicit_instantiation/
1_c++0x.cc: Remove redundant test.
* testsuite/23_containers/deque/requirements/explicit_instantiation/
2.cc: Use target selector instead of preprocessor condition.
* testsuite/23_containers/deque/requirements/explicit_instantiation/
3.cc: Do not run test for C++2a.
* testsuite/23_containers/forward_list/requirements/
explicit_instantiation/3.cc: Likewise.
* testsuite/23_containers/forward_list/requirements/
explicit_instantiation/5.cc: Do not test allocator rebinding extension
for C++2a.
* testsuite/23_containers/list/requirements/explicit_instantiation/
1_c++0x.cc: Remove redundant test.
* testsuite/23_containers/list/requirements/explicit_instantiation/
2.cc: Use target selector instead of preprocessor condition.
* testsuite/23_containers/list/requirements/explicit_instantiation/
3.cc: Do not run test for C++2a.
* testsuite/23_containers/list/requirements/explicit_instantiation/
5.cc: Do not test allocator rebinding extension for C++2a.
* testsuite/23_containers/map/requirements/explicit_instantiation/
1_c++0x.cc: Remove redundant test.
* testsuite/23_containers/map/requirements/explicit_instantiation/
2.cc: Adjust comment.
* testsuite/23_containers/map/requirements/explicit_instantiation/
3.cc: Do not run test for C++2a.
* testsuite/23_containers/map/requirements/explicit_instantiation/
5.cc: Do not test allocator rebinding extension for C++2a.
* testsuite/23_containers/multimap/requirements/explicit_instantiation/
1_c++0x.cc: Remove redundant test.
* testsuite/23_containers/multimap/requirements/explicit_instantiation/
3.cc: Do not run test for C++2a.
* testsuite/23_containers/multimap/requirements/explicit_instantiation/
5.cc: Do not test allocator rebinding extension for C++2a.
* testsuite/23_containers/multiset/requirements/explicit_instantiation/
3.cc: Do not run test for C++2a.
* testsuite/23_containers/multiset/requirements/explicit_instantiation/
5.cc: Do not test allocator rebinding extension for C++2a.
* testsuite/23_containers/set/requirements/explicit_instantiation/3.cc:
Do not run test for C++2a.
* testsuite/23_containers/set/requirements/explicit_instantiation/
1_c++0x.cc: Remove redundant test.
* testsuite/23_containers/set/requirements/explicit_instantiation/5.cc:
Do not test allocator rebinding extension for C++2a.
* testsuite/23_containers/unordered_map/requirements/
explicit_instantiation/3.cc: Likewise.
* testsuite/23_containers/unordered_map/requirements/
explicit_instantiation/5.cc: Do not test allocator rebinding extension
for C++2a.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation/3.cc: Do not run test for C++2a.
* testsuite/23_containers/unordered_multimap/requirements/
explicit_instantiation/5.cc: Do not test allocator rebinding extension
for C++2a.
* testsuite/23_containers/unordered_multiset/requirements/
explicit_instantiation/3.cc: Do not run test for C++2a.
* testsuite/23_containers/unordered_multiset/requirements/
explicit_instantiation/5.cc: Do not test allocator rebinding extension
for C++2a.
* testsuite/23_containers/unordered_set/requirements/
explicit_instantiation/3.cc: Do not run test for C++2a.
* testsuite/23_containers/unordered_set/requirements/
explicit_instantiation/5.cc: Do not test allocator rebinding extension
for C++2a.
* testsuite/23_containers/vector/ext_pointer/explicit_instantiation/
2.cc: Remove redundant test.
* testsuite/23_containers/vector/ext_pointer/explicit_instantiation/
3.cc: Do not run test for C++2a.
* testsuite/23_containers/vector/requirements/explicit_instantiation/
3.cc: Likewise.