PR c/87488
* pretty-print.c (pp_begin_url, pp_end_url, test_urls): Use BEL
instead of ST sequence to terminate OSC 8 strings.
Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r279073
PR c++/92831
* call.c (build_conditional_expr_1): For ?: with omitted middle
operand use cp_stabilize_reference if arg1 is glvalue_p rather than
just if it is lvalue_p.
* g++.dg/ext/temp-extend1.C: New test.
From-SVN: r279069
* cp-tree.h (extend_ref_init_temps): Add a new argument with NULL
default arg.
* call.c (set_up_extended_ref_temp): Add COND_GUARD argument, pass it
down to extend_ref_init_temps. Before pushing cleanup, if COND_GUARD
is non-NULL, create a bool temporary if needed, initialize to false
and guard the cleanup with the temporary being true.
(extend_ref_init_temps_1): Add COND_GUARD argument, pass it down
to recursive calls and set_up_extended_ref_temp. Handle COND_EXPR.
(extend_ref_init_temps): Add COND_GUARD argument, pass it down to
recursive calls and to extend_ref_init_temps_1.
* g++.dg/cpp0x/temp-extend2.C: New test.
From-SVN: r279064
This patch makes the C++ frontend work with the verify_type_context hook.
We need some new type contexts for features that don't exist in C, but
otherwise the patch is very similar to the C one.
TCTX_CAPTURE_BY_COPY could really be treated as an instance of
TCTX_FIELD, but the error message is better if we split it out.
2019-12-06 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* target.h (TCTX_ALLOCATION, TCTX_DEALLOCATION, TCTX_EXCEPTIONS)
(TCTX_CAPTURE_BY_COPY): New type_context_kinds.
* config/aarch64/aarch64-sve-builtins.cc (verify_type_context):
Handle them.
gcc/cp/
* decl.c (start_decl_1): Use verify_type_context to check whether
the target allows variables of a particular type to have static
or thread-local storage duration.
(check_array_initializer): Use verify_type_context to check whether
the target allows a particular type to be used as an array element.
(create_array_type_for_decl): Likewise.
(cp_finish_decl): Use verify_type_context to check whether
the target allows static member variables of a particular type.
(grokdeclarator): Likewise. Also use verify_type_context to check
whether the target allows non-static member variables of a particular
type.
* except.c: Include target.h.
(is_admissible_throw_operand_or_catch_parameter): Use
verify_type_context to check whether the target allows particular
types to be thrown and caught.
* typeck2.c (add_exception_specifier): Likewise.
* init.c (build_new_1): Use verify_type_context to check whether
the target allows particular types to be dynamically allocated.
(build_vec_delete_1, build_delete): Use verify_type_context to check
whether the target allows particular types to be deleted.
* lambda.c (add_capture): Use verify_type_context to check
whether the target allows particular types to be captured by copy.
* pt.c: Include target.h.
(instantiate_class_template_1): Use verify_type_context to check
whether the target allows non-static member variables of a particular
type.
* typeck.c (cxx_alignof_expr): Use verify_type_context to check
whether the target allows the alignment of a particular type
to be measured.
(pointer_diff, cp_build_unary_op): Use verify_type_context to check
whether the target allows arithmetic involving pointers to particular
types.
gcc/testsuite/
* g++.dg/ext/sve-sizeless-1.C: New test.
* g++.dg/ext/sve-sizeless-2.C: Likewise.
From-SVN: r279058
2019-12-06 Andrew Stubbs <ams@codesourcery.com>
gcc/
* config/gcn/gcn-valu.md (gather<mode>_insn_1offset<exec>): Use %o
in the asm output.
From-SVN: r279055
After the fix for PR c/36941 and PR c/88827 (r278976), this test emits
a different error message and needs an update.
2019-12-06 Christophe Lyon <christophe.lyon@linaro.org>
PR c/36941
PR c/88827
* gcc.target/aarch64/sve/acle/general-c/type_redef_11.c: Update
expected diagnostics.
From-SVN: r279039
prune_runtime_alias_test_list used ordered_remove to remove a merged
alias pair, which made the function quadratic when many aliases could
be removed.
I had a testcase in which these memmoves accounted for an impressive
85% of compile time. The fact that we had so many probably shows
a deeper problem, but still, it's easy to remove as we go.
2019-12-06 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-data-ref.c (prune_runtime_alias_test_list): Exit early
for empty vectors. Avoid using ordered_remove and instead
shuffle the vector as we go.
From-SVN: r279038
2019-12-06 Richard Biener <rguenther@suse.de>
* genmatch.c (enum tree_code): Remove CONVERT{0,1,2} and
VIEW_CONVERT{0,1,2}.
(expr::opt_grp): Add and initialize.
(lower_opt_convert): Rename to ...
(lower_opt): ... and work on opt_grp, simply switching operations
from being optional to being present or not.
(has_opt_convert): Rename to ...
(has_opt): ... and adjust.
(parser::parse_operation): Return the optional opt_grp,
remove special-casing of conditional operations and more generally
parse [digit]'?'.
(parser::parse_expr): Stick on the parsed opt_grp and perform
rough verification.
(parser::parse_for): Remove now unnecessary code.
(main): Likewise.
* doc/match-and-simplify.texi: Mention ? now works on all
unary operations and also match predicates.
From-SVN: r279037
2019-12-06 Richard Biener <rguenther@suse.de>
* genmatch.c (c_expr::gen_transform): Emit newlines from line
number changes rather than after every semicolon.
From-SVN: r279034
2019-12-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/92819
* match.pd (VEC_PERM_EXPR -> BIT_INSERT_EXPR): Handle inserts
into the last lane. For two-element vectors try inserting
into the last lane when inserting into the first fails.
* gcc.target/i386/pr92819-1.c: New testcase.
* gcc.target/i386/pr92803.c: Adjust.
From-SVN: r279033
gcc/ChangeLog:
PR middle-end/92622
* tree-vrp.c (vrp_prop::check_array_ref): Avoid using a variable
left uninitialized by get_addr_base_and_unit_offset ofn failure.
From-SVN: r279029
2019-12-05 Sandra Loosemore <sandra@codesourcery.com>
Disable --eh-frame-hdr with -pie or -shared on nios2-linux-gnu.
The nios2 ABI doesn't have appropriate relocations to support
--eh-frame-hdr with -pie or -shared, so we need to override the
default specs that add that link option. Otherwise we get linker
warnings about invalid FDE encodings.
gcc/
* config/nios2/linux.h (LINK_EH_SPEC): Define.
gcc/testsuite/
* g++.target/nios2/hello-pie.C: New.
* g++.target/nios2/nios2.exp: New.
From-SVN: r279023
this patch fixes ICE in g++.dg/torture/pr59226.C which was triggered by
new comdat_local sanity check. What happens here is that function gets
inlined into its own thunk which makes it !comdat_local_p but the updating
code does not notice since thunk calls comdat local alias of the function
itself and we look at alias target rather than original callee.
This also shows that we miss optimization here. Currently we will not inline
thunk out of its comdat local group w/o inlining function it is associated with
into it.
We should teach inline_call to reoslve edges to aliases while inlining and
relax calls_comdat_local flag. But this needs bit more work, so I fix the
ICE first.
* ipa-inline-transform.c (inline_call): Fix maintenatnce of comdat_local
From-SVN: r279021
This patch implements C++20 P1331, allowing trivial default initialization in
constexpr contexts.
* c-cppbuiltin.c (c_cpp_builtins): Adjust the value of __cpp_constexpr.
* class.c (trivial_default_constructor_is_constexpr): Return true in
C++20.
* constexpr.c (cx_check_missing_mem_inits): Allow missing field
initializers in C++20.
(cxx_eval_call_expression): Don't clear CONSTRUCTOR_NO_CLEARING for
constexpr constructors in C++20.
(reduced_constant_expression_p): Don't set FIELD for union and array
types. Skip empty class fields without initializers.
* decl.c (check_for_uninitialized_const_var): Permit trivial default
initialization in constexpr.
(next_initializable_field): Don't skip vptr fields.
* method.c (walk_field_subobs): Still consider a constructor that
doesn't initialize all the members constexpr.
* g++.dg/cpp0x/constexpr-array6.C: Adjust dg-error.
* g++.dg/cpp0x/constexpr-ctor.C: Likewise.
* g++.dg/cpp0x/constexpr-diag3.C: Likewise.
* g++.dg/cpp0x/constexpr-diag4.C: Likewise.
* g++.dg/cpp0x/constexpr-ex3.C: Likewise.
* g++.dg/cpp0x/constexpr-template2.C: Likewise.
* g++.dg/cpp0x/constexpr-union2.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-mangle.C: Rip out a piece of code ...
* g++.dg/cpp0x/lambda/lambda-mangle6.C: ... and put it here.
* g++.dg/cpp0x/pr79118.C: Adjust dg-error.
* g++.dg/cpp1y/constexpr-83921-3.C: Likewise.
* g++.dg/cpp1y/constexpr-neg1.C: Likewise.
* g++.dg/cpp1z/constexpr-lambda12.C: Likewise.
* g++.dg/cpp1z/feat-cxx1z.C: Use -std=c++17.
* g++.dg/cpp2a/constexpr-init1.C: New test.
* g++.dg/cpp2a/constexpr-init2.C: New test.
* g++.dg/cpp2a/constexpr-init3.C: New test.
* g++.dg/cpp2a/constexpr-init4.C: New test.
* g++.dg/cpp2a/constexpr-init5.C: New test.
* g++.dg/cpp2a/constexpr-init6.C: New test.
* g++.dg/cpp2a/constexpr-init7.C: New test.
* g++.dg/cpp2a/constexpr-init8.C: New test.
* g++.dg/cpp2a/constexpr-init9.C: New test.
* g++.dg/cpp2a/constexpr-init10.C: New test.
* g++.dg/cpp2a/constexpr-init11.C: New test.
* g++.dg/cpp2a/constexpr-init12.C: New test.
* g++.dg/cpp2a/constexpr-init13.C: New test.
* g++.dg/cpp2a/constexpr-init14.C: New test.
* g++.dg/cpp2a/constexpr-init15.C: New test.
* g++.dg/cpp2a/constexpr-try5.C: Adjust dg-error.
* g++.dg/cpp2a/feat-cxx2a.C: Test __cpp_constexpr.
* g++.dg/cpp2a/lambda-mangle.C: New test.
* g++.dg/debug/dwarf2/pr44641.C: Skip for c++2a.
* g++.dg/ext/stmtexpr21.C: Adjust dg-error.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r279019
Richard Smith proposed adding a synonym for __is_same_as, to accomodate the
convention of exposing std::SOME_TRAIT<A, B>::value as __SOME_TRAIT(A, B).
So add that alias, and also adjust the C++ printer. I didn't bother changing
the RID_ identifier.
* c-common.c: Add __is_same, an alias for __is_same_as.
* cxx-pretty-print.c (pp_cxx_trait_expression) <case CPTK_IS_SAME_AS>:
Print "__is_same".
* g++.dg/ext/is_same.C: New test.
From-SVN: r279018
* cgraphclones.c (localize_profile): New function.
(cgraph_node::create_clone): Use it for partial profiles.
* common.opt (fprofile-partial-training): New flag.
* doc/invoke.texi (-fprofile-partial-training): Document.
* ipa-cp.c (update_profiling_info): For partial profiles do not
set function profile to zero.
* profile.c (compute_branch_probabilities): With partial profile
watch if edge count is zero and turn all probabilities to guessed.
(compute_branch_probabilities): For partial profiles do not apply
profile when entry count is zero.
* tree-profile.c (tree_profiling): Only do value_profile_transformations
when profile is read.
From-SVN: r279013
gcc/fortran/
* trans-openmp.c (gfc_omp_is_optional_argument,
gfc_omp_check_optional_argument): Handle type(c_ptr),value which uses a
hidden argument for the is-present check.
gcc/
* omp-low.c (lower_omp_target): For use_device_ptr/use_derice_addr
and Fortran's optional arguments, unconditionally add the is-present
condition before the libgomp call.
libgomp/
* testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: Add
'type(c_ptr), value' test case. Conditionally map the per-value
passed arguments.
From-SVN: r279004
This PR shows that we weren't checking for bitwise-identical values
when trying to encode a VECTOR_CST, so -0.0 was treated the same as
0.0 for -fno-signed-zeros. The patch adds a new OEP flag to select
that behaviour.
2019-12-05 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR middle-end/92768
* tree-core.h (OEP_BITWISE): New flag.
* fold-const.c (operand_compare::operand_equal_p): Handle it.
* tree-vector-builder.h (tree_vector_builder::equal_p): Pass it.
gcc/testsuite/
PR middle-end/92768
* gcc.dg/pr92768.c: New test.
From-SVN: r279002
The previous commit fixed the std::span constructors from const arrays,
revealing a bug in this test.
* testsuite/23_containers/span/lwg3255.cc: Fix test. Constructing a
span of non-const elements should not be possible from a const array
or an array of const elements.
From-SVN: r279001
This also fixes a bug in the implementation of LWG 3255, which causes:
FAIL: 23_containers/span/lwg3255.cc (test for excess errors)
That's because the test was wrong and verified the buggy behaviour. That
will be fixed in the following commit.
2019-12-05 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com>
Implement P1872R0 and P1394R0 for std::span
* include/bits/range_access.h (__adl_begin, __adl_end): Remove.
(sentinel_t, range_value_t, range_reference_t)
(range_rvalue_reference_t, __forwarding_range, disable_sized_range)
(output_range, input_range, forward_range, bidirectional_range)
(random_access_range, contiguous_range, common_range): Move here from
<ranges>, to make this the "ranges lite" internal header.
* include/std/ranges: Move basic aliases and concepts to
<bits/range_access.h>.
* include/std/span: Use concepts and ranges:: calls instead of
enable_if and friends.
* include/std/type_traits: Add __is_array_convertible trait.
From-SVN: r279000
2019-12-05 Richard Biener <rguenther@suse.de>
PR middle-end/92818
* tree-ssa-forwprop.c (simplify_vector_constructor): Improve
heuristics on what don't care element to choose.
* match.pd (VEC_PERM_EXPR -> BIT_INSERT_EXPR): Fix typo.
* gcc.target/i386/pr92818.c: New testcase.
From-SVN: r278998