gcc.git
4 years agolibstdc++: Fix std::reverse_iterator relational operators
Jonathan Wakely [Sat, 28 Mar 2020 21:52:13 +0000 (21:52 +0000)]
libstdc++: Fix std::reverse_iterator relational operators

My recent changes to reverse_iterator's comparisons was not the version
of the code (or tests) that I meant to commit, and broke the relational
operators. This fixes them to reverse the order of the comparisons on
the base() iterators.

This also replaces the SFINAE constraints in the return type of the
reverse_iterator and move_iterator comparisons with a requires-clause.
This ensures the constrained overloads are preferred to unconstrained
ones. This means the non-standard same-type overloads can be omitted for
C++20 because they're not needed to solve the problem with std::rel_ops
or the testsuite's greedy_ops::X type.

* include/bits/stl_iterator.h (reverse_iterator): Use requires-clause
to constrain C++20 versions of comparison operators. Fix backwards
logic of relational operators.
(move_iterator): Use requires-clause to constrain comparison operators
in C++20. Do not declare non-standard same-type overloads for C++20.
* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc: Check result
of comparisons and check using greedy_ops type.
* testsuite/24_iterators/reverse_iterator/rel_ops_c++20.cc: Likewise.
* testsuite/24_iterators/move_iterator/greedy_ops.cc: Remove redundant
main function from compile-only test.
* testsuite/24_iterators/reverse_iterator/greedy_ops.cc: Likewise.

4 years agotestsuite: adjust modulo-sched compare-debug tests
Roman Zhuykov [Sat, 28 Mar 2020 21:06:54 +0000 (00:06 +0300)]
testsuite: adjust modulo-sched compare-debug tests

Without this patch tortured tests eventually fail because of another
known issue which I plan to fix later in stage1.

* gcc.dg/torture/pr87197-debug-sms.c: Move to ...
* gcc.dg/sms-compare-debug-1.c: ... this.  Add -O2.
* gcc.c-torture/execute/pr70127-debug-sms.c: Move to ...
* gcc.dg/sms-compare-debug-2.c: ... this.  Add -O2.

4 years agoPatch for PR94246
Paul Thomas [Sat, 28 Mar 2020 19:11:35 +0000 (19:11 +0000)]
Patch for PR94246

4 years ago[Fortran] Fix result-variable handling of MODULE PROCEDURE (PR94348)
Tobias Burnus [Sat, 28 Mar 2020 13:01:57 +0000 (14:01 +0100)]
[Fortran] Fix result-variable handling of MODULE PROCEDURE (PR94348)

PR fortran/94348
* decl.c (gfc_match_submod_proc): Add result var to the
proc's namespace.

PR fortran/94348
* gfortran.dg/module_procedure_3.f90: New.

4 years agoc++: Diagnose when "requires" is used instead of "requires requires" [PR94306]
Patrick Palka [Sat, 28 Mar 2020 12:57:11 +0000 (08:57 -0400)]
c++: Diagnose when "requires" is used instead of "requires requires" [PR94306]

This adds support to detect and recover from the case where an opening brace
immediately follows the start of a requires-clause.  So rather than emitting the
error

  error: expected primary-expression before '{' token

followed by a slew of irrevelant errors, we now assume the user had intended to
write "requires requires {" and diagnose and recover accordingly.

gcc/cp/ChangeLog:

PR c++/94306
* parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
"requires {" when "requires requires {" was probably intended.

gcc/testsuite/ChangeLog:

PR c++/94306
* g++.dg/concepts/diagnostic8.C: New test.

4 years agoc++: requires-expression outside of a template is misevaluated [PR94252]
Patrick Palka [Sat, 28 Mar 2020 12:56:59 +0000 (08:56 -0400)]
c++: requires-expression outside of a template is misevaluated [PR94252]

This PR shows that a REQUIRES_EXPR outside of a template can sometimes be
misevaluated.  This happens because the evaluation routine tsubst_requires_expr
(and diagnose_requires_expr) assumes the REQUIRES_EXPR's subtrees are templated
trees and that therefore it's safe to call tsubst_expr on them.  But this
assumption isn't valid when we've parsed a REQUIRES_EXPR outside of a template
context.  In order to make this assumption valid here, this patch sets
processing_template_decl to non-zero before parsing the body of a REQUIRES_EXPR
so that its subtrees are indeed always templated trees.

gcc/cp/ChangeLog:

PR c++/94252
* constraint.cc (tsubst_compound_requirement): Always suppress errors
from type_deducible_p and expression_convertible_p, as they're not
substitution errors.
(diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
that we diagnose INTEGER_CST expressions of non-bool type via the
default case.
* cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
* parser.c (cp_parser_requires_expression): Always parse the requirement
body as if we're processing a template, by temporarily incrementing
processing_template_decl.  Afterwards, if we're not actually in a
template context, perform semantic processing to diagnose any invalid
types and expressions.
* pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
* semantics.c (finish_static_assert): Explain an assertion failure
when the condition is a REQUIRES_EXPR like we do when it is a concept
check.

gcc/testsuite/ChangeLog:

PR c++/94252
* g++.dg/concepts/diagnostic7.C: New test.
* g++.dg/concepts/pr94252.C: New test.
* g++.dg/cpp2a/concepts-requires18.C: Adjust to expect an additional
diagnostic.

4 years agoc++: Respect current_constraint_diagnosis_depth in diagnose_compound_requirement
Patrick Palka [Sat, 28 Mar 2020 12:56:33 +0000 (08:56 -0400)]
c++: Respect current_constraint_diagnosis_depth in diagnose_compound_requirement

The previous patch tries to avoid changing our current default diagnostics.  But
for the sake of consistency we arguably should also respect
current_constraint_diagnosis_depth in diagnose_compound_requirement() like we do
in the other error-replaying diagnostic routines.  But doing so would be a
change to our default diagnostics behavior, so the change has been split out
into this separate patch for separate consideration.

gcc/cp/ChangeLog:

* constraint.cc (diagnose_compound_requirement): When diagnosing a
compound requirement, maybe replay the satisfaction failure, subject to
the current diagnosis depth.

gcc/testsuite/ChangeLog:

* g++.dg/concepts/diagnostic1.C: Pass -fconcepts-diagnostics-depth=2.
* g++.dg/concepts/diagnostic5.C: Adjust expected diagnostics.
* g++.dg/cpp2a/concepts-iconv1.C: Pass -fconcepts-diagnostics-depth=2.
* g++.dg/cpp2a/concepts-requires5.C: Likewise.

4 years agoc++: Replay errors during diagnosis of constraint satisfaction failures
Patrick Palka [Sat, 28 Mar 2020 12:43:20 +0000 (08:43 -0400)]
c++: Replay errors during diagnosis of constraint satisfaction failures

This patch adds a new flag -fconcepts-diagnostics-depth to the C++ frontend
which controls how deeply we replay errors when diagnosing a constraint
satisfaction failure.  The default is -fconcepts-diagnostics-depth=1 which
diagnoses only the topmost constraint satisfaction failure and is consistent
with our behavior before this patch.  By increasing this flag's value, the user
can control how deeply they want the compiler to explain a constraint
satisfaction error.

For example, if the unsatisfied constraint is a disjunction, then the default
behavior is to just say "no branch in the disjunction is satisfied", but with
-fconcepts-diagnostics-depth=2 we will additionally replay and diagnose the
error in each branch of the disjunction.  And if the unsatisfied constraint is a
requires expression, then we will replay the error in the requires expression,
etc.  This proceeds recursively until there is nothing more to replay or we
exceeded the maximum depth specified by the flag.

Implementation wise, this patch essentially just uncomments the existing
commented-out code that performs the error-replaying, and along the way adds
logic to keep track of and limit the current replay depth.  Besides that, there
is a new routine collect_operands_of_disjunction which flattens a disjunction
and collects all of its operands into a vector.

The extra diagnostics enabled by this flag are at times longer than they need to
be (e.g.  "the operand is_array_v<...> is unsatisfied because \n the expression
is_array_v<...> [with ...] evaluated to false") and not immediately easy to
follow (especially when there are nested disjunctions), but the transparency
provided by these optional diagnostics seems to be pretty helpful in practice.

gcc/c-family/ChangeLog:

* c.opt: Add -fconcepts-diagnostics-depth.

gcc/cp/ChangeLog:

* constraint.cc (finish_constraint_binary_op): Set the location of EXPR
as well as its range, because build_x_binary_op doesn't always do so.
(current_constraint_diagnosis_depth): New.
(concepts_diagnostics_max_depth_exceeded_p): New.
(collect_operands_of_disjunction): New.
(satisfy_disjunction): When diagnosing a satisfaction failure, maybe
replay each branch of the disjunction, subject to the current diagnosis
depth.
(diagnose_valid_expression): When diagnosing a satisfaction failure,
maybe replay the substitution error, subject to the current diagnosis
recursion.
(diagnose_valid_type): Likewise.
(diagnose_nested_requiremnet): Likewise.
(diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
current_constraint_diagnosis_depth when diagnosing.
(diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
current_constraint_diagnosis_depth when diagnosing.
(diagnosing_failed_constraint::replay_errors_p): New static member
function.
(diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
is 0.  Emit a one-off note to increase -fconcepts-diagnostics-depth if
the limit was exceeded.
* cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.

gcc/testsuite/ChangeLog:

* g++.dg/concepts/diagnostic2.C: Expect "no operand" instead of
"neither operand".
* g++.dg/concepts/diagnostic5.C: New test.

4 years agoc: After issuing errors about array size, for error-recovery don't make the array...
Jakub Jelinek [Sat, 28 Mar 2020 09:30:31 +0000 (10:30 +0100)]
c: After issuing errors about array size, for error-recovery don't make the array VLA [PR93573]

After we report various errors about array size, we set for error-recovery
the size to be 1, but because size_int_const is false, it still means we
pretend the array is a VLA, can emit a second diagnostics in that case etc.
E.g.
$ ./cc1.unpatched -quiet a.c
a.c:1:5: error: size of array ‘f’ has non-integer type
    1 | int f[100.0];
      |     ^
a.c:1:1: warning: variably modified ‘f’ at file scope
    1 | int f[100.0];
      | ^~~
$ ./cc1 -quiet a.c
a.c:1:5: error: size of array ‘f’ has non-integer type
    1 | int f[100.0];
      |     ^

2020-03-28  Jakub Jelinek  <jakub@redhat.com>

PR c/93573
* c-decl.c (grokdeclarator): After issuing errors, set size_int_const
to true after setting size to integer_one_node.

* gcc.dg/pr93573-1.c: New test.
* gcc.dg/pr93573-2.c: New test.

4 years agoreassoc: Fix -fcompare-debug bug in reassociate_bb [PR94329]
Jakub Jelinek [Sat, 28 Mar 2020 09:21:52 +0000 (10:21 +0100)]
reassoc: Fix -fcompare-debug bug in reassociate_bb [PR94329]

The following testcase FAILs with -fcompare-debug, because reassociate_bb
mishandles the case when the last stmt in a bb has zero uses.  In that case
reassoc_remove_stmt (like gsi_remove) moves the iterator to the next stmt,
i.e. gsi_end_p is true, which means the code sets the iterator back to
gsi_last_bb.  The problem is that the for loop does gsi_prev on that before
handling the next statement, which means the former penultimate stmt, now
last one, is not processed by reassociate_bb.
Now, with -g, if there is at least one debug stmt at the end of the bb,
reassoc_remove_stmt moves the iterator to that following debug stmt and we
just do gsi_prev and continue with the former penultimate non-debug stmt,
now last non-debug stmt.

The following patch fixes that by not doing the gsi_prev in this case; there
are too many continue; cases, so I didn't want to copy over the gsi_prev to
all of them, so this patch uses a bool for that instead.  The second
gsi_end_p check isn't needed anymore, because when we don't do the
undesirable gsi_prev after gsi = gsi_last_bb, the loop !gsi_end_p (gsi)
condition will catch the removal of the very last stmt from a bb.

2020-03-28  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/94329
* tree-ssa-reassoc.c (reassociate_bb): When calling reassoc_remove_stmt
on the last stmt in a bb, make sure gsi_prev isn't done immediately
after gsi_last_bb.

* gfortran.dg/pr94329.f90: New test.

4 years agoDaily bump.
GCC Administrator [Sat, 28 Mar 2020 00:16:20 +0000 (00:16 +0000)]
Daily bump.

4 years agolibstdc++: Define __cpp_lib_ranges macro for C++20
Jonathan Wakely [Fri, 27 Mar 2020 23:21:58 +0000 (23:21 +0000)]
libstdc++: Define __cpp_lib_ranges macro for C++20

Define the feature test macro now that ranges support is complete.

This also changes the preprocessor checks for the __cpp_concepts macro
so that library components depending on concepts are only enabled when
C++20 concepts are supported, and not just for the Concepts TS (which
uses different syntax in places).

* include/bits/range_cmp.h (__cpp_lib_ranges): Define.
* include/bits/stl_iterator.h: Check value of __cpp_concepts so that
C++20 concepts are required.
* include/bits/stl_iterator_base_types.h: Likewise.
* include/std/concepts: Likewise.
* include/std/version: Likewise.
* testsuite/std/ranges/headers/ranges/synopsis.cc: Check feature test
macro.

4 years agolibstdc++: Add remaining C++20 changes to iterator adaptors
Jonathan Wakely [Fri, 27 Mar 2020 23:21:58 +0000 (23:21 +0000)]
libstdc++: Add remaining C++20 changes to iterator adaptors

This adds the missing parts of P0896R4 to reverse_iterator and
move_iterator, so that they meet the C++20 requirements. This should be
the last piece of P0896R4, meaning ranges support is now complete.

The PR 94354 bug with reverse_iterator's comparisons is fixed for C++20
only, but that change should be extended to C++11, C++14 and C++17 modes
in stage 1.

* include/bits/stl_iterator.h (reverse_iterator::iterator_concept)
(reverse_iterator::iterator_category): Define for C++20.
(reverse_iterator): Define comparison operators correctly for C++20.
(__normal_iterator): Add constraints to comparison operators for C++20.
(move_iterator::operator++(int)) [__cpp_lib_concepts]: Define new
overload for input iterators.
(move_iterator): Add constraints to comparison operators for C++20.
Define operator<=> for C++20.
* testsuite/24_iterators/move_iterator/input_iterator.cc: New test.
* testsuite/24_iterators/move_iterator/move_only.cc: New test.
* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc: New test.
* testsuite/24_iterators/reverse_iterator/rel_ops_c++20.cc: New test.

4 years agolibstdc++: Implement C++20 changes to insert iterators
Jonathan Wakely [Fri, 27 Mar 2020 23:21:58 +0000 (23:21 +0000)]
libstdc++: Implement C++20 changes to insert iterators

std::insert_iterator and std::inserter need to be adjusted for C++20, so
that they use ranges::iterator_t. That alias template requires
ranges::begin to be defined. Rather than moving the whole of
ranges::begin (and related details like ranges::enable_borrowed_range)
into <iterator>, this defines a new, simpler version of ranges::begin
that is sufficient for ranges::iterator_t to be defined. This works
because ranges::iterator_t uses an lvalue reference type, so the logic
in ranges::begin for non-lvalue ranges (i.e. borrowed ranges) isn't
needed.

This also adds the missing constexpr specifiers to the other insert
iterators.

* include/bits/iterator_concepts.h (__detail::__decay_copy)
(__detail::__member_begin, __detail::__adl_begin): Move here from
<bits/range_access.h>.
(__detail::__ranges_begin, __detail::__range_iter_t): Define.
* bits/range_access.h (__cust_access::__decay_copy)
(__cust_access::__member_begin, __cust_access::__adl_begin): Move to
<bits/iterator_concepts.h>.
(ranges::iterator_t): Use __detail::__range_iter_t.
* include/bits/stl_iterator.h (back_insert_iterator): Simplify
conditional compilation. Add _GLIBCXX20_CONSTEXPR to all members.
(front_insert_iterator): Likewise.
(insert_iterator): Implement changes from P0896R4 for C++20.
* testsuite/24_iterators/back_insert_iterator/constexpr.cc: New test.
* testsuite/24_iterators/front_insert_iterator/constexpr.cc: New test.
* testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Adjust
for inclusion in synopsis_c++20.cc which expects different signatures
for some function templates.
* testsuite/24_iterators/insert_iterator/constexpr.cc: New test.

4 years agolibstdc++: Move definition earlier in file
Jonathan Wakely [Fri, 27 Mar 2020 22:53:04 +0000 (22:53 +0000)]
libstdc++: Move definition earlier in file

This moves __is_array_convertible so it's not between
__is_nothrow_convertible and its helper, since it isn't related to
those.

* include/std/type_traits (__is_array_convertible): Move definition
to immediately after is_convertible.

4 years agoUpdate gcc de.po.
Joseph Myers [Fri, 27 Mar 2020 22:34:08 +0000 (22:34 +0000)]
Update gcc de.po.

4 years ago[RS6000] PR94145, make PLT loads volatile
Alan Modra [Wed, 11 Mar 2020 10:52:37 +0000 (21:22 +1030)]
[RS6000] PR94145, make PLT loads volatile

The PLT is volatile.  On PowerPC it is a bss style section which the
dynamic loader initialises to point at resolver stubs (called glink on
PowerPC64) to support lazy resolution of function addresses.  The
first call to a given function goes via the dynamic loader symbol
resolver, which updates the PLT entry for that function and calls the
function.  The second call, if there is one and we don't have a
multi-threaded race, will use the updated PLT entry and thus avoid
the relatively slow symbol resolver path.

Calls via the PLT are like calls via a function pointer, except that
no initialised function pointer is volatile like the PLT.  All
initialised function pointers are resolved at program startup to point
at the function or are left as NULL.  There is no support for lazy
resolution of any user visible function pointer.

So why does any of this matter to gcc?  Well, normally the PLT call
mechanism happens entirely behind gcc's back, but since we implemented
inline PLT calls (effectively putting the PLT code stub that loads the
PLT entry inline and making that code sequence scheduled), the load of
the PLT entry is visible to gcc.  That load then is subject to gcc
optimization, for example in

/* -S -mcpu=future -mpcrel -mlongcall -O2.  */
int foo (int);
void bar (void)
{
  while (foo(0))
    foo (99);
}

we see the PLT load for foo being hoisted out of the loop and stashed
in a call-saved register.  If that happens to be the first call to
foo, then the stashed value is that for the resolver stub, and every
call to foo in the loop will then go via the slow resolver path.  Not
a good idea.  Also, if foo turns out to be a local function and the
linker replaces the PLT calls with direct calls to foo then gcc has
just wasted a call-saved register.

This patch teaches gcc that the PLT loads are volatile.  The change
doesn't affect other loads of function pointers and thus has no effect
on normal indirect function calls.  Note that because the
"optimization" this patch prevents can only occur over function calls,
the only place gcc can stash PLT loads is in call-saved registers or
in other memory.  I'm reasonably confident that this change will be
neutral or positive for the "ld -z now" case where the PLT is not
volatile, in code where there is any register pressure.  Even if gcc
could be taught to recognise cases where the PLT is resolved, you'd
need to discount use of registers to cache PLT loads by some factor
involving the chance that those calls would be converted to direct
calls.

PR target/94145
* config/rs6000/rs6000.c (rs6000_longcall_ref): Use unspec_volatile
for PLT16_LO and PLT_PCREL.
* config/rs6000/rs6000.md (UNSPEC_PLT16_LO, UNSPEC_PLT_PCREL): Remove.
(UNSPECV_PLT16_LO, UNSPECV_PLT_PCREL): Define.
(pltseq_plt16_lo_, pltseq_plt_pcrel): Use unspec_volatile.

4 years agoc++: Handle COMPOUND_EXPRs in ocp_convert [PR94339]
Jakub Jelinek [Fri, 27 Mar 2020 21:29:50 +0000 (22:29 +0100)]
c++: Handle COMPOUND_EXPRs in ocp_convert [PR94339]

With the PR94346 fix in, we can revert the attr-copy-2.C workaround.

2020-03-27  Jakub Jelinek  <jakub@redhat.com>

PR c++/94339
* g++.dg/ext/attr-copy-2.C: Revert the last changes.

4 years agoPR c++/94346 - [9/10 Regression] ICE due to handle_copy_attribute since r9-3982
Martin Sebor [Fri, 27 Mar 2020 20:24:03 +0000 (14:24 -0600)]
PR c++/94346 - [9/10 Regression] ICE due to handle_copy_attribute since r9-3982

gcc/c-family/ChangeLog:

PR c++/94346
* c-attribs.c (handle_copy_attribute): Avoid passing expressions
to decl_attributes.  Make handling of different kinds of entities
more robust.

gcc/c-c++-common/ChangeLog:

PR c++/94346
* c-c++-common/attr-copy.c: New test.

4 years ago[pr84733] Fix ICE popping local scope
Nathan Sidwell [Fri, 27 Mar 2020 20:09:12 +0000 (13:09 -0700)]
[pr84733]  Fix ICE popping local scope

PR c++/84733
* name-lookup.c (do_pushdecl): Look through cleanp levels.

4 years agoPR c++/94098 - ICE on attribute access redeclaration
Martin Sebor [Fri, 27 Mar 2020 19:54:22 +0000 (13:54 -0600)]
PR c++/94098 - ICE on attribute access redeclaration

gcc/c-family/ChangeLog:

PR c++/94098
* c-attribs.c (handle_access_attribute): Avoid setting TYPE_ATTRIBUTES
here.

gcc/ChangeLog:

PR c++/94098
* calls.c (init_attr_rdwr_indices): Iterate over all access attributes.

gcc/testsuite/ChangeLog:

PR c++/94098
* g++.dg/ext/attr-access-2.C: New test.

4 years agoamdgcn: refactor mode iterators
Andrew Stubbs [Tue, 17 Mar 2020 12:58:14 +0000 (12:58 +0000)]
amdgcn: refactor mode iterators

The iterative addition of 8 and 16 bit vectors has left the mode iterators in a
bit of a mess.  Also, the original names were rather verbose leading to
formatting difficulties.

This patch renames all the vector modes such that they are shorter and tidier.
It does not change the output machine description at all.

2020-03-27  Andrew Stubbs  <ams@codesourcery.com>

gcc/
* config/gcn/gcn-valu.md:
(VEC_SUBDWORD_MODE): Rename to V_QIHI throughout.
(VEC_1REG_MODE): Delete.
(VEC_1REG_ALT): Delete.
(VEC_ALL1REG_MODE): Rename to V_1REG throughout.
(VEC_1REG_INT_MODE): Delete.
(VEC_ALL1REG_INT_MODE): Rename to V_INT_1REG throughout.
(VEC_ALL1REG_INT_ALT): Rename to V_INT_1REG_ALT throughout.
(VEC_2REG_MODE): Rename to V_2REG throughout.
(VEC_REG_MODE): Rename to V_noHI throughout.
(VEC_ALLREG_MODE): Rename to V_ALL throughout.
(VEC_ALLREG_ALT):  Rename to V_ALL_ALT throughout.
(VEC_ALLREG_INT_MODE): Rename to V_INT throughout.
(VEC_INT_MODE): Delete.
(VEC_FP_MODE): Rename to V_FP throughout and move to top.
(VEC_FP_1REG_MODE): Rename to V_FP_1REG throughout and move to top.
(FP_MODE): Delete and replace with FP throughout.
(FP_1REG_MODE): Delete and replace with FP_1REG throughout.
(VCMP_MODE): Rename to V_noQI throughout and move to top.
(VCMP_MODE_INT): Rename to V_INT_noQI throughout and move to top.
* config/gcn/gcn.md (FP): New mode iterator.
(FP_1REG): New mode iterator.

4 years agoc++: avoid -Wredundant-tags on a first declaration in use [PR 93824]
Martin Sebor [Fri, 27 Mar 2020 16:07:45 +0000 (12:07 -0400)]
c++: avoid -Wredundant-tags on a first declaration in use [PR 93824]

-Wredundant-tags doesn't consider type declarations that are also
the first uses of the type, such as in 'void f (struct S);' and
issues false positives for those.  According to the reported that's
making it harder to use the warning to clean up LibreOffice.

The attached patch extends -Wredundant-tags to avoid these false
positives by relying on the same class_decl_loc_t::class2loc mapping
as -Wmismatched-tags.  The patch also improves the detection
of both issues in template declarations.

gcc/cp/ChangeLog
2020-03-27  Martin Sebor  <msebor@redhat.com>

PR c++/94078
PR c++/93824
PR c++/93810
* cp-tree.h (most_specialized_partial_spec): Declare.
* parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
from declarations.
(specialization_of): New function.
(cp_parser_check_class_key): Move code...
(class_decl_loc_t::add): ...to here.  Add parameters.  Avoid issuing
-Wredundant-tags on first-time declarations in other declarators.
Correct handling of template specializations.
(class_decl_loc_t::diag_mismatched_tags): Also expect to be called
when -Wredundant-tags is enabled.  Use primary template or partial
specialization as the guide for uses of implicit instantiations.
* pt.c (most_specialized_partial_spec): Declare extern.

gcc/testsuite/ChangeLog
2020-03-27  Martin Sebor  <msebor@redhat.com>

PR c++/94078
PR c++/93824
PR c++/93810
* g++.dg/warn/Wmismatched-tags-3.C: New test.
* g++.dg/warn/Wmismatched-tags-4.C: New test.
* g++.dg/warn/Wmismatched-tags-5.C: New test.
* g++.dg/warn/Wmismatched-tags-6.C: New test.
* g++.dg/warn/Wredundant-tags-3.C: Remove xfails.
* g++.dg/warn/Wredundant-tags-6.C: New test.
* g++.dg/warn/Wredundant-tags-7.C: New test.

4 years agoc++: Fix ICE after ambiguous inline namespace reopen [PR94257]
Nathan Sidwell [Fri, 27 Mar 2020 14:54:33 +0000 (07:54 -0700)]
c++: Fix ICE after ambiguous inline namespace reopen [PR94257]

Following DR2061, 'namespace F', looks for 'F's inside inline namespaces.
That can result in ambiguous lookups that we failed to diagnose early enough,
leading us to push a new namespace and ICE later.  Diagnose the ambiguity
earlier, and then pick one.

PR c++/94257
* name-lookup.c (push_namespace): Triage ambiguous lookups that
contain namespaces.

4 years agoanalyzer: fix malloc pointer NULL-ness
David Malcolm [Thu, 26 Mar 2020 13:42:25 +0000 (09:42 -0400)]
analyzer: fix malloc pointer NULL-ness

Fixes to exploded_path::feasible_p exposed a pre-existing bug
with pointer NULL-ness for pointers to symbolic_region.

symbolic_region has an "m_possibly_null" flag which if set means
that a region_svalue pointing to that region is treated as possibly
NULL.  Adding a constraint of "!= NULL" on an edge records that
the pointer is non-NULL, but doesn't affect other pointers (e.g.
if the first if a void *, but the other pointers are cast to other
pointer types).  This showed up in the tests
gcc.dg/analyzer/data-model-5b.c and -5c.c, which malloc a buffer
and test for NULL, but then cast that to a struct * and later test
that struct *: a path for the first test being non-NULL and the
second being NULL was erroneously found to be feasible.

This patch clears the m_possibly_null flag when a "!= NULL" constraint
is added, fixing that erroneous path (but not yet fixing the false
positive in the above tests, which seems to go on to hit a different
issue).  It also adds the field to dumps.

gcc/analyzer/ChangeLog:
* program-state.cc (selftest::test_program_state_dumping): Update
expected dump to include symbolic_region's possibly_null field.
* region-model.cc (symbolic_region::print_fields): New vfunc
implementation.
(region_model::add_constraint): Clear m_possibly_null from
symbolic_regions now known to be non-NULL.
(selftest::test_malloc_constraints): New selftest.
(selftest::analyzer_region_model_cc_tests): Call it.
* region-model.h (region::dyn_cast_symbolic_region): Add non-const
overload.
(symbolic_region::dyn_cast_symbolic_region): Implement it.
(symbolic_region::print_fields): New vfunc override decl.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/data-model-5b.c: Add xfail for new false
positive leak.
* gcc.dg/analyzer/data-model-5c.c: Likewise.
* gcc.dg/analyzer/malloc-5.c: New test.

4 years agoanalyzer: add new supergraph visualization
David Malcolm [Fri, 20 Mar 2020 18:28:05 +0000 (14:28 -0400)]
analyzer: add new supergraph visualization

This patch extends -fdump-analyzer-supergraph so that rather than just
dumping a DUMP_BASE_NAME.supergraph.dot at the start of analysis, it
also dumps a DUMP_BASE_NAME.supergraph-eg.dot at the end.

The new dump file contains a concise dump of the exploded_graph,
organized with respect to the supergraph and its statements.  The
exploded nodes are colorized to show sm-state, but no other state
is shown.  Per exploded_node saved_diagnostics are also shown,
along with feasibility of the paths to reach them.

I've been finding this a useful way of tracking down issues in
exploded_graphs that are sufficiently large that the output of
-fdump-analyzer-exploded-graph becomes unwieldy.

The patch extends feasiblity-testing so that if the exploded_path
for a saved_diagnostic is found to be infeasible, the reason is
saved and written into the saved_diagnostic, so it can be shown in the
dump.  I've found this very useful when tracking down feasibility
issues.

I'm keeping the initial dump file as it's useful when tracking down
ICEs within the analyzer (which would stop the second dump file being
written).

gcc/analyzer/ChangeLog:
* analyzer.h (class feasibility_problem): New forward decl.
* diagnostic-manager.cc (saved_diagnostic::saved_diagnostic):
Initialize new fields m_status, m_epath_length, and m_problem.
(saved_diagnostic::~saved_diagnostic): Delete m_problem.
(dedupe_candidate::dedupe_candidate): Convert "sd" param from a
const ref to a mutable ptr.
(dedupe_winners::add): Convert "sd" param from a const ref to a
mutable ptr.  Record the length of the exploded_path.  Record the
feasibility/infeasibility of sd into sd, capturing a
feasibility_problem when feasible_p fails, and storing it in sd.
(diagnostic_manager::emit_saved_diagnostics): Update for pass by
ptr rather than by const ref.
* diagnostic-manager.h (class saved_diagnostic): Add new enum
status.  Add fields m_status, m_epath_length and m_problem.
(saved_diagnostic::set_feasible): New member function.
(saved_diagnostic::set_infeasible): New member function.
(saved_diagnostic::get_feasibility_problem): New accessor.
(saved_diagnostic::get_status): New accessor.
(saved_diagnostic::set_epath_length): New member function.
(saved_diagnostic::get_epath_length): New accessor.
* engine.cc: Include "gimple-pretty-print.h".
(exploded_path::feasible_p): Add OUT param and, if non-NULL, write
a new feasibility_problem to it on failure.
(viz_callgraph_node::dump_dot): Convert begin_tr calls to
begin_trtd.  Convert end_tr calls to end_tdtr.
(class exploded_graph_annotator): New subclass of dot_annotator.
(impl_run_checkers): Add a second -fdump-analyzer-supergraph dump
after the analysis runs, using exploded_graph_annotator. dumping
to DUMP_BASE_NAME.supergraph-eg.dot.
* exploded-graph.h (exploded_node::get_dot_fillcolor): Make
public.
(exploded_path::feasible_p): Add OUT param.
(class feasibility_problem): New class.
* state-purge.cc (state_purge_annotator::add_node_annotations):
Return a bool, add a "within_table" param.
(print_vec_of_names): Convert begin_tr calls to begin_trtd.
Convert end_tr calls to end_tdtr.
(state_purge_annotator::add_stmt_annotations): Add "within_row"
param.
* state-purge.h ((state_purge_annotator::add_node_annotations):
Return a bool, add a "within_table" param.
(state_purge_annotator::add_stmt_annotations): Add "within_row"
param.
* supergraph.cc (supernode::dump_dot): Call add_node_annotations
twice: as before, passing false for "within_table", then again
with true when within the TABLE element.  Convert some begin_tr
calls to begin_trtd, and some end_tr calls to end_tdtr.
Repeat each add_stmt_annotations call, distinguishing between
calls that add TRs and those that add TDs to an existing TR.
Add a call to add_after_node_annotations.
* supergraph.h (dot_annotator::add_node_annotations): Add a
"within_table" param.
(dot_annotator::add_stmt_annotations): Add a "within_row" param.
(dot_annotator::add_after_node_annotations): New vfunc.

gcc/ChangeLog:
* doc/invoke.texi (-fdump-analyzer-supergraph): Document that this
now emits two .dot files.
* graphviz.cc (graphviz_out::begin_tr): Only emit a TR, not a TD.
(graphviz_out::end_tr): Only close a TR, not a TD.
(graphviz_out::begin_td): New.
(graphviz_out::end_td): New.
(graphviz_out::begin_trtd): New, replacing the old implementation
of graphviz_out::begin_tr.
(graphviz_out::end_tdtr): New, replacing the old implementation
of graphviz_out::end_tr.
* graphviz.h (graphviz_out::begin_td): New decl.
(graphviz_out::end_td): New decl.
(graphviz_out::begin_trtd): New decl.
(graphviz_out::end_tdtr): New decl.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/dot-output.c: Check that
dot-output.c.supergraph-eg.dot is valid.

4 years agoanalyzer: improvements to diagnostic-manager.cc logging
David Malcolm [Fri, 20 Mar 2020 19:16:00 +0000 (15:16 -0400)]
analyzer: improvements to diagnostic-manager.cc logging

gcc/analyzer/ChangeLog:
* diagnostic-manager.cc (dedupe_winners::add): Show the
exploded_node index in the log messages.
(diagnostic_manager::emit_saved_diagnostics): Log a summary of
m_saved_diagnostics at entry.

4 years agoanalyzer: tweaks to superedge::dump
David Malcolm [Thu, 19 Mar 2020 14:13:25 +0000 (10:13 -0400)]
analyzer: tweaks to superedge::dump

gcc/analyzer/ChangeLog:
* supergraph.cc (superedge::dump): Add space before description;
move newline to non-pretty_printer overload.

4 years agodebug/94273 - avoid creating type DIEs for DINFO_LEVEL_TERSE
Richard Biener [Fri, 27 Mar 2020 12:57:42 +0000 (13:57 +0100)]
debug/94273 - avoid creating type DIEs for DINFO_LEVEL_TERSE

This avoids completing types for DINFO_LEVEL_TERSE by using
the should_emit_struct_debug machinery.

2020-03-27  Richard Biener  <rguenther@suse.de>

PR debug/94273
* dwarf2out.c (should_emit_struct_debug): Return false for
DINFO_LEVEL_TERSE.

* g++.dg/debug/pr94273.C: New testcase.

4 years agotree-optimization/94352 - fix uninitialized use of curr_order
Richard Biener [Fri, 27 Mar 2020 12:52:31 +0000 (13:52 +0100)]
tree-optimization/94352 - fix uninitialized use of curr_order

This fixes a (harmless) use of a not re-initialized curr_order.

2020-03-27  Richard Biener  <rguenther@suse.de>

PR tree-optimization/94352
* tree-ssa-propagate.c (ssa_prop_init): Move seeding of the
worklist ...
(ssa_propagation_engine::ssa_propagate): ... here after
initializing curr_order.

4 years ago[Fortran] Fix ICE with deferred-rank arrays (PR93957)
Tobias Burnus [Fri, 27 Mar 2020 11:12:36 +0000 (12:12 +0100)]
[Fortran] Fix ICE with deferred-rank arrays (PR93957)

PR fortran/93957
* trans-array.c (gfc_alloc_allocatable_for_assignment): Accept
nonallocatable, nonpointer deferred-rank arrays.

PR fortran/93957
* gfortran.dg/assumed_rank_19.f90: New.

4 years agoFix PR90332 by extending half size vector mode
Kewen Lin [Fri, 27 Mar 2020 09:51:12 +0000 (04:51 -0500)]
Fix PR90332 by extending half size vector mode

As PR90332 shows, the current scalar epilogue peeling for gaps
elimination requires expected vec_init optab with two half size
vector mode.  On Power, we don't support vector mode like V8QI,
so can't support optab like vec_initv16qiv8qi.  But we want to
leverage existing scalar mode like DI to init the desirable
vector mode.  This patch is to extend the existing support for
Power, as evaluated on Power9 we can see expected 1.9% speed up
on SPEC2017 525.x264_r.

As Richi suggested, add one function vector_vector_composition_type
to refactor existing related codes and also make use of it further.

Bootstrapped/regtested on powerpc64le-linux-gnu (LE) P8 and P9,
as well as x86_64-redhat-linux.

gcc/ChangeLog

2020-03-27  Kewen Lin  <linkw@gcc.gnu.org>

    PR tree-optimization/90332
    * tree-vect-stmts.c (vector_vector_composition_type): New function.
    (get_group_load_store_type): Adjust to call vector_vector_composition_type,
    extend it to construct with scalar types.
    (vectorizable_load): Likewise.

4 years agofixup: move ChangeLog entry for last Arm fix to correct file.
Richard Earnshaw [Fri, 27 Mar 2020 10:25:51 +0000 (10:25 +0000)]
fixup: move ChangeLog entry for last Arm fix to correct file.

PR target/94220

4 years agofixup: move ChangeLog entry for last Arm fix to correct file.
Richard Earnshaw [Fri, 27 Mar 2020 10:23:38 +0000 (10:23 +0000)]
fixup: move ChangeLog entry for last Arm fix to correct file.

PR target/94220

4 years agoFortran] Reject invalid association target (PR93363)
Tobias Burnus [Fri, 27 Mar 2020 09:56:25 +0000 (10:56 +0100)]
Fortran] Reject invalid association target (PR93363)

PR fortran/93363
* resolve.c (resolve_assoc_var): Reject association to DT and
function name.

PR fortran/93363
* gfortran.dg/associate_51.f90: Fix test case.
* gfortran.dg/associate_53.f90: New.

4 years agoc++: Avoid calls in non-evaluated contexts affect whether function can or can't throw...
Jakub Jelinek [Fri, 27 Mar 2020 09:04:31 +0000 (10:04 +0100)]
c++: Avoid calls in non-evaluated contexts affect whether function can or can't throw [PR94326]

The following testcase FAILs -fcompare-debug, because if we emit a
-Wreturn-local-addr warning, we tsubst decltype in order to print the
warning and as that function could throw, set_flags_from_callee during that
sets cp_function_chain->can_throw and later on we don't set TREE_NOTHROW
on foo.  While with -w or -Wno-return-local-addr, tsubst isn't called during
the warning_at, cp_function_chain->can_throw is kept clear and TREE_NOTHROW
is set on foo.
It isn't just a matter of the warning though, in
int foo ();
int bar () { return sizeof (foo ()); }
int baz () { return sizeof (int); }
I don't really see why we should mark only baz as TREE_NOTHROW and not bar
too, when neither can really throw.

2020-03-27  Jakub Jelinek  <jakub@redhat.com>

PR c++/94326
* call.c (set_flags_from_callee): Don't update
cp_function_chain->can_throw or current_function_returns_abnormally
if cp_unevaluated_operand.

* g++.dg/other/pr94326.C: New test.

4 years agoc++: Handle COMPOUND_EXPRs in ocp_convert [PR94339]
Jakub Jelinek [Fri, 27 Mar 2020 09:00:47 +0000 (10:00 +0100)]
c++: Handle COMPOUND_EXPRs in ocp_convert [PR94339]

My recent change to get_narrower/warnings_for_convert_and_check broke
the following testcase, warnings_for_convert_and_check is upset that
expr is a COMPOUND_EXPR with INTEGER_CST at the rightmost operand, while
result is a COMPOUND_EXPR with a NOP_EXPR of INTEGER_CST at the rightmost
operand, it expects such conversions to be simplified.

The easiest fix seems to be to handle COMPOUND_EXPRs in ocp_convert too,
by converting the rightmost operand and recreating COMPOUND_EXPR(s) if that
changed.

The attr-copy-2.C change is a workaround for PR94346, where we now ICE on
the testcase, while previously we'd ICE only if it contained a comma
expression at the outer level rather than cast of a COMPOUND_EXPR to
something.  I'll defer that to Martin.

2020-03-27  Jakub Jelinek  <jakub@redhat.com>

PR c++/94339
* cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
operand and creating a new COMPOUND_EXPR if anything changed.

* g++.dg/other/pr94339.C: New test.
* g++.dg/ext/attr-copy-2.C: Comment out failing tests due to PR94346.

4 years agomodulo-sched: fix bootstrap compare-debug issue
Roman Zhuykov [Fri, 27 Mar 2020 05:02:56 +0000 (08:02 +0300)]
modulo-sched: fix bootstrap compare-debug issue

This patch removes all debug insns from DDG analysis.  It fixes bootstrap
comparison failure on powerpc64le when running with -fmodulo-sched enabled.

* ddg.c (create_ddg_dep_from_intra_loop_link): Remove assertions.
(create_ddg_dep_no_link): Likewise.
(add_cross_iteration_register_deps): Move debug instruction check.
Other minor refactoring.
(add_intra_loop_mem_dep): Do not check for debug instructions.
(add_inter_loop_mem_dep): Likewise.
(build_intra_loop_deps): Likewise.
(create_ddg): Do not include debug insns into the graph.
* ddg.h (struct ddg): Remove num_debug field.
* modulo-sched.c (doloop_register_get): Adjust condition.
(res_MII): Remove DDG num_debug field usage.
(sms_schedule_by_order): Use assertion against debug insns.
(ps_has_conflicts): Drop debug insn check.

testsuite:

     * gcc.c-torture/execute/pr70127-debug-sms.c: New test.
     * gcc.dg/torture/pr87197-debug-sms.c: New test.

4 years agoc++: template keyword accepted before destructor names [PR94336]
Marek Polacek [Thu, 26 Mar 2020 20:07:17 +0000 (16:07 -0400)]
c++: template keyword accepted before destructor names [PR94336]

This came up on the C++ core list recently.  We don't diagnose the case
when 'template' is followed by a destructor name which is not permitted
by [temp.names]/5.

PR c++/94336 - template keyword accepted before destructor names.
* parser.c (cp_parser_unqualified_id): Give an error when 'template'
is followed by a destructor name.

* g++.dg/template/template-keyword2.C: New test.

4 years agoc++: Remove redundant calls to type_dependent_expression_p
Patrick Palka [Wed, 25 Mar 2020 03:58:23 +0000 (23:58 -0400)]
c++: Remove redundant calls to type_dependent_expression_p

This simplifies conditions that test both value_dependent_expression_p and
type_dependent_expression_p, since the former predicate now subsumes the latter.

gcc/cp/ChangeLog:

* decl.c (compute_array_index_type_loc): Remove redundant
type_dependent_expression_p check that is subsumed by
value_dependent_expression_p.
* decl2.c (is_late_template_attribute): Likewise.
* pt.c (uses_template_parms): Likewise.
(dependent_template_arg_p): Likewise.

4 years agocoroutines, testsuite: Fix symmetric-transfer-00-basic.C on Linux.
Iain Sandoe [Fri, 27 Mar 2020 00:12:01 +0000 (00:12 +0000)]
coroutines, testsuite: Fix symmetric-transfer-00-basic.C on Linux.

In order for the test output to work we need to include
cstdio.

2020-03-27  Iain Sandoe  <iain@sandoe.co.uk>

* g++.dg/coroutines/torture/symmetric-transfer-00-basic.C:
Add <cstdio>.

4 years agoDaily bump.
GCC Administrator [Fri, 27 Mar 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.

4 years agoUpdate gcc .po files.
Joseph Myers [Thu, 26 Mar 2020 22:48:13 +0000 (22:48 +0000)]
Update gcc .po files.

* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
zh_TW.po: Update.

4 years agoc++: DR1710, template keyword in a typename-specifier [PR94057]
Marek Polacek [Wed, 18 Mar 2020 23:28:14 +0000 (19:28 -0400)]
c++: DR1710, template keyword in a typename-specifier [PR94057]

Consider

  template <typename T> class A {
    template <typename U> class B {
      void fn(typename A<T>::B<U>);
    };
  };

which is rejected with
error: 'typename A<T>::B' names 'template<class T> template<class U> class A<T>::B', which is not a type
whereas clang/icc/msvc accept it.

"typename A<T>::B<U>" is a typename-specifier.  Sadly, our comments
don't mention it anywhere, because the typename-specifier wasn't in C++11;
it was only added to the language in N1376.  Instead, we handle it as
an elaborated-type-specifier (not a problem thus far).   So we get to
cp_parser_nested_name_specifier_opt which has a loop that breaks if we
don't see a < or ::, but that means we can -- tentatively -- parse even
B<U> which is not a nested-name-specifier (it doesn't end with a ::).

I think this should compile because [temp.names]/4 says: "In a qualified-id
used as the name in a typename-specifier, elaborated-type-specifier,
using-declaration, or class-or-decltype, an optional keyword template
appearing at the top level is ignored.", added in DR 1710.  Also see
DR 1812.

This issue on its own is not a significant problem or a regression.
However, in C++20, the typename here becomes optional, and so this test
is rejected in C++20, but accepted in C++17:

  template <typename T> class A {
    template <typename U> class B {
      void fn(A<T>::B<U>);
    };
  };

Here we morph A<T>::B<U> into a typename-specifier, but that happens
in cp_parser_simple_type_specifier and we never handle it as above.
To fake the template keyword I'm afraid we need to use cp_parser_template_id
with template_keyword_p=true as in the patch below.  The tricky thing
is to avoid breaking concepts.

To handle DR 1710, I made cp_parser_nested_name_specifier_opt assume that
when we're naming a type, the template keyword is present, too.  That
revealed a bug: DR 1710 also says that the template keyword can be followed
by an alias template, but we weren't prepared to handle that.  alias-decl?.C
exercise this.

gcc/cp:

DR 1710
PR c++/94057 - template keyword in a typename-specifier.
* parser.c (check_template_keyword_in_nested_name_spec): New.
(cp_parser_nested_name_specifier_opt): Implement DR1710, optional
'template'.  Call check_template_keyword_in_nested_name_spec.
(cp_parser_simple_type_specifier): Assume that a <
following a qualified-id in a typename-specifier begins
a template argument list.

gcc/testsuite:

DR 1710
PR c++/94057 - template keyword in a typename-specifier.
* g++.dg/cpp1y/alias-decl1.C: New test.
* g++.dg/cpp1y/alias-decl2.C: New test.
* g++.dg/cpp1y/alias-decl3.C: New test.
* g++.dg/parse/missing-template1.C: Update dg-error.
* g++.dg/parse/template3.C: Likewise.
* g++.dg/template/error4.C: Likewise.
* g++.dg/template/meminit2.C: Likewise.
* g++.dg/template/dependent-name5.C: Likewise.
* g++.dg/template/dependent-name7.C: New test.
* g++.dg/template/dependent-name8.C: New test.
* g++.dg/template/dependent-name9.C: New test.
* g++.dg/template/dependent-name10.C: New test.
* g++.dg/template/dependent-name11.C: New test.
* g++.dg/template/dependent-name12.C: New test.
* g++.dg/template/dependent-name13.C: New test.
* g++.dg/template/dr1794.C: New test.
* g++.dg/template/dr314.C: New test.
* g++.dg/template/dr1710.C: New test.
* g++.dg/template/dr1710-2.C: New test.
* g++.old-deja/g++.pt/crash38.C: Update dg-error.

4 years agocoroutines: Implement n4849 recommended symmetric transfer.
Iain Sandoe [Thu, 26 Mar 2020 21:00:25 +0000 (21:00 +0000)]
coroutines: Implement n4849 recommended symmetric transfer.

Although the note in the text [expr.await] / 5.1.1 is not normative,
it is asserted by users that an implementation that is unable to
perform unlimited symmetric transfers is not terribly useful.

This relates to the following circumstance:

try {
 users-function-body:
 {
    ....
    { some suspend context
      continuation_handle = await_suspend (another handle);
      continuation_handle.resume ();
      'return' (actually a suspension operation).
    }
  }
} catch (...) {}

The call to 'continuation_handle.resume ()' needs to be a tail-
call in order that an arbitrary number of coroutines can be handled
in this manner.  There are two issues with this:

1. That the user's function body is wrapped in a try/catch block and
   one cannot tail-call from within those.

2. That GCC doesn't usually produce tail-calls when the optimisation
   level is < O2.

After considerable discussion at WG21 meetings, it has been determined
that the intent is that the operation behaves as if the resume call is
executed in the context of the caller.

So, we can remap the fragment above like this:

{
  void_coroutine_handle continuation;

  try {
   users-function-body:
   {
      ....
      { some suspend context
        continuation = await_suspend (another handle);
        <scope exit without cleanup> symmetric_transfer;
      }
    }
  } catch (...) {}

symmetric_transfer:
  continuation.resume(); [tail call] [must tail call]
}

Thus we take the call outside the try-catch block which solves
issue (1) and mark it as a tail call and as "must tail call" for
correctness which solves (2).

As bonuses, since we no longer need to differentiate handle types
returned from await_suspend() methods, nor do we need to keep them
in the coroutine frame, since they are ephemeral, we save entries in
the frame and reduce some code too.

gcc/cp/ChangeLog:

2020-03-26  Iain Sandoe  <iain@sandoe.co.uk>

* coroutines.cc (coro_init_identifiers): Initialize an identifier
for the cororoutine handle 'address' method name.
(struct coro_aw_data): Add fields to cover the continuations.
(co_await_expander): Determine the kind of await_suspend in use.
If we have the case that returns a continuation handle, then save
this and make the target for 'scope exit without cleanup' be the
continuation resume label.
(expand_co_awaits): Remove.
(struct suspend_point_info): Remove fields that kept the returned
await_suspend handle type.
(transform_await_expr): Remove code tracking continuation handles.
(build_actor_fn): Add the continuation handle as an actor-function
scope var.  Build the symmetric transfer continuation point. Call
the tree walk for co_await expansion directly, rather than via a
trivial shim function.
(register_await_info): Remove fields tracking continuation handles.
(get_await_suspend_return_type): Remove.
(register_awaits): Remove code tracking continuation handles.
(morph_fn_to_coro): Remove code tracking continuation handles.

gcc/testsuite/ChangeLog:

2020-03-26  Iain Sandoe  <iain@sandoe.co.uk>

* g++.dg/coroutines/torture/co-ret-09-bool-await-susp.C: Amend
to n4849 behaviour.
* g++.dg/coroutines/torture/symmetric-transfer-00-basic.C: New
test.

4 years agocoroutines: Implement n4849 changes to exception handling.
Iain Sandoe [Thu, 26 Mar 2020 20:17:13 +0000 (20:17 +0000)]
coroutines: Implement n4849 changes to exception handling.

The standard now calls up a revised mechanism to handle exceptions
where exceptions thrown by the await_resume () method of the
initial suspend expression are considered in the same manner as
exceptions thrown by the user-authored function body.

This implements [dcl.fct.def.coroutine] / 5.3.

gcc/cp/ChangeLog:

2020-03-26  Iain Sandoe  <iain@sandoe.co.uk>

* coroutines.cc (co_await_expander): If we are expanding the
initial await expression, set a boolean flag to show that we
have now reached the initial await_resume() method call.
(expand_co_awaits): Handle the 'initial await resume called' flag.
(build_actor_fn): Insert the initial await expression into the
start of the user-authored function-body. Handle the 'initial await
resume called' flag.
(morph_fn_to_coro): Initialise the 'initial await resume called'
flag.  Modify the unhandled exception catch clause to recognise
exceptions that occur before the initial await_resume() and re-
throw them.

gcc/testsuite/ChangeLog:

2020-03-26  Iain Sandoe  <iain@sandoe.co.uk>

* g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C: New test.

4 years agolibstdc++: Add some C++20 additions to <chrono>
Jonathan Wakely [Thu, 26 Mar 2020 14:00:12 +0000 (14:00 +0000)]
libstdc++: Add some C++20 additions to <chrono>

* include/std/chrono (chrono::days, chrono::weeks, chrono::years)
(chrono::months, chrono::sys_days, chrono::local_t)
(chrono::local_time, chrono::local_seconds, chrono::local_days):
Define for C++20.
(chrono::time_point): Add missing static assert.
* testsuite/20_util/time_point/requirements/duration_neg.cc: New test.
* testsuite/std/time/clock/file/overview.cc: New test.
* testsuite/std/time/clock/file/members.cc: New test.
* testsuite/std/time/syn_c++20.cc: New test.

4 years agoarm: unified syntax for libgcc when built with -Os [PR94220]
Richard Earnshaw [Tue, 24 Mar 2020 14:45:50 +0000 (14:45 +0000)]
arm: unified syntax for libgcc when built with -Os [PR94220]

The recent patch to convert all thumb1 code in libgcc to unified syntax
ommitted the conditional code that is used only when building the library
for minimal size.  This patch fixes this case.

I've also fixed the COND macro so that a single definition is always used
that is for unified syntax.  This eliminates a warning that is now being
seen from the assembler when compiling the ieee fp support code.

PR target/94220
* config/arm/lib1funcs.asm (COND): Use a single definition for
unified syntax.
(aeabi_uidivmod): Unified syntax when optimizing Thumb for size.
(aeabi_idivmod): Likewise.
(divsi3_skip_div0_test): Likewise.

4 years agoFix UNRESOLVED test-case.
Martin Liska [Thu, 26 Mar 2020 09:50:36 +0000 (10:50 +0100)]
Fix UNRESOLVED test-case.

* gcc.target/i386/pr81213.c: Do not scan assembler
and add one missing PR entry.

4 years agotree: Fix -fcompare-debug issues due to protected_set_expr_location [PR94323]
Jakub Jelinek [Thu, 26 Mar 2020 09:35:52 +0000 (10:35 +0100)]
tree: Fix -fcompare-debug issues due to protected_set_expr_location [PR94323]

The following testcase FAILs since recently when the C++ FE started calling
protected_set_expr_location more often.
With -g, it is called on a STATEMENT_LIST that contains a DEBUG_BEGIN_STMT
and CLEANUP_POINT_EXPR, and as STATEMENT_LISTs have !CAN_HAVE_LOCATION_P,
nothing is set.  Without -g, it is called instead on the CLEANUP_POINT_EXPR
directly and changes its location.

The following patch recurses on the single non-DEBUG_BEGIN_STMT statement
of a STATEMENT_LIST if any to make the two behave the same.

2020-03-26  Jakub Jelinek  <jakub@redhat.com>

PR debug/94323
* tree.c (protected_set_expr_location): Recurse on STATEMENT_LIST
that contains exactly one non-DEBUG_BEGIN_STMT statement.

* g++.dg/debug/pr94323.C: New test.

4 years agoSkip test for non-x86 targets.
Martin Liska [Thu, 26 Mar 2020 09:12:57 +0000 (10:12 +0100)]
Skip test for non-x86 targets.

PR testsuite/94334
* gcc.dg/lto/pr94271_0.c: Skip for non-x86 targets
and add ifunc effective target.
* gcc.target/i386/pr81213-2.c: Add ifunc effective target.

4 years agogimplify: Fix -fcompare-debug differences caused by gimplify_body [PR94281]
Jakub Jelinek [Thu, 26 Mar 2020 09:10:21 +0000 (10:10 +0100)]
gimplify: Fix -fcompare-debug differences caused by gimplify_body [PR94281]

The following testcase FAILs, because gimplify_body adds a GIMPLE_NOP only
when there are no statements in the function and with -g there is a
DEBUG_BEGIN_STMT, so it doesn't add it and due to -fno-tree-dce that never
gets removed afterwards.  Similarly, if the body seq after gimplification
contains some DEBUG_BEGIN_STMTs plus a single gbind, then we could behave
differently between -g0 and -g, by using that gbind as the body in the -g0
case and not in the -g case.
This patch fixes that by ignoring DEBUG_BEGIN_STMTs (other debug stmts can't
appear at this point yet thankfully) during decisions and if we pick the
single gbind and there are DEBUG_BEGIN_STMTs next to it, it moves them into
the gbind.
While debugging this, I found also a bug in the gimple_seq_last_nondebug_stmt
function, for a seq that has a single non-DEBUG_BEGIN_STMT statement
followed by one or more DEBUG_BEGIN_STMTs it would return NULL rather than
the first statement.

2020-03-26  Jakub Jelinek  <jakub@redhat.com>

PR debug/94281
* gimple.h (gimple_seq_first_nondebug_stmt): New function.
(gimple_seq_last_nondebug_stmt): Don't return NULL if seq contains
a single non-debug stmt followed by one or more debug stmts.
* gimplify.c (gimplify_body): Use gimple_seq_first_nondebug_stmt
instead of gimple_seq_first_stmt, use gimple_seq_first_nondebug_stmt
and gimple_seq_last_nondebug_stmt instead of gimple_seq_first and
gimple_seq_last to check if outer_stmt gbind could be reused and
if yes and it is surrounded by any debug stmts, move them into the
gbind body.

* g++.dg/debug/pr94281.C: New test.

4 years agoc++: Fix up user_provided_p [PR81349]
Jakub Jelinek [Thu, 26 Mar 2020 08:31:15 +0000 (09:31 +0100)]
c++: Fix up user_provided_p [PR81349]

The standard says: "A function is user-provided if it is user-declared and
not explicitly defaulted or deleted on its first declaration."
I don't see anything about function templates having different rules here,
but user_provided_p does return true for all TEMPLATE_DECLs.

The following patch fixes it by treating as user-provided only templates
that aren't deleted.

2020-03-26  Jakub Jelinek  <jakub@redhat.com>

PR c++/81349
* class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
true for all TEMPLATE_DECLs.

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

4 years agoc++: Fix a -fcompare-debug issue with DEBUG_BEGIN_STMT stmts in STATEMENT_LISTs ...
Jakub Jelinek [Thu, 26 Mar 2020 08:18:35 +0000 (09:18 +0100)]
c++: Fix a -fcompare-debug issue with DEBUG_BEGIN_STMT stmts in STATEMENT_LISTs [PR94272]

The following testcase FAILs with -fcompare-debug.  The problem is that
the C++ FE initially uses IF_STMTs, tcc_statement which default to
TREE_SIDE_EFFECTS set, but later on is genericized into COND_EXPRs,
tcc_expression which default to TREE_SIDE_EFFECTS ored from all 3 operands.
Furthermore, with -g we emit by default DEBUG_BEGIN_STMTs (TREE_SIDE_EFFECTS
clear) and so end up with a STATEMENT_LIST containing DEBUG_BEGIN_STMT
+ e.g. the IF_STMT, while with -g0 we would end up with just the IF_STMT
alone and in that case there is no STATEMENT_LIST wrapping it.

Now, the STATEMENT_LIST has TREE_SIDE_EFFECTS set to match the IF_STMT,
but if none of the 3 operands (condition and both branches) have
TREE_SIDE_EFFECTS, genericize_if_stmt will replace the IF_STMT with
COND_EXPR without TREE_SIDE_EFFECTS, but with -g only STATEMENT_LIST
wrapping it will keep TREE_SIDE_EFFECTS.  Then during gimplification,
shortcut_cond_expr checks TREE_SIDE_EFFECTS of the operands and as it
is differennt between -g and -g0, will generate different code.

The following patch attempts to fix this by clearing TREE_SIDE_EFFECTS
on STATEMENT_LISTs that initially have it set and contain only
DEBUG_BEGIN_STMT or at most one other statement that lost TREE_SIDE_EFFECTS
during the genericization.

2020-03-26  Jakub Jelinek  <jakub@redhat.com>

PR c++/94272
* cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.

* g++.dg/debug/pr94272.C: New test.

4 years agovar-tracking: Mark as sp based more VALUEs [PR92264]
Jakub Jelinek [Thu, 26 Mar 2020 08:15:39 +0000 (09:15 +0100)]
var-tracking: Mark as sp based more VALUEs [PR92264]

With this simple patch, on i686-linux and x86_64-linux with -m32 (no change
for -m64), the find_base_term visited_vals.length () > 100 find_base_term
statistics changed (fbt is before this patch, fbt2 with this patch):
for k in '' '1$'; do for i in 32 64; do for j in fbt fbt2; do \
echo -n "$j $i $k "; LC_ALL=C grep ^$i.*"$k" $j | wc -l; done; done; done
fbt 32  5313355
fbt2 32  4229854
fbt 64  217523
fbt2 64  217523
fbt 32 1$ 1296
fbt2 32 1$ 407
fbt 64 1$ 0
fbt2 64 1$ 0
For frame_pointer_needed functions, we need to wait until we see the
fp_setter insn in the prologue at which point we disassociate the fp based
VALUEs from sp based VALUEs, but for !frame_pointer_needed functions,
we IMHO don't need to wait anything.  For ACCUMULATE_OUTGOING_ARGS it isn't
IMHO worth doing anything, as there is a single sp adjustment and so there
is no risk of many thousands deep VALUE chains, but for
!ACCUMULATE_OUTGOING_ARGS the sp keeps changing constantly.

2020-03-26  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/92264
* var-tracking.c (add_stores): Call cselib_set_value_sp_based even
for sp based values in !frame_pointer_needed
&& !ACCUMULATE_OUTGOING_ARGS functions.

4 years agowidening_mul: restrict ops to be defined in the same basic-block when convert plusmin...
Richard Biener [Thu, 26 Mar 2020 07:33:57 +0000 (08:33 +0100)]
widening_mul: restrict ops to be defined in the same basic-block when convert plusminus to widen

In the testcase for PR94269, widening_mul moves two multiply
instructions from outside the loop to inside
the loop, merging with two add instructions separately.  This
increases the cost of the loop.  Like FMA detection
in the same pass, simply restrict ops to be defined in the same
basic-block to avoid possibly moving multiply
to a different block with a higher execution frequency.

2020-03-26  Felix Yang  <felix.yang@huawei.com>

PR tree-optimization/94269
* tree-ssa-math-opts.c (convert_plusminus_to_widen): Restrict
this
operation to single basic block.

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

4 years agoDaily bump.
GCC Administrator [Thu, 26 Mar 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.

4 years ago[PATCH] rs6000: vec_rlnm fix to make builtin work according to ABI
Carl Love [Wed, 25 Mar 2020 23:33:37 +0000 (18:33 -0500)]
[PATCH] rs6000: vec_rlnm fix to make builtin work according to ABI

gcc/ChangeLog

2020-03-25  Carl Love  <cel@us.ibm.com>

PR target/93819
* gcc/config/rs6000/altivec.h:
Fixed swapped arguments for vec_rlnm define.

4 years agolibstdc++: Fix author in previous ChangeLog entry
Jonathan Wakely [Wed, 25 Mar 2020 22:20:42 +0000 (22:20 +0000)]
libstdc++: Fix author in previous ChangeLog entry

The previous commit added two tests which were written by Mike Crowe,
not by me. This fixes the ChangeLog entry.

4 years agolibstdc++ Add missing tests for std::shared_timed_mutex
Jonathan Wakely [Wed, 25 Mar 2020 22:16:22 +0000 (22:16 +0000)]
libstdc++ Add missing tests for std::shared_timed_mutex

These tests were supposed to be committed as part of r278904 (aka
b789efeae8c0620b83f25e4a0757c4871e02ab5f) but I didn't 'git add' them.

* testsuite/30_threads/shared_timed_mutex/try_lock_until/1.cc: New
test.
* testsuite/30_threads/shared_timed_mutex/try_lock_until/2.cc: New
test.

4 years agolibstdc++: Define and use chrono::is_clock for C++20
Jonathan Wakely [Wed, 25 Mar 2020 22:07:02 +0000 (22:07 +0000)]
libstdc++: Define and use chrono::is_clock for C++20

For C++20 the wait_until members of mutexes and condition variables are
required to be ill-formed if given a clock that doesn't meet the
requirements for a clock type. To implement that requirement this patch
adds static assertions using the chrono::is_clock trait, and defines
that trait.

To avoid expensive checks for the common cases, the trait (and
associated variable template) are explicitly specialized for the
standard clock types.

This also moves the filesystem::__file_clock type from <filesystem> to
<chrono>, so that chrono::file_clock and chrono::file_time can be
defined in <chrono> as required.

* include/bits/fs_fwd.h (filesystem::__file_clock): Move to ...
* include/std/chrono (filesystem::__file_clock): Here.
(filesystem::__file_clock::from_sys, filesystem::__file_clock::to_sys):
Define public member functions for C++20.
(is_clock, is_clock_v): Define traits for C++20.
* include/std/condition_variable (condition_variable::wait_until): Add
check for valid clock.
* include/std/future (_State_baseV2::wait_until): Likewise.
* include/std/mutex (__timed_mutex_impl::_M_try_lock_until): Likewise.
* include/std/shared_mutex (shared_timed_mutex::try_lock_shared_until):
Likewise.
* include/std/thread (this_thread::sleep_until): Likewise.
* testsuite/30_threads/condition_variable/members/2.cc: Qualify
slow_clock with new namespace.
* testsuite/30_threads/condition_variable/members/clock_neg.cc: New
test.
* testsuite/30_threads/condition_variable_any/members/clock_neg.cc:
New test.
* testsuite/30_threads/future/members/clock_neg.cc: New test.
* testsuite/30_threads/recursive_timed_mutex/try_lock_until/3.cc:
Qualify slow_clock with new namespace.
* testsuite/30_threads/recursive_timed_mutex/try_lock_until/
clock_neg.cc: New test.
* testsuite/30_threads/shared_future/members/clock_neg.cc: New
test.
* testsuite/30_threads/shared_lock/locking/clock_neg.cc: New test.
* testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc:
New test.
* testsuite/30_threads/timed_mutex/try_lock_until/3.cc: Qualify
slow_clock with new namespace.
* testsuite/30_threads/timed_mutex/try_lock_until/4.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc: New
test.
* testsuite/30_threads/unique_lock/locking/clock_neg.cc: New test.
* testsuite/std/time/traits/is_clock.cc: New test.
* testsuite/util/slow_clock.h (slow_clock): Move to __gnu_test
namespace.

4 years agotestsuite: adjustments for amdgcn
Andrew Stubbs [Tue, 3 Mar 2020 23:16:13 +0000 (23:16 +0000)]
testsuite: adjustments for amdgcn

2020-03-25  Andrew Stubbs  <ams@codesourcery.com>

gcc/testsuite/
* gcc.dg/vect/bb-slp-pr69907.c: Disable the dump scan for amdgcn.
* lib/target-supports.exp (check_effective_target_vect_unpack):
Add amdgcn.

4 years ago Fix vector-compare-1 regressions on sh4/sh4eb caused by pattern clobbering T...
Jeff Law [Wed, 25 Mar 2020 20:33:08 +0000 (14:33 -0600)]
Fix vector-compare-1 regressions on sh4/sh4eb caused by pattern clobbering T reg without expressing that in its RTL.

            PR rtl-optimization/90275
            * config/sh/sh.md (mov_neg_si_t): Clobber the T register in the
            pattern.

4 years agoFix vector-compare-1 regressions on sh4/sh4eb caused by pattern clobbering T reg...
Jeff Law [Wed, 25 Mar 2020 20:12:32 +0000 (14:12 -0600)]
Fix vector-compare-1 regressions on sh4/sh4eb caused by pattern clobbering T reg without expressing that in its RTL.

PR rtl-optimization/90275
* config/sh/sh.md (mov_neg_si_t): Clobber the T register in the
pattern.

4 years agoarm: Fix ICE caused by arm_gen_dicompare_reg [PR94292]
Jakub Jelinek [Wed, 25 Mar 2020 18:06:45 +0000 (19:06 +0100)]
arm: Fix ICE caused by arm_gen_dicompare_reg [PR94292]

The following testcase ICEs, because arm_gen_dicompare_reg creates invalid
RTL which then propagates into DEBUG_INSNs and ICEs while handling them.
The problem is that this function emits
(insn 18 17 19 2 (set (reg:CC_DNE 100 cc)
        (compare (ior:SI (ne:SI (subreg:SI (reg:DI 129) 0)
                    (subreg:SI (reg:DI 114 [ _2 ]) 0))
                (ne:SI (subreg:SI (reg:DI 129) 4)
                    (subreg:SI (reg:DI 114 [ _2 ]) 4)))
            (const_int 0 [0]))) "pr94292.c":7:11 325 {*cmp_ior}
     (nil))
and the invalid thing is that the COMPARE has VOIDmode.  Setting a
non-VOIDmode SET_DEST to VOIDmode SET_SRC is only valid if the SET_SRC is
CONST_INT/CONST_DOUBLE.
The following patch fixes it by giving the COMPARE the same mode as it gives
to the SET_DEST cc register.

2020-03-25  Jakub Jelinek  <jakub@redhat.com>

PR target/94292
* config/arm/arm.c (arm_gen_dicompare_reg): Set mode of COMPARE to
mode rather than VOIDmode.

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

4 years agoPR middle-end/94004 - missing -Walloca on calls to alloca due to -Wno-system-headers
Martin Sebor [Wed, 25 Mar 2020 16:48:13 +0000 (10:48 -0600)]
PR middle-end/94004 - missing -Walloca on calls to alloca due to -Wno-system-headers

gcc/testsuite/ChangeLog:

PR middle-end/94004
* gcc.dg/Walloca-larger-than-3.c: New test.
* gcc.dg/Walloca-larger-than-3.h: New test header.
* gcc.dg/Wvla-larger-than-4.c: New test.

gcc/ChangeLog:

PR middle-end/94004
* gimple-ssa-warn-alloca.c (pass_walloca::execute): Issue warnings
even for alloca calls resulting from system macro expansion.
Include inlining context in all warnings.

4 years ago rs6000: Allow FPRs to change between SDmode and DDmode [PR94254]
Jeff Law [Wed, 25 Mar 2020 16:37:31 +0000 (10:37 -0600)]
rs6000: Allow FPRs to change between SDmode and DDmode [PR94254]

    g:497498c878d48754318e486428e2aa30854020b9 caused lra to cycle
    on some SDmode reloads for power6.  As explained in more detail
    in the PR comments, the problem was a conflict between two target
    hooks: rs6000_secondary_memory_needed_mode required SDmode FPR
    reloads to use DDmode memory (rightly, since using SDmode memory
    wouldn't make progress) but rs6000_can_change_mode_class didn't
    allow FPRs to change from SDmode to DDmode.  Previously lra
    ignored that and changed the mode anyway.

    From what Segher says, it sounds like the "from_size < 8 || to_size < 8"
    check is mostly there for SF<->64-bit subregs, and that SDmode is stored
    in the way that target-independent code expects.  This patch therefore
    allows SD<->DD changes.

    I wondered about checking for SD<->64-bit changes instead, but that
    seemed like an unnecessary generalisation for this stage.

    2020-03-23  Richard Sandiford  <richard.sandiford@arm.com>

    gcc/
            PR target/94254
            * config/rs6000/rs6000.c (rs6000_can_change_mode_class): Allow
            FPRs to change between SDmode and DDmode.

4 years agoc++: Fix invalid -Wduplicated-cond warning [PR94265]
Patrick Palka [Wed, 25 Mar 2020 16:32:43 +0000 (12:32 -0400)]
c++: Fix invalid -Wduplicated-cond warning [PR94265]

This fixes a false-positive warning from -Wduplicate-cond in the presence of an
if-statement with a non-empty init-statement.  Precisely determining whether a
non-empty init-statement has side effects seems tricky and error-prone, so this
patch takes the route of unconditionally invalidating the condition chain when
it encounters such an if-statement.

gcc/cp/ChangeLog:

PR c++/94265
* parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
current condition chain when the if-statement has a non-empty
init-statement.

gcc/testsuite/ChangeLog:

PR c++/94265
* g++.dg/warn/Wduplicated-cond1.C: New test.

4 years agoPR tree-optimization/94131 - ICE on printf with a VLA string and -fno-tree-ccp
Martin Sebor [Wed, 25 Mar 2020 15:39:50 +0000 (09:39 -0600)]
PR tree-optimization/94131 - ICE on printf with a VLA string and -fno-tree-ccp

gcc/testsuite/ChangeLog:

PR tree-optimization/94131
* gcc.dg/pr94131.c: New test.

gcc/ChangeLog:

PR tree-optimization/94131
* gimple-fold.c (get_range_strlen_tree): Fail for variable-length
types and decls.
* tree-ssa-strlen.c (get_range_strlen_dynamic): Avoid assuming
types have constant sizes.

4 years agoFix gcc.dg/pr92301.c on targets that don't support argc/argv.
Sandra Loosemore [Wed, 25 Mar 2020 15:01:50 +0000 (08:01 -0700)]
Fix gcc.dg/pr92301.c on targets that don't support argc/argv.

2020-03-25  Sandra Loosemore  <sandra@codesourcery.com>

gcc/testsuite/
* gcc.dg/pr92301.c (main): Allow argc to be 0 to support
embedded targets.

4 years agocoroutines: Fix missing dereference (PR94319).
Iain Sandoe [Wed, 25 Mar 2020 12:04:58 +0000 (12:04 +0000)]
coroutines: Fix missing dereference (PR94319).

Fix a typo.

gcc/cp/ChangeLog:

2020-03-25  Iain Sandoe  <iain@sandoe.co.uk>

PR c++/94319
* coroutines.cc (captures_temporary): Fix a missing dereference.

4 years agoDo not error about missing zstd unless --with-zstd.
Martin Liska [Wed, 25 Mar 2020 12:34:53 +0000 (13:34 +0100)]
Do not error about missing zstd unless --with-zstd.

PR lto/94259
* configure.ac: Report error only when --with-zstd
is used.
* configure: Regenerate.

4 years agotestsuite: Mention cleanup-13.c test is incompatible with -fcompare-debug [PR94296]
Jakub Jelinek [Wed, 25 Mar 2020 10:41:17 +0000 (11:41 +0100)]
testsuite: Mention cleanup-13.c test is incompatible with -fcompare-debug [PR94296]

As this test produces different code depending on whether
__GCC_HAVE_DWARF2_CFI_ASM macro is defined or not, it is inherently
incompatible with -fcompare-debug, as with
-fcompare-debug -fno-asynchronous-unwind-tables -fno-exceptions
the macro is defined only in the -g case and not otherwise.
The purpose of the macro is to tell when the compiler is emitting
.cfi* directives itself and thus it is desirable that user code uses them in
inline asm as well, so I think it is fine the way it is.
As -fexceptions makes the test pass even in that case because it emits
.cfi* directives, the test actually doesn't FAIL even with
make check-gcc RUNTESTFLAGS='--target_board=unix/-fcompare-debug/-fno-asynchronous-unwind-tables/-fno-exceptions dg.exp=cleanup-13.c'
so the intent of this patch is help Martin and others who do run gcc tests
out of the testsuite with random compiler flags to find out that this is a
known issue.

2020-03-25  Jakub Jelinek  <jakub@redhat.com>

PR debug/94296
* gcc.dg/cleanup-13.c: Add a comment that the test is not
-fcompare-debug compatible with certain other options.

4 years agoi386: Fix ix86_add_reg_usage_to_vzeroupper [PR94308]
Jakub Jelinek [Wed, 25 Mar 2020 10:40:00 +0000 (11:40 +0100)]
i386: Fix ix86_add_reg_usage_to_vzeroupper [PR94308]

The following patch ICEs due to my recent change r10-6451-gb7b3378f91c.
Since that patch, for explicit vzeroupper in the sources (when an intrinsic
is used), we start with the *avx_vzeroupper_1 pattern which contains just the
UNSPECV_VZEROUPPER and no sets/clobbers.  The vzeroupper pass then adds some
sets to those, but doesn't add clobbers and finally there is an
&& epilogue_completed splitter that splits this into the *avx_vzeroupper
pattern which has the right number of sets/clobbers (16 on 64-bit, 8 on
32-bit) + the UNSPECV_VZEROUPPER first.
The problem with this testcase on !TARGET_64BIT is that the vzeroupper pass
adds 8 sets to the pattern, i.e. the maximum number, but INSN_CODE stays
to be the one of the *avx_vzeroupper_1 pattern.  The splitter doesn't do
anything here, because it sees the number of rtxes in the PARALLEL already
the right count, but during final we see that the *avx_vzeroupper_1 pattern
has "#" output template and ICE that we forgot to split it.

The following patch fixes it by forcing re-recognition of the insn after we
make the changes to it in ix86_add_reg_usage_to_vzeroupper.  Anything that
will call recog_memoized later on will recog it and find out it is in this
case already *avx_vzeroupper rather than *avx_vzeroupper_1.

2020-03-25  Jakub Jelinek  <jakub@redhat.com>

PR target/94308
* config/i386/i386-features.c (ix86_add_reg_usage_to_vzeroupper): Set
INSN_CODE (insn) to -1 when changing the pattern.

* gcc.target/i386/pr94308.c: New test.

4 years agoMake target_clones resolver fn static if possible.
Martin Liska [Wed, 25 Mar 2020 10:03:39 +0000 (11:03 +0100)]
Make target_clones resolver fn static if possible.

PR target/93274
PR ipa/94271
* config/i386/i386-features.c (make_resolver_func): Drop
public flag for resolver.
* config/rs6000/rs6000.c (make_resolver_func): Add comdat
group for resolver and drop public flag if possible.
* multiple_target.c (create_dispatcher_calls): Drop unique_name
and resolution as we want to enable LTO privatization of the default
symbol.
PR target/93274
PR ipa/94271
* gcc.target/i386/pr81213-2.c: New test.
* gcc.target/i386/pr81213.c: Add additional source.
* gcc.dg/lto/pr94271_0.c: New test.
* gcc.dg/lto/pr94271_1.c: New test.

4 years agoFix handling of --with{,out}-zstd option.
Martin Liska [Wed, 25 Mar 2020 10:01:43 +0000 (11:01 +0100)]
Fix handling of --with{,out}-zstd option.

PR lto/94259
* configure.ac: Respect --without-zstd and report
error when we can't find header file with --with-zstd.
* configure: Regenerate.

4 years agotestsuite: Fix up FAILs in gfortran testsuite with -fcompare-debug [PR94280]
Jakub Jelinek [Wed, 25 Mar 2020 09:48:27 +0000 (10:48 +0100)]
testsuite: Fix up FAILs in gfortran testsuite with -fcompare-debug [PR94280]

These 3 tests use compiler_options() function,
which is inherently incompatible with -fcompare-debug compilation, as it
emits into a string literal in the assembly the exact f951 command line
options, which differs between the two compilations with -fcompare-debug,
where one has -gtoggle and -fcompare-debug-second options added and
different -fdump-final-insns= option argument.

The following patch adds dg-skip-if directives, so that these tests are
ignored during
make check-gfortran RUNTESTFLAGS='--target_board=unix/-fcompare-debug'

2020-03-25  Jakub Jelinek  <jakub@redhat.com>

PR debug/94280
* gfortran.dg/iso_c_binding_compiler_1.f90: Add dg-skip-if for
-fcompare-debug.
* gfortran.dg/iso_c_binding_compiler_3.f90: Likewise.
* gfortran.dg/unlimited_polymorphic_31.f03: Likewise.

4 years agofortran: ICE using undeclared symbol in array constructor PR93484
Mark Eggleston [Wed, 25 Mar 2020 08:33:03 +0000 (08:33 +0000)]
fortran: ICE using undeclared symbol in array constructor PR93484

Using undeclared symbol k in an expression in the following
array constructor results in an ICE:

    print *, [real(x(k))]

If the call to the intrinsic is not in a constructor a no IMPLICIT
type error is reported and the ICE does not occur.

Matching on an expression instead of an initialisation express an
and not converting a MATCH_ERROR return value into MATCH_NO results
in the no IMPLICIT error and no ICE.

Note: Steven G. Kargl  <kargl@gcc.gnu.org> is the author of the
changes except for the test cases.

gcc/fortran/ChangeLog:

PR fortran/93484
* match.c (gfc_match_type_spec): Replace gfc_match_init_expr with
gfc_match_expr. Return m if m is MATCH_NO or MATCH_ERROR.

gcc/testsuite

PR fortran/93484
* gfortran.dg/pr93484_1.f90: New test.
* gfortran.dg/pr93484_2.f90: New test.

4 years agovarasm: Fix output_constructor where a RANGE_EXPR index needs to skip some elts ...
Jakub Jelinek [Wed, 25 Mar 2020 08:21:05 +0000 (09:21 +0100)]
varasm: Fix output_constructor where a RANGE_EXPR index needs to skip some elts [PR94303]

The following testcase is miscompiled, because output_constructor doesn't
output the initializer correctly.  The FE creates {[1...2] = 9} in this
case, and we emit .long 9; long 9; .zero 8 instead of the expected
.zero 8; .long 9; .long 9.  If the CONSTRUCTOR is {[1] = 9, [2] = 9},
output_constructor_regular_field has code to notice that the current
location (local->total_bytes) is smaller than the location we want to write
to (1*sizeof(elt)) and will call assemble_zeros to skip those.  But
RANGE_EXPRs are handled by a different function which didn't do this,
so for RANGE_EXPRs we emitted them properly only if local->total_bytes
was always equal to the location where the RANGE_EXPR needs to start.

2020-03-25  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/94303
* varasm.c (output_constructor_array_range): If local->index
RANGE_EXPR doesn't start at the current location in the constructor,
skip needed number of bytes using assemble_zeros or assert we don't
go backwards.

PR middle-end/94303
* g++.dg/torture/pr94303.C: New test.

4 years agomiddle-end: Avoid using DECL_UID in ASM_FORMAT_PRIVATE_NAME [PR94223]
Jakub Jelinek [Wed, 25 Mar 2020 08:18:33 +0000 (09:18 +0100)]
middle-end: Avoid using DECL_UID in ASM_FORMAT_PRIVATE_NAME [PR94223]

As mentioned in the PR, we don't guarantee DECL_UID to be the same between
corresponding decls in -g and -g0 builds, -g can create more decls and all
that is guaranteed is that the DECL_UIDs of the corresponding decls compare
the same.
The following testcase gets a -fcompare-debug failure because these
functions use DECL_UID as the number in ASM_FORMAT_PRIVATE_NAME.

The patch fixes it by using just a sequential number there instead.
I don't think this can be called during PCH writing, this only happens for
non-public decls and the C/C++ FEs shouldn't mangling those at that point
(furthermore C++ FE uses a different set_decl_assembler_name hook and this
one is something only the gimplifier calls on C.NNNN temporaries.

2020-03-25  Jakub Jelinek  <jakub@redhat.com>

PR c++/94223
* langhooks.c (lhd_set_decl_assembler_name): Use a static ulong
counter instead of DECL_UID.

* lto-lang.c (lto_set_decl_assembler_name): Use a static ulong
counter instead of DECL_UID.

* g++.dg/opt/pr94223.C: New test.

4 years agosccvn: Fix buffer overflow in push_partial_def [PR94300]
Jakub Jelinek [Wed, 25 Mar 2020 08:17:01 +0000 (09:17 +0100)]
sccvn: Fix buffer overflow in push_partial_def [PR94300]

The following testcase is miscompiled, because there is a buffer overflow
in push_partial_def in the little-endian case when working 64-byte vectors.
The code computes the number of bytes we need in the BUFFER: NEEDED_LEN,
which is rounded up number of bits we need.  Then the code
native_encode_expr each (partially overlapping) pd into THIS_BUFFER.
If pd.offset < 0, i.e. the pd.rhs store starts at some bits before the
window we are interested in, we pass -pd.offset to native_encode_expr and
shrink the size already earlier:
      HOST_WIDE_INT size = pd.size;
      if (pd.offset < 0)
        size -= ROUND_DOWN (-pd.offset, BITS_PER_UNIT);
On this testcase, the problem is with a store with pd.offset > 0,
in particular pd.offset 256, pd.size 512, i.e. a 64-byte store which doesn't
fit into entirely into BUFFER.
We have just:
          size = MIN (size, (HOST_WIDE_INT) needed_len * BITS_PER_UNIT);
in this case for little-endian, which isn't sufficient, because needed_len
is 64, the entire BUFFER (except of the last extra byte used for shifting).
native_encode_expr fills the whole THIS_BUFFER (again, except the last extra
byte), and the code then performs memcpy (BUFFER + 32, THIS_BUFFER, 64);
which overflows BUFFER and as THIS_BUFFER is usually laid out after it,
overflows it into THIS_BUFFER.
The following patch fixes it by for pd.offset > 0 making sure size is
reduced too.  For big-endian the code does things differently and already
handles this right.

2020-03-25  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/94300
* tree-ssa-sccvn.c (vn_walk_cb_data::push_partial_def): If pd.offset
is positive, make sure that off + size isn't larger than needed_len.

* gcc.target/i386/avx512f-pr94300.c: New test.

4 years agoif-conv: Delete dead stmts backwards in ifcvt_local_dce [PR94283]
Jakub Jelinek [Wed, 25 Mar 2020 07:08:04 +0000 (08:08 +0100)]
if-conv: Delete dead stmts backwards in ifcvt_local_dce [PR94283]

> > This patch caused:
> >
> > gcc /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c -O3 -g -fno-tree-dce -c
> > during GIMPLE pass: ifcvt
> > /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c: In function ‘broken030599’:
> > /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c:2:1: internal compiler error: Segmentation fault
>
> Likely
>
>   /* Delete dead statements.  */
>   gsi = gsi_start_bb (bb);
>   while (!gsi_end_p (gsi))
>     {
>
> needs to instead work back-to-front for debug stmt adjustment to work

Indeed, that seems to work.

2020-03-25  Richard Biener  <rguenther@suse.de>
    Jakub Jelinek  <jakub@redhat.com>

PR debug/94283
* tree-if-conv.c (ifcvt_local_dce): Delete dead statements backwards.

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

Co-authored-by: Richard Biener <rguenther@suse.de>
4 years agoTest for sigsetjmp support in analyzer tests requiring that feature.
Sandra Loosemore [Wed, 25 Mar 2020 00:55:07 +0000 (17:55 -0700)]
Test for sigsetjmp support in analyzer tests requiring that feature.

2020-03-24  Sandra Loosemore  <sandra@codesourcery.com>

gcc/testsuite/
* gcc.dg/analyzer/sigsetjmp-5.c: Require sigsetjmp support.
* gcc.dg/analyzer/sigsetjmp-6.c: Likewise.
* lib/target-supports.exp (check_effective_target_sigsetjmp): New.

4 years agoDaily bump.
GCC Administrator [Wed, 25 Mar 2020 00:16:22 +0000 (00:16 +0000)]
Daily bump.

4 years agoc++: Fix wrong no post-decrement operator error in template [PR94190]
Marek Polacek [Mon, 16 Mar 2020 14:17:11 +0000 (10:17 -0400)]
c++: Fix wrong no post-decrement operator error in template [PR94190]

Now that convert_like creates an IMPLICIT_CONV_EXPR when it converts
something that involves a class in a template, we must be prepared to
handle it.  In this test, we have a class S and we're converting it
to long int& using a user-defined conversion since we're performing
-- on it.  So cp_build_unary_op/POSTDECREMENT_EXPR calls
build_expr_type_conversion which gets the IMPLICIT_CONV_EXPR.  Before
the convert_like change it got *S::operator long int &(&b) whose type
is long int but now it gets IMPLICIT_CONV_EXPR<long int&>(b) whose type
is a reference type.  But the !MAYBE_CLASS_TYPE_P switch doesn't handle
reference types and so we complain.

Fixed by calling convert_from_reference on the result of convert_like.

PR c++/94190 - wrong no post-decrement operator error in template.
* call.c (convert_like_real): Use convert_from_reference on the result.

* g++.dg/conversion/op7.C: New test.

4 years agoc++: Improve handling of ill-formed constraints [PR94186].
Jason Merrill [Tue, 24 Mar 2020 22:25:17 +0000 (18:25 -0400)]
c++: Improve handling of ill-formed constraints [PR94186].

It would have been trivial to make the error for non-bool constraint in
satisfy_atom unconditional, but that didn't give context for the error or
printing with the dependent form and template arguments.  So I changed a
couple of places so that, when a hard error is encountered during quiet
substitution/satisfaction, we go through again noisily; this builds up the
necessary context.

The similar change to tsubst_nested_requirement does not build up the
necessary context; rather than try to fix that now I changed
get_constraint_error_location to give up and use input_location if there's
no CONSTR_CONTEXT.  In the case of concepts-pr67697.C, we still have a good
source location because the NESTED_REQ has a correct EXPR_LOCATION, but this
patch doesn't improve context printing for this case as it does for the
above.

gcc/cp/ChangeLog
2020-03-24  Jason Merrill  <jason@redhat.com>

PR c++/94186
* constraint.cc (constraint_satisfaction_value): Repeat noisily on
error.
(tsubst_nested_requirement): Likewise.
(get_constraint_error_location): Allow missing context.
(diagnose_atomic_constraint): Diagnose non-bool constraint here.
(satisfy_atom): Not here.  Only diagnose non-constant when noisy.

4 years agoc++: Fix template parm with dependent type in concepts.
Jason Merrill [Tue, 24 Mar 2020 22:25:17 +0000 (18:25 -0400)]
c++: Fix template parm with dependent type in concepts.

While looking at PR94186 I also noticed this regression; if a non-type
template parameter uses a type parameter in its type, we need to map both
template parameters.

gcc/cp/ChangeLog
2020-03-24  Jason Merrill  <jason@redhat.com>

* pt.c (any_template_parm_r): Look into the type of a non-type
template parm.

4 years agoc++: Give more expressions locations.
Jason Merrill [Tue, 24 Mar 2020 22:25:17 +0000 (18:25 -0400)]
c++: Give more expressions locations.

In the testcase for PR94186, we have a SCOPE_REF with no location even
though at one point it was in a cp_expr which had a location.  So let's make
the cp_expr constructor that takes a location apply it to the expression
when possible.

gcc/cp/ChangeLog
2020-03-24  Jason Merrill  <jason@redhat.com>

* cp-tree.h (cp_expr): When constructing from an expr and a
location, call protected_set_expr_location.

4 years ago[testsuite,arm] use arm_fp_dp_ok effective-target
Christophe Lyon [Tue, 24 Mar 2020 08:25:08 +0000 (08:25 +0000)]
[testsuite,arm] use arm_fp_dp_ok effective-target

Switch to arm_fp_dp_ok effective-target in tests that require
double-precision support from the FPU.

2020-03-24  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc/arm/vfp-1.c: Use arm_fp__ok effective-target.
* gcc.target/arm/vfp-ldmdbd.c: Likewise.
* gcc.target/arm/vfp-ldmiad.c: Likewise.
* gcc.target/arm/vfp-stmdbd.c: Likewise.
* gcc.target/arm/vfp-stmiad.c: Likewise.
* gcc.target/arm/vnmul-1.c: Likewise.
* gcc.target/arm/vnmul-3.c: Likewise.
* gcc.target/arm/vnmul-4.c: Likewise.

4 years ago[testsuite,arm] cmp-2.c: Move double-precision tests to cmp-3.c
Christophe Lyon [Mon, 23 Mar 2020 18:01:11 +0000 (18:01 +0000)]
[testsuite,arm] cmp-2.c: Move double-precision tests to cmp-3.c

Parts of the cmp-2.c test rely on double-precision support, making the
test fail on targets where the FPU supports single-precision only.

Split the test into single-precision (cmp-2.c) and double-precision
tests (cmp-3.c).

2020-03-24  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/testsuite/
* gcc.target/arm/cmp-2.c: Move double-precision tests to...
* gcc.target/arm/cmp-3.c: ...here (new file)

4 years ago[testsuite,arm] target-supports.exp: Add arm_fp_dp_ok effective-target
Christophe Lyon [Mon, 23 Mar 2020 17:59:51 +0000 (17:59 +0000)]
[testsuite,arm] target-supports.exp: Add arm_fp_dp_ok effective-target

Some tests require double-precision support, but the existing
arm_fp_ok effective-target only checks if hardware floating-point is
available, not what level. So this patch adds a new arm_fp_dp_ok
effective-target to check that double-precision is supported.

2020-03-24  Christophe Lyon  <christophe.lyon@linaro.org>

gcc/
* doc/sourcebuild.texi (ARM-specific attributes): Add
arm_fp_dp_ok.
(Features for dg-add-options): Add arm_fp_dp.

gcc/testsuite/
* lib/target-supports.exp
(check_effective_target_arm_fp_dp_ok_nocache): New.
(check_effective_target_arm_fp_dp_ok): New.
(add_options_for_arm_fp_dp): New.

4 years agoDefine __BIG_ENDIAN__
John David Anglin [Tue, 24 Mar 2020 17:04:26 +0000 (17:04 +0000)]
Define __BIG_ENDIAN__

2020-03-24  John David Anglin  <danglin@gcc.gnu.org>

PR lto/94249
* config/pa/pa.h (TARGET_CPU_CPP_BUILTINS): Define __BIG_ENDIAN__.

4 years agoFix OpenMP offload handling for target-link variables for nvptx (PR81689)
Tobias Burnus [Tue, 24 Mar 2020 14:13:56 +0000 (15:13 +0100)]
Fix OpenMP offload handling for target-link variables for nvptx (PR81689)

PR libgomp/81689
* lto.c (offload_handle_link_vars): Propagate TREE_PUBLIC state.

PR libgomp/81689
* omp-offload.c (omp_finish_file): Fix target-link handling if
targetm_common.have_named_sections is false.

PR libgomp/81689
* testsuite/libgomp.c/target-link-1.c: Remove xfail.

4 years agoImprove endianess detection.
Martin Liska [Tue, 24 Mar 2020 10:40:10 +0000 (11:40 +0100)]
Improve endianess detection.

PR lto/94249
* plugin-api.h: Add more robust endianess detection.

4 years agoarm: Fix arm {,u}subvdi4 and usubvsi4 expanders [PR94286]
Jakub Jelinek [Tue, 24 Mar 2020 09:28:58 +0000 (10:28 +0100)]
arm: Fix arm {,u}subvdi4 and usubvsi4 expanders [PR94286]

The following testcase ICEs, because these expanders will happily create
a SImode 0x80000000 CONST_INT, which is not valid RTL, as CONST_INTs need to
be sign extended from the mode precision to full HWI.

2020-03-24  Jakub Jelinek  <jakub@redhat.com>

PR target/94286
* config/arm/arm.md (subvdi4, usubvsi4, usubvdi4): Use gen_int_mode
instead of GEN_INT.

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

4 years agoloop-manip: Avoid -fcompare-debug issues in create_iv [PR94285]
Jakub Jelinek [Tue, 24 Mar 2020 08:36:32 +0000 (09:36 +0100)]
loop-manip: Avoid -fcompare-debug issues in create_iv [PR94285]

The following testcase FAILs with -fcompare-debug.  The problem is that
create_iv behaves differently when inserting after into an empty bb (in that
case sets location to goto_locus), or when inserting before gsi_end_p (i.e.
at the end of bb; in that case it will not set location, otherwise it will
set it to the location of next stmt).
This isn't -fcompare-debug friendly, because if inserting after and the
bb contains only debug stmts, then the location will not be set with -g
and will be with -g0, or when inserting before, the location might either
be set from the following debug stmt rather than some non-debug stmt after
that, or might not be set with -g0 if it is to be inserted at the end of bb,
while with -g would be set to location of debug stmt.

2020-03-24  Jakub Jelinek  <jakub@redhat.com>

PR debug/94285
* tree-ssa-loop-manip.c (create_iv): If after, set stmt location to
e->goto_locus even if gsi_bb (*incr_pos) contains only debug stmts.
If not after and at *incr_pos is a debug stmt, set stmt location to
location of next non-debug stmt after it if any.

* gfortran.dg/pr94285.f90: New test.

4 years agoif-conv: Fix -fcompare-debug bugs in ifcvt_local_dce [PR94283]
Jakub Jelinek [Tue, 24 Mar 2020 08:34:58 +0000 (09:34 +0100)]
if-conv: Fix -fcompare-debug bugs in ifcvt_local_dce [PR94283]

The following testcase shows -fcompare-debug bugs in ifcvt_local_dce,
where the decisions what statements are needed is based also on debug stmt
operands, which is wrong.
So, this patch makes sure to never add debug stmt to the worklist, or never
add an assign to worklist just because it is used in a debug stmt in another
bb.

2020-03-24  Jakub Jelinek  <jakub@redhat.com>

PR debug/94283
* tree-if-conv.c (ifcvt_local_dce): For gimple debug stmts, just set
GF_PLF_2, but don't add them to worklist.  Don't add an assigment to
worklist or set GF_PLF_2 just because it is used in a debug stmt in
another bb.  Formatting improvements.

* gcc.target/i386/pr94283.c: New test.

4 years agocgraphunit: Avoid code generation differences based on -w/TREE_NO_WARNING [PR94277]
Jakub Jelinek [Tue, 24 Mar 2020 08:33:17 +0000 (09:33 +0100)]
cgraphunit: Avoid code generation differences based on -w/TREE_NO_WARNING [PR94277]

The following testcase FAILs with -fcompare-debug, but not because -g vs.
-g0 would make a difference, but because the second compilation is done with
-w in order not to emit warnings twice and -w seems to affect the *.gkd dump
content.
This is because TREE_NO_WARNING flag, or warn_unused_function does affect
not just whether a warning/pedwarn is printed, but also whether we set
TREE_PUBLIC on such decls.
The following patch makes sure we set it regardless of anything warning
related (TREE_NO_WARNING or warn_unused_function).

2020-03-24  Jakub Jelinek  <jakub@redhat.com>

PR debug/94277
* cgraphunit.c (check_global_declaration): For DECL_EXTERNAL and
non-TREE_PUBLIC non-DECL_ARTIFICIAL FUNCTION_DECLs, set TREE_PUBLIC
regardless of whether TREE_NO_WARNING is set on it or whether
warn_unused_function is true or not.

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

4 years agoDaily bump.
GCC Administrator [Tue, 24 Mar 2020 00:16:23 +0000 (00:16 +0000)]
Daily bump.

4 years agoUpdate gcc es.po, sv.po.
Joseph Myers [Tue, 24 Mar 2020 00:11:25 +0000 (00:11 +0000)]
Update gcc es.po, sv.po.