Commit graph

218350 commits

Author SHA1 Message Date
GCC Administrator
a03e863975 Daily bump. 2025-03-19 00:17:56 +00:00
Georg-Johann Lay
16065b6239 AVR: target/119355 - Fix ICE in pass avr-fuse-move / -mfuse-move.
This ICE only occurred when the compiler is built with, say
CXXFLAGS='-Wp,-D_GLIBCXX_ASSERTIONS'.  The problem was that
a value from an illegal REGNO was read.  The value was not
used in these cases, but the access triggered an assertion
due to reading past std::array.

gcc/
	PR target/119355
	* config/avr/avr-passes.cc (memento_t::apply): Only
	read values[p.arg] when it is actually used.
2025-03-18 21:44:00 +01:00
Marek Polacek
6fc1f70f0b c++: ICE with ptr-to-member-fn [PR119344]
This ICE appeared with the removal of NON_DEPENDENT_EXPR.  Previously
skip_simple_arithmetic would get NON_DEPENDENT_EXPR<CAST_EXPR<>> and
since NON_DEPENDENT_EXPR is neither BINARY_CLASS_P nor UNARY_CLASS_P,
there was no problem.  But now we pass just CAST_EXPR<> and a CAST_EXPR
is a tcc_unary, so we extract its null operand and crash.

skip_simple_arithmetic is called from save_expr.  cp_save_expr already
avoids calling save_expr in a template, so that seems like an appropriate
way to fix this.

	PR c++/119344

gcc/cp/ChangeLog:

	* typeck.cc (cp_build_binary_op): Use cp_save_expr instead of save_expr.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2025-03-18 16:32:26 -04:00
Jason Merrill
145c907206 c++: constexpr ref template arg [PR119194]
Here we were assuming that a constant variable appearing in a template
argument is used for its value.  We also need to handle seeing its address
taken.

	PR c++/119194

gcc/cp/ChangeLog:

	* decl2.cc (min_vis_expr_r) [ADDR_EXPR]: New case.

gcc/testsuite/ChangeLog:

	* g++.dg/template/linkage7.C: New test.
2025-03-18 16:20:22 -04:00
Marek Polacek
6751bd4ac4 c++: ICE when substituting packs into type aliases [PR118104]
r12-1094 mentions that adding the assert didn't lead to any regressions
in the testsuite, but this test case demonstrates that we can reach it
with valid code.

Here we arrive in use_pack_expansion_extra_args_p with t which is an
expansion whose pattern is void(Ts, Us) and tparm packs are {Us, Ts},
and parm_packs is { Ts -> <int, int>, Us -> <A, P...> }.  We want to
expand the pack into void(int, A) and void(int, P...).  We compare
int to A, which is fine, but then int to P... which crashes.  But
the code is valid so this patch removes the assert.

	PR c++/118104

gcc/cp/ChangeLog:

	* pt.cc (use_pack_expansion_extra_args_p): Remove an assert.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alias-decl-variadic3.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2025-03-18 16:09:04 -04:00
Iain Sandoe
57d1424efe cobol: Remove dead code from the driver.
EXEC_LIB is no longer defined anywhere, so that the dependent code is
now dead.  The rpath code (if required) would need to be conditional
since rpath support is not available on all hosts.  Remove now and then
address if/when it is needed (other drivers do not do this).

gcc/cobol/ChangeLog:

	* gcobolspec.cc (append_rpath): Remove.
	(lang_specific_driver): Remove hard-wired rpath and library
	names.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-18 20:05:27 +00:00
Iain Sandoe
544a9d9e49 gcc, cobol: Check for get_current_dir_name [PR119301]
This adds a configure check for get_current_dir_name and falls back
to getcwd() if it is not available on the host.

	PR cobol/119301

gcc/cobol/ChangeLog:

	* util.cc: Check for the availability of get_current_dir_name
	snf fall back to getcwd() if it is not present on the host.

gcc/ChangeLog:

	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Add check for get_current_dir_name.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-18 20:04:47 +00:00
Iain Buclaw
1ad1bcc991 libphobos: Fix std.getopt doesn't accept const(string)[] anymore
Instead of passing receiver into the conversion function, just return
the value and assign it to the receiver. Renamed the conversion function
and also cleaned up all the `typeof' calls, which were very verbose.

libphobos/ChangeLog:

	* src/MERGE: Merge upstream phobos 79cbde1ab.

Reviewed-on: https://github.com/dlang/phobos/pull/10684
2025-03-18 19:44:18 +01:00
Iain Buclaw
ef4248460d libphobos: Avoid setting union members in std.json, set the whole union instead
libphobos/ChangeLog:

	* src/MERGE: Merge upstream phobos cafe86453.

Reviewed-on: https://github.com/dlang/phobos/pull/10683
2025-03-18 19:44:18 +01:00
Marc Poulhiès
d4fe08c2d4 rust: force cargo to build offline
gcc/rust/Changelog:
	PR rust/119333

	* Make-lang.in: Force offline mode for cargo

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-03-18 19:34:31 +01:00
Arthur Cohen
b9a4399ac5 gccrs: polonius: Vendor Rust dependencies
This fixes PR #119333 by allowing our borrow-checker interface to be built
offline. This was already done for our components in libgrust/, but had never been
done for the borrow-checker.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119333

gcc/rust/ChangeLog:

	* checks/errors/borrowck/ffi-polonius/.cargo/config.toml: New file, force vendored deps.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/.cargo-checksum.json: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/CODE_OF_CONDUCT.md: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/Cargo.toml: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/LICENSE-APACHE: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/LICENSE-MIT: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/README.md: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/RELEASES.md: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/examples/borrow_check.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/examples/graspan1.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/join.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/lib.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/map.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/test.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/treefrog.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/.cargo-checksum.json: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/CHANGELOG.md: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/Cargo.toml: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/LICENSE-APACHE: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/LICENSE-MIT: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/README.md: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/benches/value.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/__private_api.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/error.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/key.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/mod.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/source.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/value.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/lib.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/macros.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/serde.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/log/triagebot.toml: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/.cargo-checksum.json: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/Cargo.toml: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/README.md: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/facts.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/lib.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/datafrog_opt.rs:
	New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/initialization.rs:
	New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/liveness.rs:
	New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/location_insensitive.rs:
	New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/mod.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/naive.rs: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/.cargo-checksum.json: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/CODE_OF_CONDUCT.md: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/Cargo.toml: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/LICENSE-APACHE: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/LICENSE-MIT: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/README.md: New file.
	* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/src/lib.rs: New file.
2025-03-18 19:34:30 +01:00
Harald Anlauf
6cbeab134f Fortran: check type-spec in ALLOCATE of dummy with assumed length [PR119338]
PR fortran/119338

gcc/fortran/ChangeLog:

	* resolve.cc (resolve_allocate_expr): Check F2003:C626: Type-spec
	in ALLOCATE of an assumed-length character dummy argument shall be
	an asterisk.

gcc/testsuite/ChangeLog:

	* gfortran.dg/deferred_character_18.f90: Adjust testcase.
	* gfortran.dg/allocate_assumed_charlen_5.f90: New test.
2025-03-18 18:56:08 +01:00
Iain Buclaw
a03e9d4932 d: Add missing Declaration bitfield setters/getters
gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd fde0f8c40a.

Reviewed-on: https://github.com/dlang/dmd/pull/21014
2025-03-18 18:53:11 +01:00
Iain Buclaw
b3b54f9c9a libphobos: Merge changes in upstream druntime testsuite
libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime d2ee11364c.
	* testsuite/libphobos.aa/test_aa.d: Add new test.
	* testsuite/libphobos.betterc/test19933.d: Adjust imports.
	* testsuite/libphobos.config/test22523.d: Likewise.
	* testsuite/libphobos.exceptions/assert_fail.d: Adjust test.
	* testsuite/libphobos.exceptions/chain.d: Adjust imports.
	* testsuite/libphobos.exceptions/future_message.d: Likewise.
	* testsuite/libphobos.exceptions/line_trace.d: Likewise.
	* testsuite/libphobos.exceptions/long_backtrace_trunc.d: Likewise.
	* testsuite/libphobos.exceptions/static_dtor.d: Likewise.
	* testsuite/libphobos.gc/forkgc.d: Likewise.
	* testsuite/libphobos.gc/precisegc.d: Likewise.
	* testsuite/libphobos.gc/recoverfree.d: Likewise.
	* testsuite/libphobos.hash/test_hash.d: Likewise.
	* testsuite/libphobos.init_fini/custom_gc.d: Likewise.
	* testsuite/libphobos.init_fini/thread_join.d: Likewise.
	* testsuite/libphobos.thread/external_threads.d: Likewise.
	* testsuite/libphobos.thread/fiber_guard_page.d: Likewise.
	* testsuite/libphobos.thread/tlsgc_sections.d: Likewise.
	* testsuite/libphobos.thread/tlsstack.d: Likewise.
	* testsuite/libphobos.unittest/customhandler.d: Likewise.
2025-03-18 18:53:11 +01:00
Iain Buclaw
f2af60465c d: Update the copyright years of dmd sources to 2025
gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 51be8bb729.

Reviewed-on: https://github.com/dlang/dmd/pull/20958
2025-03-18 18:53:11 +01:00
Jakub Jelinek
53d8ed13bb c: Fix handling of [[gnu::musttail] return in if and else bodies [PR119311]
The following new testcase FAILs with C (and succeeds with C++).
c_parser_handle_musttail is used in c_parser_compound_statement_nostart
where it is directly passed to c_parser_statement_after_labels, and in
c_parser_all_labels where it is returned.  Now, out of the 3
c_parser_all_labels callers, c_parser_statement passes it down to
c_parser_statement_after_labels, but c_parser_if_body and c_parser_else_body
don't, so if there are return statements with [[gnu::musttail]] or
[[clang::musttail]] directly in if or else bodies rather than wrapped with
{}s, we throw that information away.

2025-03-18  Jakub Jelinek  <jakub@redhat.com>

	PR c/119311
	* c-parser.cc (c_parser_if_body): Pass result of c_parser_all_labels
	as last argument to c_parser_statement_after_labels.
	(c_parser_else_body): Likewise.

	* c-c++-common/musttail14.c: Use * instead of \* in the regexps.
	* c-c++-common/musttail25.c: New test.
2025-03-18 18:51:48 +01:00
Jakub Jelinek
1d7f57da58 c, c++: Support musttail attribute even using __attribute__ form [PR116545]
Apparently some programs in the wild use
 #if __has_attribute(musttail)
   __attribute__((musttail)) return foo ();
 #else
   return foo ();
 #endif
clang supports musttail both as a standard attribute ([[clang::musttail]]
which we also support for compatibility) and the above worked just
fine with GCC 14 which had __has_attribute(musttail) 0.  Now that it is
0, this doesn't compile anymore.
So, either we need to ensure that __has_attribute(musttail) is 0
and just __has_c{,pp}_attribute({gnu,clang}::musttail) are non-zero,
or IMHO better we just make it work in the attribute form, especially for
C < C23 I can see why some projects would prefer that form.
While [[gnu::musttail]] is rejected as an error in C11 etc. before GCC 15,
rather than just handled as an unknown attribute.
I view this as both a regression and compatibility issue.
The patch handles it in similar spots to fallthrough/assume attributes
inside of __attribute__ for C, and for C++ enables mixing of standard [[]]
and GNU __attribute__(()) attributes at the start of statements in any order.

While working on it, I've noticed we weren't diagnosing arguments to the
clang::musttail attribute (fixed by the c-attribs.cc hunk) and newly
on the __attribute__ form attribute (in that case the arguments aren't just
skipped, they are always parsed and because we don't call decl_attributes
etc., it wouldn't be diagnosed without a manual check).

2025-03-18  Jakub Jelinek  <jakub@redhat.com>

	PR c/116545
gcc/
	* doc/extend.texi (musttail statement attribute): Document
	that musttail GNU attribute can be used as well.
gcc/c-family/
	* c-attribs.cc (c_common_clang_attributes): Add musttail.
gcc/c/
	* c-parser.cc (c_parser_declaration_or_fndef): Parse
	__attribute__((musttail)) return.
	(c_parser_handle_musttail): Diagnose attribute arguments.
	(c_parser_statement_after_labels): Parse
	__attribute__((musttail)) return.
gcc/cp/
	* parser.cc (cp_parser_statement): Call cp_parser_attributes_opt
	rather than cp_parser_std_attribute_spec_seq.
	(cp_parser_jump_statement): Diagnose gnu::musttail attributes
	with no arguments.
gcc/testsuite/
	* c-c++-common/attr-fallthrough-2.c: Adjust expected diagnostics
	for C++.
	* c-c++-common/musttail15.c: New test.
	* c-c++-common/musttail16.c: New test.
	* c-c++-common/musttail17.c: New test.
	* c-c++-common/musttail18.c: New test.
	* c-c++-common/musttail19.c: New test.
	* c-c++-common/musttail20.c: New test.
	* c-c++-common/musttail21.c: New test.
	* c-c++-common/musttail22.c: New test.
	* c-c++-common/musttail23.c: New test.
	* c-c++-common/musttail24.c: New test.
	* g++.dg/musttail7.C: New test.
	* g++.dg/musttail8.C: New test.
	* g++.dg/musttail12.C: New test.
	* g++.dg/musttail13.C: New test.
	* g++.dg/musttail14.C: New test.
	* g++.dg/ext/pr116545.C: New test.
2025-03-18 18:51:10 +01:00
Joseph Myers
05e20b7841 Update cpplib fr.po, sv.po
* fr.po, sv.po: Update.
2025-03-18 17:48:07 +00:00
Richard Biener
9c9d2fdaa5 Populate -original dump for Cobol
The following implements -fdump-tree-original dumping for cobol,
mimicing what the D frontend does.

gcc/cobol/
	* gengen.cc (gg_finalize_function): Dump to TDI_original.
2025-03-18 18:26:27 +01:00
Bob Dubner
82bb1890ae cobol: Fifteen new cobol.dg testscases.
gcc/testsuite

	* cobol.dg/group1/check_88.cob: New testcase.
	* cobol.dg/group1/comp5.cob: Likewise.
	* cobol.dg/group1/declarative_1.cob: Likewise.
	* cobol.dg/group1/display.cob: Likewise.
	* cobol.dg/group1/display2.cob: Likewise.
	* cobol.dg/group1/line-sequential.cob: Likewise.
	* cobol.dg/group1/multiple-compares.cob: Likewise.
	* cobol.dg/group1/multiply2.cob: Likewise.
	* cobol.dg/group1/packed.cob: Likewise.
	* cobol.dg/group1/perform-nested-exit.cob: Likewise.
	* cobol.dg/group1/pointer1.cob: Likewise.
	* cobol.dg/group1/simple-arithmetic.cob: Likewise.
	* cobol.dg/group1/simple-classes.cob: Likewise.
	* cobol.dg/group1/simple-if.cob: Likewise.
	* cobol.dg/group1/simple-perform.cob: Likewise.
2025-03-18 12:30:39 -04:00
Michael Matz
8333f1c7e6 doc: regenerate rs6000/rs6000.opt.urls
which I forgot and the autobuilder complained.

	* config/rs6000/rs6000.opt.urls: Regenerate.
2025-03-18 17:22:27 +01:00
Bob Dubner
c49382fd22 cobol: Bring the code base into compliance with C++14
gcc/cobol

	* cdf.y: Make compatible with C++14.
	* copybook.h: Likewise.
	* dts.h: Likewise.
	* except.cc: Likewise.
	* genapi.cc: Likewise.
	* genutil.cc: Likewise.
	* genutil.h: Likewise.
	* lexio.cc: Likewise.
	* parse.y: Likewise.
	* parse_ante.h: Likewise.
	* show_parse.h: Likewise.
	* symbols.cc: Likewise.
	* symbols.h: Likewise.
	* util.cc: Likewise.
2025-03-18 12:19:15 -04:00
Jakub Jelinek
563e6d926d testsuite: Add support for dg-output-file directive
The COBOL tests has many tests which just dump emit lots of output
to stdout and want to compare it against expected output.
We have the dg-output directive, but if one needs more than dozens
of lines in the output, adding hundreds of dg-output directives to
each source uses too much memory and is harder to maintain.

The following patch offers an alternative, dg-output-file
directive where one can supply a text file with expected output
(no regexp matching in that case, just exact output, except that it
handles different line ending styles (for the expected file
using tcl gets, for the actual output skips over \n, \r\n or \r).
And a newline at the end of the whole output is optional (in the actual
output, because I think some boards get it eaten).

Also tested with addition or subtraction of some characters from the
expected output files and saw FAILs with appropriate messages.

2025-03-18  Jakub Jelinek  <jakub@redhat.com>

	* doc/sourcebuild.texi (dg-output-file): Document.

	* lib/gcc-dg.exp (${tool}-load): If output-file is set, compare
	combined output against content of the [lindex ${output-file} 1]
	file.
	(dg-output-file): New directive.
	* lib/dg-test-cleanup.exp (cleanup-after-saved-dg-test): Clear
	output-file variable.
	* gcc.dg/dg-output-file-1.c: New test.
	* gcc.dg/dg-output-file-1-lp64.txt: New test.
	* gcc.dg/dg-output-file-1-ilp32.txt: New test.
2025-03-18 16:50:05 +01:00
Patrick Palka
51b1c0a2dd c++: memfn pointer as NTTP argument considered unused [PR119233]
This is just the member function pointer version of PR c++/105848,
in which our non-dependent call pruning may cause us to not mark an
otherwise unused function pointer template argument as used.

	PR c++/119233

gcc/cp/ChangeLog:

	* pt.cc (mark_template_arguments_used): Also handle member
	function pointers.

gcc/testsuite/ChangeLog:

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

Reviewed-by: Jason Merrill <jason@redhat.com>
2025-03-18 11:38:33 -04:00
Matthias Klose
d1fd9da39a Build and install gcobol driver for the cross build
gcc/cobol/

2025-03-18  Matthias Klose  <doko@ubuntu.com>

	* Make-lang.in (GCOBC_TARGET_INSTALL_NAME, gcobol-cross): New.
	(cobol.all.cross): Depend on gcobol-cross.
	(cobol.install-common): Adjust install for the cross build.
	(cobol.uninstall): Use *_INSTALL_NAME for uninstall.
2025-03-18 16:12:37 +01:00
Iain Sandoe
2688450450 cobol: Avoid a use of auto.
In this case the deduction for Darwin's implementation is 'char *' which
then conflicts with the second use of data.initial in the find_if
callback.  Let's just specify it as 'const char *'.

gcc/cobol/ChangeLog:

	* util.cc (cbl_field_t::report_invalid_initial_value): Avoid
	auto here and specify const char *.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-18 14:48:07 +00:00
Andrew Pinski
cfbabe10dd SCC-Copy: Add More Debug dumps
While debugging a failure, I noticed that SCC copy didn't print
out what it was doing, e.g. replacing name1 with name 2.
This adds that dump.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

	* gimple-ssa-sccopy.cc (scc_copy_prop::replace_scc_by_value): Dump
	what is being replaced with what.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-03-18 07:45:48 -07:00
Tomasz Kamiński
453d42046c libstdc++: Add P1206R7 from_range members to unordered maps [PR111055]
This is another piece of P1206R7, adding new members to std::unordered_map
and std::unordered_multimap.

	PR libstdc++/111055

libstdc++-v3/ChangeLog:

	* include/bits/unordered_map.h (unordered_map): Define from_range
	constructors and insert_range member.
	(unordered_multimap): Likewise.
	* testsuite/23_containers/unordered_multimap/cons/from_range.cc:
	New test.
	* testsuite/23_containers/unordered_multimap/modifiers/insert_range.cc:
	New test.
	* testsuite/23_containers/unordered_map/cons/from_range.cc:
	New test.
	* testsuite/23_containers/unordered_map/modifiers/insert_range.cc:
	New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-18 15:27:02 +01:00
Tomasz Kamiński
5f033bf164 libstdc++: Add P1206R7 from_range members to unordered sets [PR111055]
This is another piece of P1206R7, adding new members to std::unordered_set
and std::unordered_multiset.

	PR libstdc++/111055

libstdc++-v3/ChangeLog:

	* include/bits/hashtable.h (_M_rehash_insert)
	(_M_insert_range_multi): Extracted rehashing for range insertion
	to separate function.
	* include/bits/unordered_set.h (unordered_set): Define from_range
	constructors and insert_range member.
	(unordered_multiset) Likewise.
	* testsuite/23_containers/unordered_multiset/cons/from_range.cc:
	New test.
	* testsuite/23_containers/unordered_multiset/modifiers/insert_range.cc:
	New test.
	* testsuite/23_containers/unordered_set/cons/from_range.cc:
	New test.
	* testsuite/23_containers/unordered_set/modifiers/insert_range.cc:
	New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-18 15:12:53 +01:00
Jakub Jelinek
ded45b72aa lra: Handle SUBREG in lra_rtx_hash [PR119307]
The following testcase ICEs starting with r15-3213 in
decompose_normal_address and starting with r15-3288 ICEs
in lra_rtx_hash, which since r8-5466 can't handle SUBREG
(previously SUBREG was "ei" and lra_rtx_hash can handle
that through
val += lra_rtx_hash (XEXP (x, i));
for e and
val += XINT (x, i);
for i, now it is "ep" where p stands for poly_uint16).

The following patch fixes it by handling SUBREG directly, a variant
could be instead add
        case 'p':
          for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
            val += SUBREG_BYTE (x).coeffs[i];
          break;
if you prefer that more (p is used solely for SUBREG and e.g. rtx_equal_p
has
        case 'p':
          if (maybe_ne (SUBREG_BYTE (x), SUBREG_BYTE (y)))
            return false;
          break;
).  Given the above rtx_equal_p snippet and that lra_rtx_hash
is solely used in invariant_hash (and recursion) and invariant_eq_p
uses rtx_equal_p we'll never consider different SUBREGs of the same thing
as the same invariant.

2025-03-18  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/119307
	* lra.cc (lra_rtx_hash): Handle SUBREG.

	* gcc.target/i386/pr119307.c: New test.
2025-03-18 14:57:41 +01:00
Tomasz Kamiński
5c2c015538 libstdc++: Add P1206R7 from_range members to ordered sets [PR111055]
This is another piece of P1206R7, adding new members to std::set
and std::multiset.

	PR libstdc++/111055

libstdc++-v3/ChangeLog:

	* include/bits/stl_multiset.h: (inser_range)
	(multiset(from_range_t, _Rg&&, const _Compare&, const _Alloc&))
	(multiset(from_range_t, _Rg&&, const _Alloc&)):	Define.
	* include/bits/stl_set.h: (set(from_range_t, _Rg&&, const _Alloc&))
	(set(from_range_t, _Rg&&, const _Compare&, const _Alloc&), insert_range):
	Define.
	* testsuite/23_containers/multiset/cons/from_range.cc: New test.
	* testsuite/23_containers/multiset/modifiers/insert/insert_range.cc:
	New test.
	* testsuite/23_containers/set/cons/from_range.cc: New test.
	* testsuite/23_containers/set/modifiers/insert/insert_range.cc:
	New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-03-18 14:44:11 +01:00
Tomasz Kamiński
8744d53db1 libstdc++: Add P1206R7 from_range members to ordered maps [PR111055]
This is another piece of P1206R7, adding new members to std::map
and std::multimap.

	PR libstdc++/111055

libstdc++-v3/ChangeLog:

	* include/bits/ranges_base.h (__detail::__range_to_alloc_type):
	Define.
	* include/bits/stl_multimap.h: (inser_range)
	(multimap(from_range_t, _Rg&&, const _Compare&, const _Alloc&))
	(multimap(from_range_t, _Rg&&, const _Alloc&)): Define.
	* include/bits/stl_map.h: (map(from_range_t, _Rg&&, const _Alloc&)) i
	(map(from_range_t, _Rg&&, const _Compare&, const _Alloc&), insert_range):
	Define.
	* testsuite/23_containers/multimap/cons/from_range.cc: New test.
	* testsuite/23_containers/multimap/modifiers/insert/insert_range.cc: New test.
	* testsuite/23_containers/map/cons/from_range.cc: New test.
	* testsuite/23_containers/map/modifiers/insert/insert_range.cc: New test.
2025-03-18 13:07:00 +01:00
Jose E. Marchesi
260e0a389a cobol: use ldirname in cdf-copy.cc
This patch changes gcc/cobol/cdf-copy.cc to use the new ldirname from
libibertay rather than the host's dirname.  This removes an include
for libgen.h.

Regtested in x86_64-linux-gnu by running make check-cobol.

gcc/cobol/ChangeLog

	* cdf-copy.cc (copybook_elem_t::open_file): Use ldirname rather
	than dirname.
2025-03-18 11:19:48 +01:00
Jose E. Marchesi
31dd621796 libiberty: add ldirname function
This patch adds a function ldirname to libiberty.  It is implemented
in terms of lbasename.  Basically, given a given pathname, the dirname
part is what is not the basename minus the last directory separator
separating the dirname with the basename.

include/ChangeLog

	* libiberty.h (ldirname): New function declaration.
	(dos_ldirname): Likewise.
	(unix_ldirname): Likewise.

libiberty/ChangeLog

	* ldirname.c: New file.
	* Makefile.in (CFILES): Add ldirname.c.
	(REQUIRED_OFILES): Add ldirname.$(objext).
	(./ldirname.$(objext)): New rule.
	* makefile.vms (OBJS): Add ldirname.obj.
	* configure.com (FILES): Add ldirname.
2025-03-18 11:19:48 +01:00
Iain Sandoe
7865869b44 cobol: Do not include C++ headers after system.h.
The headers mentioned in parse.y are already unconditionally included
by system.h (via cobol-system.h).

gcc/cobol/ChangeLog:

	* parse.y: Remove c++ header includes appearing after
	system.h.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-18 10:18:11 +00:00
Richard Biener
99a3f013c3 debug/101533 - ICE with variant typedef DIE generation
There's a sanity check in gen_type_die_with_usage that trips
unnecessarily for a case where the relevant DIE has already been
generated successfully in other ways.  The following keys the
existing TREE_ASM_WRITTEN check on the correct object, honoring
this and does nothing instead of ICEing for the testcase at hand.

	PR debug/101533
	* dwarf2out.cc (gen_type_die_with_usage): When we have
	output the typedef already do nothing for a typedef variant.
	Do not set TREE_ASM_WRITTEN on the type.

	* g++.dg/debug/pr101533.C: New testcase.
2025-03-18 10:12:28 +01:00
Haochen Jiang
289867bb29 i386: Remove XFAIL for pr103750 testcases
After commit r15-4510, the following testcases also do not need XFAIL.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512f-pr103750-1.c: Remove XFAIL.
	* gcc.target/i386/avx512f-pr103750-2.c: Ditto.
	* gcc.target/i386/avx512fp16-pr103750-1.c: Ditto.
	* gcc.target/i386/avx512fp16-pr103750-2.c: Ditto.
2025-03-18 16:10:02 +08:00
Jeff Law
e9888795b8 [RISC-V] Fix another unreported code quality regression
So here's the other case I was just looking at.  This is a slightly modified
version of some code from 500.perlbench which shows another nop logical
operation:

> void frob (void);
> typedef struct av AV;
> typedef unsigned int U32;
> struct av
> {
>   void *dummy;
>   U32 sv_refcnt;
>   U32 sv_flags;
> };
> void
> Perl_save_ary (AV *const oav)
> {
>   AV *av;
>   unsigned int x1 = oav->sv_flags;
>   unsigned int x2 = x1 & 3221225472;
>   if (x2 == 2147483648)
>     frob ();
> }

https://godbolt.org/z/941vqfGE6

It's not as obvious, but this is probably a regression as well.  I would expect
the gcc-14 code to execute in 1c faster than the current trunk code on a
superscalar design:

gcc-14:                               trunk:
        lw      a5,12(a0)                   lw      a5,12(a0)
        li      a3,-1073741824              li      a3,-2
        li      a4,-2147483648

        and     a5,a5,a3                    srai    a4,a5,30

        beq     a5,a4,.L4                   andi    a4,a4,-1

                                            beq     a4,a3,.L4

Essentially the "li" instrutions can execute in parallel with the lw. But the
rest of the sequence has data dependencies forcing the instructions to execute
serially.  Thus that extra andi extends the critical path by 1c.

Removing the useless andi should make the two sequences perform the same and
reduces the codesize.

Much like the prior case we walk backwards using -fdump-rtl-all -dp to find the
andi:

        andi    a4,a4,-1        # 26    [c=4 l=4]  *anddi3/1

The UID is 26.  And just like the prior case it first shows up in the .split2
dump:

grep insn\ 26 j.c.*
j.c.326r.split2:(insn 26 25 27 2 (set (reg:DI 14 a4 [144])
j.c.327r.ree:(insn 26 25 27 2 (set (reg:DI 14 a4 [144])
j.c.329r.pro_and_epilogue:(insn 26 25 27 2 (set (reg:DI 14 a4 [144])
j.c.330r.dse2:(insn 26 25 27 2 (set (reg:DI 14 a4 [144])

In the .split2 dump:

Splitting with gen_split_77 (riscv.md:3184)
scanning new insn with uid = 25.
scanning new insn with uid = 26.
scanning new insn with uid = 27.
scanning new insn with uid = 28.
deleting insn with uid = 12.
deleting insn with uid = 12.

So insn 12 is where we want to look.

> (jump_insn 12 6 13 2 (parallel [
>             (set (pc)
>                 (if_then_else (ne (and:DI (reg:DI 15 a5 [orig:138 oav_3(D)->sv_flags ] [138])
>                             (const_int -1073741824 [0xffffffffc0000000]))
>                         (const_int -2147483648 [0xffffffff80000000]))
>                     (label_ref:DI 18)
>                     (pc)))
>             (clobber (reg:DI 14 a4 [144]))
>             (clobber (reg:DI 13 a3 [145]))
>         ]) "j.c":16:6 361 {*branchdi_shiftedarith_ne_shifted}
>      (int_list:REG_BR_PROB 856416484 (nil))
>  -> 18)

So that's a conditional branch with the condition

(a5 & 0xffffffffc0000000) != 0xffffffff80000000

Note how those instructions have many low bits as zeros and that the constants
likely require some kind of constant synthesis.  We can conceptually do an
arithmetic right shift of a5 and both constants and get the same result, likely
making the constants easier to synthesize.

And that's precisely what this pattern is designed to do:

> (define_insn_and_split "*branch<ANYI:mode>_shiftedarith_<optab>_shifted"
>   [(set (pc)
>         (if_then_else (any_eq
>                     (and:ANYI (match_operand:ANYI 1 "register_operand" "r")
>                           (match_operand 2 "shifted_const_arith_operand" "i"))
>                     (match_operand 3 "shifted_const_arith_operand" "i"))
>          (label_ref (match_operand 0 "" ""))
>          (pc)))
>    (clobber (match_scratch:X 4 "=&r"))
>    (clobber (match_scratch:X 5 "=&r"))]
>   "!SMALL_OPERAND (INTVAL (operands[2]))
>     && !SMALL_OPERAND (INTVAL (operands[3]))
>     && SMALL_AFTER_COMMON_TRAILING_SHIFT (INTVAL (operands[2]),
>                                              INTVAL (operands[3]))"
>   "#"
>   "&& reload_completed"
>   [(set (match_dup 4) (ashiftrt:X (match_dup 1) (match_dup 7)))
>    (set (match_dup 4) (and:X (match_dup 4) (match_dup 8)))
>    (set (match_dup 5) (match_dup 9))
>    (set (pc) (if_then_else (any_eq (match_dup 4) (match_dup 5))
>                            (label_ref (match_dup 0)) (pc)))]
> {
>   HOST_WIDE_INT mask1 = INTVAL (operands[2]);
>   HOST_WIDE_INT mask2 = INTVAL (operands[3]);
>   int trailing_shift = COMMON_TRAILING_ZEROS (mask1, mask2);
>
>   operands[7] = GEN_INT (trailing_shift);
>   operands[8] = GEN_INT (mask1 >> trailing_shift);
>   operands[9] = GEN_INT (mask2 >> trailing_shift);
> }
It finds the number of low bits in both that must be zero.  In this case it's
30 bits.  So it shifts the register right by 30 bits.  Then constructs the two
new constants, one of which is -1 after shifting. And we emit (set (match_dup
4) (and (match_dup 4) (const_int -1))

And since this splits after register allocation nothing eliminates the useless
and dest,src,-1 and boom we have a regression.

The fix this time is a bit different.  I really don't want to open code the new
RTL.  So instead I create a new operand for the source of the AND statement.
If the constant is going to be -1 then that operand has the same value as the
destination operand (ie, a nop move).  Otherwise it is the appropriate AND
expression.

The nop-move will get eliminated thus resolving the regression.

I suspect some of the other patterns in riscv.md are subject to similar issues,
though I haven't seem them trigger, so I'm leaving them alone for now.

This has been tested in my tester and it'll obviously go through the upstream
CI flow before I push it to the trunk.

gcc/
	* config/riscv/riscv.md (equality shifted-arith splitter): Do not
	create op AND -1 as it won't be cleaned up post-reload.

gcc/testsuite
	* gcc.target/riscv/redundant-andi-2.c: New test.
2025-03-17 22:00:51 -06:00
Andrew Pinski
fc728cfd56 Fix r15-8073 (Pass -macos_version_min to the linker)
With r15-8073-g952e17223d3a98, gcc_cv_ld64_macosx_version_min is being
used for the replacement and being set in a few locations but
gcc_cv_ld64_macos_version_min is set in others.
Since the auto-host.h variable is named LD64_HAS_MACOS_VERSION_MIN,
I changed over to remove the x from the name.

Committed as obvious after a quick test to make sure LD64_HAS_MACOS_VERSION_MIN
was not set to empty.

gcc/ChangeLog:

	* configure: Regenerate.
	* configure.ac: s/gcc_cv_ld64_macosx_version_min/gcc_cv_ld64_macos_version_min/.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2025-03-17 18:28:17 -07:00
GCC Administrator
b5d82890c4 Daily bump. 2025-03-18 00:19:44 +00:00
Joseph Myers
af9c69efce Update .po files
gcc/po/
	* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
	ja.po, ka.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po,
	zh_CN.po, zh_TW.po: Update.

libcpp/po/
	* be.po, ca.po, da.po, de.po, el.po, eo.po, es.po, fi.po, fr.po,
	id.po, ja.po, ka.po, nl.po, pt_BR.po, ro.po, ru.po, sr.po, sv.po,
	tr.po, uk.po, vi.po, zh_CN.po, zh_TW.po: Update.
2025-03-17 23:45:57 +00:00
Jeff Law
d9a8ec7fe0 [RISC-V] Fix unreported code quality regression with single bit manipulations
I was reviewing some code recently and spotted an oddity.  In a few places we
were emitting andi dst,src,-1 and in others [x]ori dst,src,0. Those are
obviously nops and we should get rid of them.

Most of these are coming from a split part of a couple define_insn_and_split
patterns added back in late 2022, so this is an unreported 13, 14 & 15 code
quality regression (verified on godbolt, https://godbolt.org/z/EPszox5Kd).
Essentially the split part is matching over-aggressively and splitting what
should be a trivial bitmanip insn such as bset, bclr or binv into a nop logical
with a bit twiddle.

Since the split portions trigger post-reload nothing comes along to remove the
nop logical operations.

The fix is trivial.  Just refine the condition.  I considered refining the
operand predicates too.  Both are valid approaches.  I noticed the formatting
was goofy, so fixed that while I was in there.

I'm aware of one other similar case, but I haven't concluded if it's a
regression or not.

Tested in my tester.  Waiting for pre-commit CI to do its thing.

Jeff

gcc/
	* config/riscv/bitmanip.md (*<or_optab>i<mode>_extrabit): Reject cases
	where we only need to twiddle one bit.  Fix formatting.
	(*andi<mode>extrabit): Likewise.

gcc/testsuite/

	* gcc.target/riscv/redundant-andi.c: New test.
	* gcc.target/riscv/redundant-ori.c: Likewise
2025-03-17 17:30:30 -06:00
H.J. Lu
456f5ef81f gcc.dg/pr90838-2.c: Replace long with long long
Since gcc.dg/pr90838-2.c is only for 64-bit integer, replace long with
long long for ILP32 targets.

	* gcc.dg/pr90838-2.c (ctz4): Replace long with long long.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-17 15:14:26 -07:00
Bob Dubner
aa68eb8d56 cobol: Eliminate CPPFLAGS assignment from Make-lang.in [PR119213].
A number of gcc/cobol files had to be modified to
'#include "../../libgcobol/xxx.h" instead of "xxx.h"

gcc/cobol

	PR cobol/119213
	* Make-lang.in: Eliminate CPPFLAGS= assignment.
	* cdf.y: Modify #includes that reference libgcobol.
	* cobol1.cc: Modify #includes that reference libgcobol.
	* except.cc: Modify #includes that reference libgcobol.
	* gcobolspec.cc: Modify #includes that reference libgcobol.
	* genapi.cc: Modify #includes that reference libgcobol.
	* gengen.cc: Modify #includes that reference libgcobol.
	* genmath.cc: Modify #includes that reference libgcobol.
	* genutil.cc: Modify #includes that reference libgcobol.
	* parse.y: Modify #includes that reference libgcobol.
	* scan.l: Modify #includes that reference libgcobol.
	* structs.cc: Modify #includes that reference libgcobol.
	* symbols.cc: Modify #includes that reference libgcobol.
	* symfind.cc: Modify #includes that reference libgcobol.
	* util.cc: Modify #includes that reference libgcobol.
2025-03-17 17:04:51 -04:00
Bob Dubner
80ef26563f libgcobol: Remove unused headers from shared sources.
This reduces the number of headers included in sources that are
shared with the Front End.

libgcobol/ChangeLog:

	* charmaps.cc: Remove unused headers
	* libgcobol.h: Likewise.
	* valconv.cc: Likewise.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-17 16:52:27 -04:00
Vladimir N. Makarov
8e0e17677a [PR119285][IRA]: Use an additional way of reg equiv invariant substitution correctness
Patch for PR114991 resulted in 5% decrease of SPEC2017 lbm performance
on Zen2 and Zen4.  For one RTL insn of lbm, LRA with PR114991 patch
can not confirm that the equivalence insertion will create a valid RTL
insn.  This resulted in that the pseudo equiv was assumed costly and
pseudo was assigned to hard reg (caller saved as the pseudo lives
through calls) and some other pseudos did not get hard regs as it was
before PR114991 patch.  The insn in question is `pseudo1 = pseduo2 +
pseudo3` where pseudo2 has equiv `hard_reg + const`.  The old code
recognized the insn after equiv substitution as LEA.  The new code
failed.  The patch here makes to use two ways for equiv subsbtitution
correctness, the old one and new one (mostly for memory addresses
where the old code fails to find the substitution correctness).  So
given patch fixes lbm performance degradation and actually makes GCC
to generate the same code as it was before PR114991 patch.

gcc/ChangeLog:

	PR rtl-optimization/119285
	* ira-costs.cc (equiv_can_be_consumed_p): Use 2 ways for
	recognizing a valid insn after equiv insertion.
2025-03-17 15:25:57 -04:00
Michael Matz
96698551b8 rs6000: Add -msplit-patch-nops (PR112980)
as the bug report details some uses of -fpatchable-function-entry
aren't happy with the "before" NOPs being inserted between global and
local entry point on powerpc.  We want the before NOPs be in front
of the global entry point.  That means that the patching NOPs aren't
consecutive for dual entry point functions, but for these usecases
that's not the problem.  But let us support both under the control
of a new target option: -msplit-patch-nops.

	gcc/

	PR target/112980
	* config/rs6000/rs6000.opt (msplit-patch-nops): New option.
	* doc/invoke.texi (RS/6000 and PowerPC Options): Document it.
	* config/rs6000/rs6000.h (machine_function.stop_patch_area_print):
	New member.
	* config/rs6000/rs6000.cc (rs6000_print_patchable_function_entry):
	Emit split nops under control of that one.
	* config/rs6000/rs6000-logue.cc (rs6000_output_function_prologue):
	Add handling of split patch nops.
2025-03-17 18:54:43 +01:00
Michal Jires
051ca98a12 doc: Regenerate common.opt.urls
Regenerating common.opt.urls, which I missed until autobuilder noticed.

gcc/ChangeLog:

	* common.opt.urls: Regenerate.
2025-03-17 17:14:22 +01:00
Muhammad Mahad
f9a8ce88cb gccrs: [E0576] Associated item not found in given type
gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit):
	Add rich error message and error code similiar to rustc with
	associaed type and trait name

gcc/testsuite/ChangeLog:

	* rust/compile/unknown-associated-item.rs: New test.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2025-03-17 16:35:53 +01:00
Liam Naddell
c7cdae718c gccrs: [gccrs#2987] Patch ICE when deriving Clone and Copy
gcc/rust/ChangeLog:
	* expand/rust-expand-visitor.cc:
	Fix ICE caused by unique_ptr UB and buggy iterator use

gcc/testsuite/ChangeLog:
	* rust/compile/issue-2987.rs:
	Add test for deriving Clone and Copy at the same time

Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
2025-03-17 16:35:53 +01:00