192943 Commits

Author SHA1 Message Date
Sebastian Huber
9ae8b993cd gcov: Add section for freestanding environments
gcc/

	* doc/gcov.texi (Profiling and Test Coverage in Freestanding
	Environments): New section.
2022-04-28 20:46:50 +02:00
Sebastian Huber
92475ea84f gcov: Use xstrerror()
libgcc/

	* libgcov-util.c (ftw_read_file): Improve notice using xstrerror().
	(gcov_profile_merge_stream): Likewise.
2022-04-28 20:46:50 +02:00
Sebastian Huber
210e32b60b gcov-tool: Add merge-stream subcommand
gcc/

	* doc/gcov-tool.texi: Document merge-stream subcommand.
	* doc/invoke.texi (fprofile-info-section): Mention merge-stream
	subcommand of gcov-tool.
	* gcov-tool.cc (gcov_profile_merge_stream): Declare.
	(print_merge_stream_usage_message): New.
	(merge_stream_usage): Likewise.
	(do_merge_stream): Likewise.
	(print_usage): Call print_merge_stream_usage_message().
	(main): Call do_merge_stream() to execute merge-stream subcommand.

libgcc/

	* libgcov-util.c (consume_stream): New.
	(get_target_profiles_for_merge): Likewise.
	(gcov_profile_merge_stream): Likewise.
2022-04-28 20:46:50 +02:00
Sebastian Huber
ef9a53feae gcov: Record EOF error during read
Use an enum for file error codes.

gcc/

	* gcov-io.cc (gcov_file_error): New enum.
	(gcov_var): Use gcov_file_error enum for the error member.
	(gcov_open): Use GCOV_FILE_NO_ERROR.
	(gcov_close): Use GCOV_FILE_WRITE_ERROR.
	(gcov_write): Likewise.
	(gcov_write_unsigned): Likewise.
	(gcov_write_string): Likewise.
	(gcov_read_bytes): Set error code if EOF is reached.
	(gcov_read_counter): Use GCOV_FILE_COUNTER_OVERFLOW.
2022-04-28 20:46:49 +02:00
Sebastian Huber
1ff8d194cb gcov: Fix integer types in ftw_read_file()
libgcc/

	* libgcov-util.c (ftw_read_file): Use size_t for strlen() variables.
2022-04-28 20:46:49 +02:00
Sebastian Huber
c190b0e65f gcov: Move gcov_open() to caller of read_gcda_file()
This allows to reuse read_gcda_file() to read multiple objects from a single
file.

libgcc/

	* libgcov-util.c (read_gcda_file): Do not open file.
	(ftw_read_file): Open file here.
2022-04-28 20:46:49 +02:00
Sebastian Huber
76cae6482e gcov: Move prepend to list to read_gcda_file()
This helps to reuse read_gcda_file().

libgcc/

	* libgcov-util.c (read_gcda_file): Prepend new info object to global
	list.
	(ftw_read_file): Remove list append here.
2022-04-28 20:46:49 +02:00
Sebastian Huber
f9b59dd8e5 gcov: Use xstrdup()
Move duplication of filename to caller and use xstrdup() instead of custom
code.  This helps to reuse read_gcda_file() for other purposes.

libgcc/

	* libgcov-util.c (read_gcda_file): Do not duplicate filename.
	(ftw_read_file): Duplicate filename for read_gcda_file().
2022-04-28 20:46:49 +02:00
Sebastian Huber
e543d9d2cf gcov-tool: Support file input from stdin
gcc/

	* gcov-io.cc (GCOV_MODE_STDIN): Define.
	(gcov_position): For gcov-tool, return calculated position if file is
	stdin.
	(gcov_open):  For gcov-tool, use stdin if filename is NULL.
	(gcov_close): For gcov-tool, do not close stdin.
	(gcov_read_bytes): For gcov-tool, update position if file is stdin.
	(gcov_sync): For gcov-tool, discard input if file is stdin.
2022-04-28 20:46:49 +02:00
Sebastian Huber
39d80300b3 gcov: Add __gcov_filename_to_gcfn()
gcc/

	* doc/invoke.texi (fprofile-info-section): Mention
	__gcov_filename_to_gcfn().  Use "freestanding" to match with C11
	standard language.  Fix minor example code issues.
	* gcov-io.h (GCOV_FILENAME_MAGIC): Define and document.

gcc/testsuite/

	* gcc.dg/gcov-info-to-gcda.c: Test __gcov_filename_to_gcfn().

libgcc/

	* gcov.h (__gcov_info_to_gcda): Mention __gcov_filename_to_gcfn().
	(__gcov_filename_to_gcfn): Declare and document.
	* libgcov-driver.c (dump_string): New.
	(__gcov_filename_to_gcfn): Likewise.
	(__gcov_info_to_gcda): Adjust comment to match C11 standard language.
2022-04-28 20:46:49 +02:00
Sebastian Huber
68a4673fe2 gcov: Make gcov_seek() static
This function is only used by gcov_write_length() in the gcov-io.cc file.

gcc/

	* gcov-io.cc (gcov_seek): Make it static.
	* gcov-io.h (struct gcov_summary): Do not mention gcov_seek().

libgcc/

	* libgcov.h (gcov_seek): Remove define and declaration.
2022-04-28 20:46:49 +02:00
Sebastian Huber
1a6314b040 gcov: Add open mode parameter to gcov_do_dump()
gcc/

	* gcov-tool.cc (gcov_do_dump): Add mode parameter.
	(gcov_output_files): Open files for reading and writing.

libgcc/

	* libgcov-driver-system.c (gcov_exit_open_gcda_file): Add mode
	parameter.  Pass mode to gcov_open() calls.
	* libgcov-driver.c (dump_one_gcov):  Add mode parameter.  Pass mode to
	gcov_exit_open_gcda_file() call.
	(gcov_do_dump): Add mode parameter.  Pass mode to dump_one_gcov()
	calls.
	(__gcov_dump_one):  Open file for reading and writing.
2022-04-28 20:46:49 +02:00
Sebastian Huber
d170ecc9fc gcov: Add mode to all gcov_open()
gcc/

	* gcov-io.cc (gcov_open): Always use the mode parameter.
	* gcov-io.h (gcov_open): Declare it unconditionally.

libgcc/

	* libgcov-driver-system.c (gcov_exit_open_gcda_file): Open file for
	reading and writing.
	* libgcov-util.c (read_gcda_file): Open file for reading.
	* libgcov.h (gcov_open): Delete declaration.
2022-04-28 20:46:49 +02:00
Sebastian Huber
336ea18ad7 gcov-tool: Allow merging of empty profile lists
The gcov_profile_merge() already had code to deal with profile information
which had no counterpart to merge with.  For profile information from files
with no associated counterpart, the profile information is simply used as is
with the weighting transformation applied.  Make sure that gcov_profile_merge()
works with an empty target profile list.  Return the merged profile list.

gcc/
	* gcov-tool.cc (gcov_profile_merge): Adjust return type.
	(profile_merge): Allow merging of directories which contain no profile
	files.

libgcc/
	* libgcov-util.c (gcov_profile_merge): Return the list of merged
	profiles.  Accept empty target and source profile lists.
2022-04-28 20:46:48 +02:00
David Malcolm
00c4405cd7 analyzer: handle repeated accesses after init of unknown size [PR105285]
PR analyzer/105285 reports a false positive from
-Wanalyzer-null-dereference on git.git's reftable/reader.c.

A reduced version of the problem can be seen in test_1a of
gcc.dg/analyzer/symbolic-12.c in the following:

void test_1a (void *p, unsigned next_off)
{
  struct st_1 *r = p;

  external_fn();

  if (next_off >= r->size)
    return;

  if (next_off >= r->size)
    /* We should have already returned if this is the case.  */
    __analyzer_dump_path (); /* { dg-bogus "path" } */
}

where the analyzer erroneously considers this path, where
(next_off >= r->size) is both false and then true:

symbolic-12.c: In function ‘test_1a’:
symbolic-12.c:22:5: note: path
   22 |     __analyzer_dump_path (); /* { dg-bogus "path" } */
      |     ^~~~~~~~~~~~~~~~~~~~~~~
  ‘test_1a’: events 1-5
    |
    |   17 |   if (next_off >= r->size)
    |      |      ^
    |      |      |
    |      |      (1) following ‘false’ branch...
    |......
    |   20 |   if (next_off >= r->size)
    |      |      ~            ~~~~~~~
    |      |      |             |
    |      |      |             (2) ...to here
    |      |      (3) following ‘true’ branch...
    |   21 |     /* We should have already returned if this is the case.  */
    |   22 |     __analyzer_dump_path (); /* { dg-bogus "path" } */
    |      |     ~~~~~~~~~~~~~~~~~~~~~~~
    |      |     |
    |      |     (4) ...to here
    |      |     (5) here
    |

The root cause is that, at the call to the external function, the
analyzer considers the cluster for *p to have been touched, binding it
to a conjured_svalue, but because p is void * no particular size is
known for the write, and so the cluster is bound using a symbolic key
covering the base region.  Later, the accesses to r->size are handled by
binding_cluster::get_any_binding, but binding_cluster::get_binding fails
to find a match for the concrete field lookup, due to the key for the
binding being symbolic, and reaching this code:

1522  /* If this cluster has been touched by a symbolic write, then the content
1523     of any subregion not currently specifically bound is "UNKNOWN".  */
1524  if (m_touched)
1525    {
1526      region_model_manager *rmm_mgr = mgr->get_svalue_manager ();
1527      return rmm_mgr->get_or_create_unknown_svalue (reg->get_type ());
1528    }

Hence each access to r->size is an unknown svalue, and thus the
condition (next_off >= r->size) isn't tracked, leading to the path with
contradictory conditions being treated as satisfiable.

In the original reproducer in git's reftable/reader.c, the call to the
external fn is:
  reftable_record_type(rec)
which is considered to possibly write to *rec, which is *tab, where tab
is the void * argument to reftable_reader_seek_void, and thus after the
call to reftable_record_type some arbitrary amount of *rec could have
been written to.

This patch fixes things by detecting the "this cluster has been 'filled'
with a conjured value of unknown size" case, and handling
get_any_binding on it by returning a sub_svalue of the conjured_svalue,
so that repeated accesses to r->size give the same symbolic value, so
that the constraint manager rejects the bogus execution path, fixing the
false positive.

gcc/analyzer/ChangeLog:
	PR analyzer/105285
	* store.cc (binding_cluster::get_any_binding): Handle accessing
	sub_svalues of clusters where the base region has a symbolic
	binding.

gcc/testsuite/ChangeLog:
	PR analyzer/105285
	* gcc.dg/analyzer/symbolic-12.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-04-28 13:49:59 -04:00
David Malcolm
d8586b00dd analyzer: add .fpath.txt dumps to -fdump-analyzer-feasibility
I found this extension to -fdump-analyzer-feasibility very helpful when
debugging PR analyzer/105285.

gcc/analyzer/ChangeLog:
	* diagnostic-manager.cc (epath_finder::process_worklist_item):
	Call dump_feasible_path when a path that reaches the the target
	enode is found.
	(epath_finder::dump_feasible_path): New.
	* engine.cc (feasibility_state::dump_to_pp): New.
	* exploded-graph.h (feasibility_state::dump_to_pp): New decl.
	* feasible-graph.cc (feasible_graph::dump_feasible_path): New.
	* feasible-graph.h (feasible_graph::dump_feasible_path): New
	decls.
	* program-point.cc (function_point::print): Fix missing trailing
	newlines.
	* program-point.h (program_point::print_source_line): Remove
	unimplemented decl.

gcc/ChangeLog:
	* doc/invoke.texi (-fdump-analyzer-feasibility): Mention the
	fpath.txt output.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-04-28 13:48:41 -04:00
Patrick Palka
509fd16da8 c++: partial ordering and dependent operator expr [PR105425]
Here ever since r12-6022-gbb2a7f80a98de3 we stopped deeming the partial
specialization #2 to be more specialized than #1 ultimately because
dependent operator expressions now have a DEPENDENT_OPERATOR_TYPE type
instead of an empty type, and this made unify stop deducing T(2) == 1
for K during partial ordering for #1 and #2.

This minimal patch fixes this by making the relevant logic in unify
treat DEPENDENT_OPERATOR_TYPE like an empty type.

	PR c++/105425

gcc/cp/ChangeLog:

	* pt.cc (unify) <case TEMPLATE_PARM_INDEX>: Treat
	DEPENDENT_OPERATOR_TYPE like an empty type.

gcc/testsuite/ChangeLog:

	* g++.dg/template/partial-specialization13.C: New test.
2022-04-28 13:10:56 -04:00
Thomas Koenig
1a5ae012ff Document changes to CONVERT for -mabi-ieeelongdouble for POWER.
gcc/fortran/ChangeLog:

	* gfortran.texi: Mention r16_ieee and r16_ibm.
	* invoke.texi: Likewise.
2022-04-28 18:25:22 +02:00
Jeff Law
d993c6dea7 [committed] Fix more problems with new linker warnings
gcc/testsuite
	* gcc.dg/lto/pr94157_0.c: Revert last change.
	* lib/prune.exp (prune_gcc_output): Prune new linker warning.
2022-04-28 12:03:52 -04:00
Jakub Jelinek
cb1758d95c i386: Improve ix86_expand_int_movcc
When working on PR105338, I've noticed that in some cases we emit
unnecessarily long sequence which has then higher seq_cost than necessary.

E.g. when ix86_expand_int_movcc is called with
operands[0] (reg/v:SI 83 [ i ])
operands[1] (eq (reg/v:SI 83 [ i ]) (const_int 0 [0]))
operands[2] (reg/v:SI 83 [ i ])
operands[3] (const_int -2 [0xfffffffffffffffe])
i.e. r83 = r83 == 0 ? r83 : -2 which with my PR105338 patch is equivalent to
r83 = r83 == 0 ? 0 : -2, we emit:
(insn 24 0 25 (set (reg:CC 17 flags)
        (compare:CC (reg/v:SI 83 [ i ])
            (const_int 1 [0x1]))) 11 {*cmpsi_1}
     (nil))
(insn 25 24 26 (parallel [
            (set (reg:SI 85)
                (if_then_else:SI (ltu:SI (reg:CC 17 flags)
                        (const_int 0 [0]))
                    (const_int -1 [0xffffffffffffffff])
                    (const_int 0 [0])))
            (clobber (reg:CC 17 flags))
        ]) 1192 {*x86_movsicc_0_m1}
     (nil))
(insn 26 25 27 (set (reg:SI 85)
        (not:SI (reg:SI 85))) 683 {*one_cmplsi2_1}
     (nil))
(insn 27 26 28 (parallel [
            (set (reg:SI 85)
                (and:SI (reg:SI 85)
                    (const_int -2 [0xfffffffffffffffe])))
            (clobber (reg:CC 17 flags))
        ]) 533 {*andsi_1}
     (nil))
(insn 28 27 0 (set (reg/v:SI 83 [ i ])
        (reg:SI 85)) 81 {*movsi_internal}
     (nil))
which has seq_cost (seq, true) 24.  But it could have just cost 20
if we didn't decide to use a fresh temporary r85 and used r83 instead
- we could avoid the copy at the end.
The reason for it is in the 2 reg_overlap_mentioned_p calls,
the destination (out) indeed overlaps op0 - it is the same register,
but I don't see why that is a problem, this is in a code path where
we've already called
ix86_expand_carry_flag_compare (code, op0, op1, &compare_op)
earlier, so the fact that we've out overlaps op0 or op1 shouldn't matter
because insn 24 above is already emitted, we should just care if
it overlaps whatever we got from that ix86_expand_carry_flag_compare
call, i.e. compare_op, otherwise we can overwrite out just fine;
we also know at that point that the last 2 operands of ?: are constants.

2022-04-28  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/i386-expand.cc (ix86_expand_int_movcc): Create a
	temporary only if out overlaps compare_op, not when it overlaps
	op0 or op1.
2022-04-28 17:41:49 +02:00
Jakub Jelinek
12cc2b3299 Update crontab and git_update_version.py
2022-04-28  Jakub Jelinek  <jakub@redhat.com>

maintainer-scripts/
	* crontab: Snapshots from trunk are now GCC 13 related.
	Add GCC 12 snapshots from the respective branch.
contrib/
	* gcc-changelog/git_update_version.py (active_refs): Add
	releases/gcc-12.
2022-04-28 16:22:42 +02:00
Jakub Jelinek
091e102038 Bump BASE-VER.
2022-04-28  Jakub Jelinek  <jakub@redhat.com>

	* BASE-VER: Set to 13.0.0.
basepoints/gcc-13
2022-04-28 15:58:21 +02:00
Jakub Jelinek
b85e79dce1 cgraph: Don't verify semantic_interposition flag for aliases [PR105399]
The following testcase ICEs, because the ctors during cc1plus all have
!opt_for_fn (decl, flag_semantic_interposition) - they have NULL
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) and optimization_default_node
is for -Ofast and so has flag_semantic_interposition cleared.
During free lang data, we set DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
for the ctor which has body (or for thunks), but don't touch it for
aliases.
During lto1 optimization_default_node reflects the lto1 flags which
are -O2 rather than -Ofast and so has flag_semantic_interposition
set, for the ctor which has body that makes no difference, but as the
alias doesn't still have DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) set,
we now trigger this verification check.

The following patch just doesn't verify it for aliases during lto1.
Another possibility would be to set DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
during free lang data even for aliases.

2022-04-28  Jakub Jelinek  <jakub@redhat.com>

	PR lto/105399
	* cgraph.cc (cgraph_node::verify_node): Don't verify
	semantic_interposition flag against
	opt_for_fn (decl, flag_semantic_interposition) for aliases in lto1.

	* g++.dg/lto/pr105399_0.C: New test.
2022-04-28 15:45:33 +02:00
Thomas Schwinge
2a570f11a2 Fix up 'libgomp.oacc-fortran/print-1.f90' GCN offloading compilation [PR104717]
That got broken by recent commit b2202431910e30d8505c94d1cb9341cac7080d10
"fortran: Fix up gfc_trans_oacc_construct [PR104717]".

	PR fortran/104717
	libgomp/
	* testsuite/libgomp.oacc-fortran/print-1.f90: Add OpenACC
	privatization scanning.  For GCN offloading compilation, raise
	'-mgang-private-size'.
2022-04-28 15:15:29 +02:00
Iain Sandoe
7b96274a34 c++, coroutines: Improve check for throwing final await [PR104051].
We check that the final_suspend () method returns a sane type (i.e. a class
or structure) but, unfortunately, that check has to be later than the one
for a throwing case.  If the use returns some nonsensical type from the
method, we need to handle that in the checking for noexcept.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

	PR c++/104051

gcc/cp/ChangeLog:

	* coroutines.cc (coro_diagnose_throwing_final_aw_expr): Handle
	non-target expression inputs.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr104051.C: New test.
2022-04-28 13:55:09 +01:00
Iain Sandoe
6cae3bb65c c++, coroutines: Account for overloaded promise return_value() [PR105301].
Whether it was intended or not, it is possible to define a coroutine promise
with multiple return_value() methods [which need not even have the same type].

We were not accounting for this possibility in the check to see whether both
return_value and return_void are specifier (which is prohibited by the
standard).  Fixed thus and provided an adjusted diagnostic for the case that
multiple return_value() methods are present.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

	PR c++/105301

gcc/cp/ChangeLog:

	* coroutines.cc (coro_promise_type_found_p): Account for possible
	mutliple overloads of the promise return_value() method.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr105301.C: New test.
2022-04-28 13:52:23 +01:00
Iain Sandoe
15a176a833 c++, coroutines: Make sure our temporaries are in a bind expr [PR105287]
There are a few cases where we can generate a temporary that does not need
to be added to the coroutine frame (i.e. these are genuinely ephemeral).  The
intent was that unnamed temporaries should not be 'promoted' to coroutine
frame entries.  However there was a thinko and these were not actually ever
added to the bind expressions being generated for the expanded awaits.  This
meant that they were showing in the global namspace, leading to an empty
DECL_CONTEXT and the ICE reported.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

	PR c++/105287

gcc/cp/ChangeLog:

	* coroutines.cc (maybe_promote_temps): Ensure generated temporaries
	are added to the bind expr.
	(add_var_to_bind): Fix local var naming to use portable punctuation.
	(register_local_var_uses): Do not add synthetic names to unnamed
	temporaries.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr105287.C: New test.
2022-04-28 13:51:44 +01:00
Nathan Sidwell
9cb1f565a9 c++, coroutines: Avoid expanding within templates [PR103868]
This is a forward-port of a patch by Nathan (against 10.x) which fixes an open
PR.

We are ICEing because we ended up tsubst_copying something that had already
been tsubst, leading to an assert failure (mostly such repeated tsubsting is
harmless).

We had a non-dependent co_await in a non-dependent-type template fn, so we
processed it at definition time, and then reprocessed at instantiation time.
We fix this here by deferring substitution while processing templates.

Additional observations (for a better future fix, in the GCC13 timescale):

Exprs only have dependent type if at least one operand is dependent which was
what the current code was intending to do.  Coroutines have the additional
wrinkle, that the current fn's type is an implicit operand.

So, if the coroutine function's type is not dependent, and the operand is not
dependent, we should determine the type of the co_await expression using the
DEPENDENT_EXPR wrapper machinery.  That allows us to determine the
subexpression type, but leave its operand unchanged and then instantiate it
later.

	PR c++/103868

gcc/cp/ChangeLog:

	* coroutines.cc (finish_co_await_expr): Do not process non-dependent
	coroutine expressions at template definition time.
	(finish_co_yield_expr): Likewise.
	(finish_co_return_stmt): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr103868.C: New test.

Co-Authored-by: Iain Sandoe <iain@sandoe.co.uk>
2022-04-28 13:50:59 +01:00
Iain Sandoe
d314907fc4 testsuite,X86: Fix missing USER_LABEL_PREFIX cases.
Yet another set of testcases that do not account for targets that
use __USER_LABEL_PREFIX__.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/testsuite/ChangeLog:

	* gcc.target/i386/memcpy-strategy-10.c: Account for
	__USER_LABEL_PREFIX__.
	* gcc.target/i386/memcpy-strategy-5.c: Likewise.
	* gcc.target/i386/memset-strategy-5.c: Likewise.
	* gcc.target/i386/memset-strategy-7.c: Likewise.
2022-04-28 13:48:30 +01:00
Iain Sandoe
350fcc7884 testsuite: Add target requires for ifuncs to mv31.C.
g++.target/i386/mv31.C fails on targets without ifuncs support so add
the necessary target supports guard.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/testsuite/ChangeLog:

	* g++.target/i386/mv31.C: Add target supports guard for ifuncs.
2022-04-28 13:45:29 +01:00
Marek Polacek
851031b2fc c++: global-namespace-qualified var after class def [PR90107]
Here we wrongly reject the definition of "::N::a"

  struct A;
  namespace N { extern A a; }
  struct A {} ::N::a;

because our code to diagnose a missing ; after a class definition doesn't
realize that :: can follow a class definition.

	PR c++/90107

gcc/cp/ChangeLog:

	* parser.cc (cp_parser_class_specifier_1): Accept :: after a class
	definition.

gcc/testsuite/ChangeLog:

	* g++.dg/parse/qualified6.C: New test.
2022-04-28 08:37:45 -04:00
Jonathan Wakely
4e117418fb libstdc++: Fix error reporting in filesystem::copy [PR99290]
The recursive calls to filesystem::copy should stop if any of them
reports an error.

libstdc++-v3/ChangeLog:

	PR libstdc++/99290
	* src/c++17/fs_ops.cc (fs::copy): Pass error_code to
	directory_iterator constructor, and check on each iteration.
	* src/filesystem/ops.cc (fs::copy): Likewise.
	* testsuite/27_io/filesystem/operations/copy.cc: Check for
	errors during recursion.
	* testsuite/experimental/filesystem/operations/copy.cc:
	Likewise.
2022-04-28 13:33:48 +01:00
Iain Buclaw
d91cb2059f d: Merge upstream dmd 313d28b3d, druntime e361d200.
D front-end changes:

    - Import latest bug fixes from the 2.100 release branch.
    - Fix signatures of extern C++ functions that have size_t
      parameters.

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 313d28b3d.
	* d-port.cc (Port::memicmp): Use d_size_t instead of size_t.
	(Port::valcpy): Likewise.

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime e361d200.
2022-04-28 12:58:12 +02:00
Jakub Jelinek
89dbf9a5f5 i386: Fix up ix86_gimplify_va_arg [PR105331]
On the following testcase we emit a bogus
'va_arg_tmp.5' may be used uninitialized
warning.  The reason is that when gimplifying the addr = &temp;
statement, the va_arg_tmp temporary var for which we emit ADDR_EXPR
is not TREE_ADDRESSABLE, prepare_gimple_addressable emits some extra
code to initialize the newly addressable var from its previous value,
but it is a new variable which hasn't been initialized yet and will
be later, so we end up initializing it with uninitialized SSA_NAME:
  va_arg_tmp.6 = va_arg_tmp.5_14(D);
  addr.2_16 = &va_arg_tmp.6;
  _17 = MEM[(double *)sse_addr.4_13];
  MEM[(double * {ref-all})addr.2_16] = _17;
and with -O1 we actually don't DSE it before the warning is emitted.
If we make the temp TREE_ADDRESSABLE before the gimplification, then
this prepare_gimple_addressable path isn't taken and we effectively
omit the first statement above and so the bogus warning is gone.

I went through other backends and didn't find another instance of this
problem.

2022-04-28  Jakub Jelinek  <jakub@redhat.com>

	PR target/105331
	* config/i386/i386.cc (ix86_gimplify_va_arg): Mark va_arg_tmp
	temporary TREE_ADDRESSABLE before trying to gimplify ADDR_EXPR
	of it.

	* gcc.dg/pr105331.c: New test.
2022-04-28 12:33:59 +02:00
Jonathan Wakely
8094526109 doc: Remove misleading text about multilibs for IEEE long double
The choice of ieee or ibm long double format is orthogonal to multilibs,
as the two sets of symbols co-exist and don't need a separate multilib.

gcc/ChangeLog:

	* doc/install.texi (Configuration): Remove misleading text
	around LE PowerPC Linux multilibs.
2022-04-28 10:41:29 +01:00
François Dumont
f39fcafbc0 libstdc++: Remove redundant line in versioned namespace linker script
This doesn't match anything.

libstdc++-v3/ChangeLog:

	* config/abi/pre/gnu-versioned-namespace.ver: Remove
	std::random_device::* pattern.
2022-04-28 10:03:12 +01:00
Rainer Orth
4e4f550a5b doc: Document Solaris D bootstrap requirements [PR 103528]
This patch documents the Solaris-specific D bootstrap requirements.

Tested by building and inspecting gccinstall.{pdf,info}.


2022-03-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	PR d/103528
	* doc/install.texi (Tools/packages necessary for building GCC)
	(GDC): Document libphobos requirement.
	(Host/target specific installation notes for GCC, *-*-solaris2*):
	Document libphobos and GDC specifics.
2022-04-28 10:27:32 +02:00
Richard Biener
f27848a5dc tree-optimization/105219 - bogus max iters for vectorized epilogue
The following makes sure to take into account prologue peeling
when trying to narrow down the maximum number of iterations
computed for the vectorized epilogue.  A similar issue exists when
peeling for gaps.

2022-04-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105219
	* tree-vect-loop.cc (vect_transform_loop): Disable
	special code narrowing the vectorized epilogue max
	iterations when peeling for alignment or gaps was in effect.

	* gcc.dg/vect/pr105219.c: New testcase.
2022-04-28 08:06:52 +02:00
Kewen Lin
84c1c9b013 testsuite: Add test case for pack/unpack bifs at soft-float [PR105334]
This patch is to add the test coverage for the two recent fixes
r12-8091 and r12-8226 from Segher, aix is skipped since it takes
soft-float and long-double-128 incompatible.

	PR target/105334

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/pr105334.c: New test.
2022-04-27 22:34:27 -05:00
Jia-Wei Chen
d5b66a9053 testsuite: Skip target not support -pthread [PR104676].
The "ftree-parallelize-loops=" imply -pthread option in gcc/gcc.cc,
some target are not support pthread like elf target use newlib,
and will get an error:

"*-*-elf-gcc: error: unrecognized command-line option '-pthread'"

so we add an additional condition "{target pthread}" to make sure the
dg-additional-options runs on support targets.

gcc/testsuite/ChangeLog

	PR target/104676
	* gcc.dg/torture/pr104676.c: Add "{target pthread}" check.
2022-04-28 11:22:39 +08:00
Xi Ruoyao
d1ee29fd7f loongarch: ignore zero-size fields in calling convention
gcc/

	* config/loongarch/loongarch.cc
	(loongarch_flatten_aggregate_field): Ignore empty fields for
	RECORD_TYPE.

gcc/testsuite/

	* gcc.target/loongarch/zero-size-field-pass.c: New test.
	* gcc.target/loongarch/zero-size-field-ret.c: New test.
2022-04-28 09:20:40 +08:00
GCC Administrator
ba949a6af4 Daily bump. 2022-04-28 00:16:52 +00:00
Jason Merrill
e3947ea7f3 c++: add comments
gcc/cp/ChangeLog:

	* tree.cc (strip_typedefs): Add default argument comments.
2022-04-27 19:49:37 -04:00
Thomas Koenig
58e4a744b6 Fix oversight from previous commit to pr70673.
gcc/testsuite/ChangeLog:

	* gfortran.dg/pr70673.f90: Removed second invalid
	line.
2022-04-27 22:42:04 +02:00
Marek Polacek
409edcca33 c++: enum in generic lambda at global scope [PR105398]
We crash compiling this test since r11-7993 which changed
lookup_template_class_1 so that we only call tsubst_enum when

  !uses_template_parms (current_nonlambda_scope ())

But here current_nonlambda_scope () is the global NAMESPACE_DECL ::, which
doesn't have a type, therefore is considered type-dependent.  So we don't
call tsubst_enum, and crash in tsubst_copy/CONST_DECL because we didn't
find the e1 enumerator.

I don't think any namespace can depend on any template parameter, so
this patch tweaks uses_template_parms.

	PR c++/105398

gcc/cp/ChangeLog:

	* pt.cc (uses_template_parms): Return false for any NAMESPACE_DECL.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/lambda-generic-enum2.C: New test.
2022-04-27 13:09:05 -04:00
Jakub Jelinek
948e8e4010 testsuite: Add testcase for dangling pointer equality bogus warning [PR104492]
On Wed, Apr 27, 2022 at 12:02:33PM +0200, Richard Biener wrote:
> I did that but the reduction result did not resemble the same failure
> mode.  I've failed to manually construct a testcase as well.  Possibly
> a testcase using libstdc++ but less Qt internals might be possible.

Here is a testcase that I've managed to reduce, FAILs with:
FAIL: g++.dg/warn/pr104492.C  -std=gnu++14  (test for bogus messages, line 111)
FAIL: g++.dg/warn/pr104492.C  -std=gnu++17  (test for bogus messages, line 111)
FAIL: g++.dg/warn/pr104492.C  -std=gnu++20  (test for bogus messages, line 111)
on both x86_64-linux and i686-linux without your commit and passes with it.

2022-04-27  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/104492
	* g++.dg/warn/pr104492.C: New test.
2022-04-27 18:47:10 +02:00
Thomas Koenig
f654140140 Split test to remove failing run time test and add check for ICE.
gcc/testsuite/ChangeLog:

	PR fortran/70673
	PR fortran/78054
	* gfortran.dg/pr70673.f90: Remove invalid statement.
	* gfortran.dg/pr70673_2.f90: New test to check that
	ICE does not re-appear.
2022-04-27 18:40:18 +02:00
Jakub Jelinek
a71b107013 libstdc++: Update {x86_64,i?86,aarch64,s390x,ppc{,64,64le}} baseline_symbols.txt
The following patch updates baseline_symbols.txt on arches where I have
latest libstdc++ builds (my ws + Fedora package builds).
I've manually excluded:
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11ImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11ItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11ImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11ItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
additions on ppc64le as those look unexpected.
Those symbols didn't show up in Fedora 11.3.1 build with recent glibc,
while other GLIBCXX_IEEE128_3.4.29 symbols are in 11.x already.

What this patch includes are only @@GLIBCXX_3.4.30 symbol additions, same
symbols on all files, except that powerpc64 adds also
_ZNSt17__gnu_cxx_ieee12816__convert_from_vERKP15__locale_structPciPKcz@@GLIBCXX_IEEE128_3.4.30
so everything included in the patch looks right to me.

2022-04-27  Jakub Jelinek  <jakub@redhat.com>

	* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
	* config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Update.
2022-04-27 17:30:09 +02:00
Jonathan Wakely
a849584587 libstdc++: Add pretty printer for std::atomic
For the atomic specializations for shared_ptr and weak_ptr we can reuse
the existing SharedPointerPrinter, with a small tweak.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (SharedPointerPrinter): Add
	support for atomic<shared_ptr<T>> and atomic<weak_ptr<T>>.
	(StdAtomicPrinter): New printer.
	(build_libstdcxx_dictionary): Register new printer.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Test std::atomic.
	* testsuite/libstdc++-prettyprinters/cxx20.cc: Test atomic smart
	pointers.
2022-04-27 15:48:32 +01:00
Sebastian Huber
e07ea03fce ada: Fix build for RTEMS
Commit 621cccba3f8b0cd2757feda171e66e3820b55c2c broke the Ada build for all
RTEMS targets except aarch64.

gcc/ada/

	* tracebak.c: Add support for ARM RTEMS. Add support for RTEMS to PPC
	ELF.  Add support for RTEMS to SPARC.  Merge aarch64 support of Linux
	and RTEMS.
2022-04-27 15:25:00 +02:00