aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
40 hourslibstdc++: Enable __gnu_test::test_container constructor for C++98Jonathan Wakely1-3/+1
The only reason this constructor wasn't defined for C++98 is that it uses constructor delegation, but that isn't necessary. libstdc++-v3/ChangeLog: * testsuite/util/testsuite_iterators.h (test_container): Define array constructor for C++98 as well.
43 hourslibgcobol: Handle long double as an alternate IEEE754 quad [PR119244]Jakub Jelinek5-151/+137
I think there should be consistency in what we use, so like libgcobol-fp.h specifies, IEEE quad long double should have highest priority, then _Float128 with *f128 APIs, then libquadmath. And when we decide to use say long double, we shouldn't mix that with strfromf128/strtof128. Additionally, given that the *l vs. *f128 vs. *q API decision is done solely in libgcobol and not in the compiler (which is different from the Fortran case where compiled code emits say sinq or sinf128 calls), I think libgcobol.spec should only have -lquadmath in any form only in the case when using libquadmath for everything. In the Fortran case it is for backwards compatibility purposes, if something has been compiled with older gfortran which used say sinq and link is done by gfortran which has been configured against new glibc with *f128, linking would fail otherwise. 2025-04-15 Jakub Jelinek <jakub@redhat.com> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR cobol/119244 * acinclude.m4 (LIBGCOBOL_CHECK_FLOAT128): Ensure libgcob_cv_have_float128 is not yes on targets with IEEE quad long double. Don't check for --as-needed nor set LIBQUADSPEC on targets which USE_IEC_60559. * libgcobol-fp.h (FP128_FMT, strtofp128, strfromfp128): Define. * intrinsic.cc (strtof128): Don't redefine. (WEIRD_TRANSCENDENT_RETURN_VALUE): Use GCOB_FP128_LITERAL macro. (__gg__numval_f): Use strtofp128 instead of strtof128. * libgcobol.cc (strtof128): Don't redefine. (format_for_display_internal): Use strfromfp128 instead of strfromf128 or quadmath_snprintf and use FP128_FMT in the format string. (get_float128, __gg__compare_2, __gg__move, __gg__move_literala): Use strtofp128 instead of strtof128. * configure: Regenerate.
45 hoursDoc: always_inline attribute vs multiple TUs and LTO [PR113203]Sandra Loosemore1-0/+7
gcc/ChangeLog PR ipa/113203 * doc/extend.texi (Common Function Attributes): Explain how to use always_inline in programs that have multiple translation units, and that LTO inlining additionally needs optimization enabled.
45 hoursc++: shortcut constexpr vector ctor [PR113835]Jason Merrill2-0/+17
Since std::vector became usable in constant evaluation in C++20, a vector variable with static storage duration might be manifestly constant-evaluated, so we properly try to constant-evaluate its initializer. But it can never succeed since the result will always refer to the result of operator new, so trying is a waste of time. Potentially a large waste of time for a large vector, as in the testcase in the PR. So, let's recognize this case and skip trying constant-evaluation. I do this only for the case of an integer argument, as that's the case that's easy to write but slow to (fail to) evaluate. In the test, I use dg-timeout-factor to lower the default timeout from 300 seconds to 15; on my laptop, compilation without the patch takes about 20 seconds versus about 2 with the patch. PR c++/113835 gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_outermost_constant_expr): Bail out early for std::vector(N). gcc/testsuite/ChangeLog: * g++.dg/cpp2a/constexpr-vector1.C: New test.
47 hoursRevert documents from r11-344-g0fec3f62b9bfc0liuhongt1-92/+2
gcc/ChangeLog: PR target/108134 * doc/extend.texi: Remove documents from r11-344-g0fec3f62b9bfc0.
47 hoursDoc: clarify -march=pentiumpro has no MMX support [PR42683]Sandra Loosemore1-1/+1
gcc/ChangeLog PR target/42683 * doc/invoke.texi (x86 Options): Clarify that -march=pentiumpro doesn't include MMX.
2 daysDaily bump.GCC Administrator10-1/+638
2 daysGCN, nvptx: Support '-mfake-exceptions', and use it for offloading ↵Thomas Schwinge38-62/+331
compilation [PR118794] With '-mfake-exceptions' enabled, the user-visible behavior in presence of exception handling constructs changes such that the compile-time 'sorry, unimplemented: exception handling not supported' is skipped, code generation proceeds, and instead, exception handling constructs 'abort' at run time. (..., or don't, if they're in dead code.) PR target/118794 gcc/ * config/gcn/gcn.opt (-mfake-exceptions): Support. * config/nvptx/nvptx.opt (-mfake-exceptions): Likewise. * config/gcn/gcn.md (define_expand "exception_receiver"): Use it. * config/nvptx/nvptx.md (define_expand "exception_receiver"): Likewise. * config/gcn/mkoffload.cc (main): Set it. * config/nvptx/mkoffload.cc (main): Likewise. * config/nvptx/nvptx.cc (nvptx_assemble_integer) <in_section == exception_section>: Special handling for 'SYMBOL_REF's. * except.cc (expand_dw2_landing_pad_for_region): Don't generate bogus code for (default) '#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM'. libgcc/ * config/gcn/unwind-gcn.c (_Unwind_Resume): New. * config/nvptx/unwind-nvptx.c (_Unwind_Resume): Likewise. gcc/testsuite/ * g++.target/gcn/exceptions-bad_cast-2.C: Set '-mno-fake-exceptions'. * g++.target/gcn/exceptions-pr118794-1.C: Likewise. * g++.target/gcn/exceptions-throw-2.C: Likewise. * g++.target/nvptx/exceptions-bad_cast-2.C: Likewise. * g++.target/nvptx/exceptions-pr118794-1.C: Likewise. * g++.target/nvptx/exceptions-throw-2.C: Likewise. * g++.target/gcn/exceptions-bad_cast-2_-mfake-exceptions.C: New. * g++.target/gcn/exceptions-pr118794-1_-mfake-exceptions.C: Likewise. * g++.target/gcn/exceptions-throw-2_-mfake-exceptions.C: Likewise. * g++.target/nvptx/exceptions-bad_cast-2_-mfake-exceptions.C: Likewise. * g++.target/nvptx/exceptions-pr118794-1_-mfake-exceptions.C: Likewise. * g++.target/nvptx/exceptions-throw-2_-mfake-exceptions.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-bad_cast-2-offload-sorry-GCN.C: Set '-foffload-options=-mno-fake-exceptions'. * testsuite/libgomp.c++/target-exceptions-bad_cast-2-offload-sorry-nvptx.C: Likewise. * testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C: Likewise. * testsuite/libgomp.c++/target-exceptions-throw-2-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.c++/target-exceptions-throw-2-offload-sorry-nvptx.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-2-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-2-offload-sorry-nvptx.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-2-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-2-offload-sorry-nvptx.C: Likewise. * testsuite/libgomp.c++/target-exceptions-bad_cast-2.C: Adjust. * testsuite/libgomp.c++/target-exceptions-pr118794-1.C: Likewise. * testsuite/libgomp.c++/target-exceptions-throw-2.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-2.C: Likewise. * testsuite/libgomp.c++/target-exceptions-throw-2-O0.C: New.
2 daysAdd 'throw', dead code test cases for GCN, nvptx target and OpenACC, OpenMP ↵Thomas Schwinge4-0/+84
'target' offloading gcc/testsuite/ * g++.target/gcn/exceptions-throw-3.C: New. * g++.target/nvptx/exceptions-throw-3.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-throw-3.C: New. * testsuite/libgomp.oacc-c++/exceptions-throw-3.C: Likewise.
2 daysAdd 'throw', caught test cases for GCN, nvptx target and OpenACC, OpenMP ↵Thomas Schwinge8-0/+160
'target' offloading gcc/testsuite/ * g++.target/gcn/exceptions-throw-2.C: New. * g++.target/nvptx/exceptions-throw-2.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-throw-2.C: New. * testsuite/libgomp.c++/target-exceptions-throw-2-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.c++/target-exceptions-throw-2-offload-sorry-nvptx.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-2.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-2-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-2-offload-sorry-nvptx.C: Likewise.
2 daysAdd 'throw' test cases for GCN, nvptx target and OpenACC, OpenMP 'target' ↵Thomas Schwinge5-0/+126
offloading gcc/testsuite/ * g++.target/gcn/exceptions-throw-1.C: New. * g++.target/nvptx/exceptions-throw-1.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-throw-1.C: New. * testsuite/libgomp.c++/target-exceptions-throw-1-O0.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-throw-1.C: Likewise.
2 daysAdd 'std::bad_cast' exception, dead code test cases for GCN, nvptx target ↵Thomas Schwinge4-0/+86
and OpenACC, OpenMP 'target' offloading gcc/testsuite/ * g++.target/gcn/exceptions-bad_cast-3.C: New. * g++.target/nvptx/exceptions-bad_cast-3.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-bad_cast-3.C: New. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-3.C: Likewise.
2 daysAdd 'std::bad_cast' exception, caught test cases for GCN, nvptx target and ↵Thomas Schwinge8-0/+158
OpenACC, OpenMP 'target' offloading gcc/testsuite/ * g++.target/gcn/exceptions-bad_cast-2.C: New. * g++.target/nvptx/exceptions-bad_cast-2.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-bad_cast-2.C: New. * testsuite/libgomp.c++/target-exceptions-bad_cast-2-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.c++/target-exceptions-bad_cast-2-offload-sorry-nvptx.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-2-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-2-offload-sorry-nvptx.C: Likewise.
2 daysAdd 'std::bad_cast' exception test cases for GCN, nvptx target and OpenACC, ↵Thomas Schwinge4-0/+109
OpenMP 'target' offloading gcc/testsuite/ * g++.target/gcn/exceptions-bad_cast-1.C: New. * g++.target/nvptx/exceptions-bad_cast-1.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-bad_cast-1.C: New. * testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C: Likewise.
2 daysAdd test cases for exception handling constructs in dead code for GCN, nvptx ↵Thomas Schwinge5-0/+136
target and OpenMP 'target' offloading [PR118794] PR target/118794 gcc/testsuite/ * g++.target/gcn/exceptions-pr118794-1.C: New. * g++.target/nvptx/exceptions-pr118794-1.C: Likewise. libgomp/ * testsuite/libgomp.c++/target-exceptions-pr118794-1.C: New. * testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C: Likewise. * testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C: Likewise.
2 daysAdd PR119692 "C++ 'typeinfo', 'vtable' vs. OpenACC, OpenMP 'target' ↵Thomas Schwinge10-0/+129
offloading" test cases [PR119692] ... documenting the status quo. PR c++/119692 gcc/testsuite/ * g++.target/gcn/pr119692-1-1.C: New. * g++.target/nvptx/pr119692-1-1.C: Likewise. libgomp/ * testsuite/libgomp.c++/pr119692-1-1.C: New. * testsuite/libgomp.c++/pr119692-1-2.C: Likewise. * testsuite/libgomp.c++/pr119692-1-3.C: Likewise. * testsuite/libgomp.c++/pr119692-1-4.C: Likewise. * testsuite/libgomp.c++/pr119692-1-5.C: Likewise. * testsuite/libgomp.oacc-c++/pr119692-1-1.C: Likewise. * testsuite/libgomp.oacc-c++/pr119692-1-2.C: Likewise. * testsuite/libgomp.oacc-c++/pr119692-1-3.C: Likewise.
2 daysAdd 'g++.target/gcn/gcn.exp' for GCN-specific C++ test casesThomas Schwinge1-0/+56
Like 'gcc.target/gcn/gcn.exp' is modeled after 'gcc.dg/dg.exp', this new 'g++.target/gcn/gcn.exp' is modeled after 'g++.dg/dg.exp'. gcc/testsuite/ * g++.target/gcn/gcn.exp: New.
2 daysPolish 'dg-output-file' test logsThomas Schwinge1-2/+1
Per commit r15-8260-g563e6d926d9826d76895086d0c40a29dc90d66e5 "testsuite: Add support for dg-output-file directive", this currently produces test logs as follows: PASS: gcc.dg/dg-output-file-1.c (test for excess errors) PASS: dg-output-file-1-lp64.txt output file test PASS: gcc.dg/dg-output-file-1.c execution test PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O0 (test for excess errors) PASS: COMP-6_arithmetic.out output file test PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O0 execution test PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O1 (test for excess errors) PASS: COMP-6_arithmetic.out output file test PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O1 execution test [Etc.] Notice that the 'PASS: [...] output file test' lines easily produce duplicate test names, or might even produce PASS plus FAIL for the same test names. Make the "output file test" use the same "descriptive name" as the other parts, and get properly sorted with parallel-testing 'contrib/dg-extract-results.sh' processing: PASS: c-c++-common/zero-scratch-regs-leafy-2.c -Wc++-compat (test for excess errors) -PASS: dg-output-file-1-lp64.txt output file test PASS: gcc.dg/20000108-1.c (test for excess errors) [...] PASS: gcc.dg/devnull-dump.c (test for excess errors) PASS: gcc.dg/dg-output-file-1.c (test for excess errors) PASS: gcc.dg/dg-output-file-1.c execution test +PASS: gcc.dg/dg-output-file-1.c output file test PASS: gcc.dg/dg-test-1.c (test for excess errors) ..., and gets de-duplicated test names, for example: PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O0 (test for excess errors) -PASS: COMP-6_arithmetic.out output file test +PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O0 output file test PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O0 execution test PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O1 (test for excess errors) -PASS: COMP-6_arithmetic.out output file test +PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O1 output file test PASS: cobol.dg/group2/COMP-6_arithmetic.cob -O1 execution test [Etc.] (Given that only ever a single 'dg-output-file' directive is active, don't print the output filename.) gcc/testsuite/ * lib/gcc-dg.exp (${tool}_load): Polish 'dg-output-file' test logs.
2 daystestsuite: Fix up ipa/pr119530.c testcase [PR119318]Jakub Jelinek1-2/+2
I'm seeing +FAIL: gcc.dg/ipa/pr119530.c execution test on i686-linux. The problem is that when long is just 32-bit and so is unsigned, the testcase then behaves differently and should abort. Fixed by making the argument long long instead. While at it, just in case I've changed type of d variable to signed char as well just in case there is -funsigned-char 8-bit int target or something similar. 2025-04-14 Jakub Jelinek <jakub@redhat.com> PR ipa/119318 * gcc.dg/ipa/pr119530.c (d): Change type from char to signed char. (e): Change argument type from long to long long.
2 daysexpmed: Always use QImode for init_expmed set_zero_cost [PR119785]Jakub Jelinek1-1/+1
This is a regression on some targets introduced I believe by r6-2055 which added mode argument to set_src_cost. The problem here is that in the first iteration, mode is always QImode and we get as -Os zero cost set_src_cost (const0_rtx, QImode, false). But then we use the mode variable for iterating over int, partial int and vector int modes, so for the second iteration we call set_src_cost with mode which is at that time (machine_mode) (MAX_MODE_VECTOR_INT + 1). In the x86 case that happens to be V2HFmode and we don't crash (and compute the same 0 cost as we would for QImode). But e.g. in the SPARC case (machine_mode) (MAX_MODE_VECTOR_INT + 1) is MAX_MACHINE_MODE and that does all kinds of weird things especially when doing ubsan bootstrap. Fixed by always using QImode. 2025-04-14 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/119785 * expmed.cc (init_expmed): Always pass QImode rather than mode to set_src_cost passed to set_zero_cost.
2 dayscobol: Fix -fmax-errors option [PR119776]Jakub Jelinek4-12/+1
There seems to be inconsistency in the -fmax-errors option naming. It is a generic option in common.opt (so applies to all languages) but with the = character in it. The gcobol.1 man page in one spot documents the generic option (in the syntax, -fmax-errors=nerror) but in another spot without the = character. In common.opt it is fmax-errors= Common Joined RejectNegative UInteger Var(flag_max_errors) -fmax-errors=<number> Maximum number of errors to report. I hope the cobol addition is just a mistake, having -fmax-errors variant without = character when Joined Separate would allow to specify -fmax-errors 10 with the same meaning as -fmax-errors=10 but also -fmax-errors10 with the same meaning which is just weird. Also, there is no UInteger and RejectNegative on it, so one can also specific -fno-max-errors42 or -fmax-errors blah. So, unless the spelling without = is intentional, here is a patch to just remove it, the common option already should have arranged for flag_max_errors to be set to the right number. Or if it is intentional, I guess we'd need to at least add RejectNegative UInteger (plus using atoi is generally undesirable anywhere in the compiler because it does no error checking). And the man page would need to be updated to specify both forms. 2025-04-14 Jakub Jelinek <jakub@redhat.com> PR cobol/119776 * lang.opt (fmax-errors): Remove. * lang.opt.urls: Regenerate. * cobol1.cc (cobol_langhook_handle_option) <case OPT_fmax_errors>: Remove. * gcobol.1: Document -fmax-errors=nerror rather than -fmax-errors nerror.
2 dayscobol: Fix up COBOL -include [PR119777]Jakub Jelinek2-3/+3
I was looking through options.cc diff between GCC 14 and 15, looking for entries with added CL_Cobol where at least one other language is present and was present before too. Besides the -fsyntax-only changes this is the only other one I found, COBOL adds Var(cobol_include) to something which didn't have a Var at all before and IMHO it is actively harmful. Because one can specify multiple -include file1 -include file2 options, both in C/C++ etc. and in COBOL as well (as documented in the man page). A Var can track just one entry. cobol_langhook_handle_option should use arg instead. 2025-04-14 Jakub Jelinek <jakub@redhat.com> PR cobol/119777 * lang.opt (include): Remove Var(cobol_include). * cobol1.cc (cobol_langhook_handle_option) <case OPT_include>: Use arg instead of cobol_include.
2 dayscobol: Drop -fsyntax-only from COBOL lang.opt [PR119777]Jakub Jelinek2-7/+0
The comment is incorrect, fsyntax-only is not documented in c.opt, but in common.opt: fsyntax-only Common Var(flag_syntax_only) Check for syntax errors, then stop. and as such it applies to all languages, so adding CL_Cobol to the CL_COMMON is both unnecessary and because of RejectNegative which contradicts the generic option very harmful, because it makes -fno-syntax-only invalid for all languages. Fixed by just dropping it. 2025-04-14 Jakub Jelinek <jakub@redhat.com> PR cobol/119777 * lang.opt (fsyntax-only): Remove. * lang.opt.urls: Regenerate.
2 dayspretty-print, expand: Print [must tail call] for CALL_EXPRs and fix up ↵Jakub Jelinek2-5/+7
maybe_complain_about_tail_call [PR119718] Andrew P. mentioned earlier he'd like to see in the dump files a note whether it was a failed must tail call or not. We already print that on the tailc/musttail pass side, because print_gimple_stmt prints [must tail call] after the musttail calls. The first hunk below does it for GENERIC CALL_EXPRs too (which is needed for the expand diagnostics). That isn't enough though, because the error on it was done first and then CALL_EXPR_MUST_TAIL_CALL flag was cleared, so the dump didn't have it anymore. I've reordered the dump printing with error, so that it works properly. 2025-04-14 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/119718 * tree-pretty-print.cc (dump_generic_node) <case CALL_EXPR>: Dump also CALL_EXPR_MUST_TAIL_CALL flag. * calls.cc (maybe_complain_about_tail_call): Emit error about CALL_EXPR_MUST_TAIL_CALL only after emitting dump message, not before it.
2 daysgccrs: lang-items: Add ManuallyDrop<T>Arthur Cohen2-0/+3
gcc/rust/ChangeLog: * util/rust-lang-item.h: Add new manually_drop lang item. * util/rust-lang-item.cc: Likewise.
2 daysgccrs: attributes: Handle external tool annotations like rustfmt::Arthur Cohen4-3/+8
gcc/rust/ChangeLog: * util/rust-attribute-values.h: Add RUSTFMT value. * util/rust-attributes.cc: Define the attribute. * util/rust-attributes.h (enum CompilerPass): Add EXTERNAL variant. * expand/rust-macro-builtins.cc: Fix formatting.
2 daysgccrs: nr2.0: Only insert derive macros if they existArthur Cohen1-4/+3
This causes an assertion failure when compiling core with nr2.0, but should probably be improved. I'm not sure how this code enables built-in derive macros to be resolved so this is a temporary fix. gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Remove assertion.
2 daysgccrs: attributes: Add missing attributes used in `core`Arthur Cohen3-1/+45
gcc/rust/ChangeLog: * util/rust-attribute-values.h: Add missing attributes. * util/rust-attributes.cc: Likewise. * util/rust-attributes.h (enum CompilerPass): Mention adding something for const functions.
2 daysgccrs: Add `#[track_caller]` as known attributebeamandala4-1/+10
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::builtin_transcribers): Add entry for track_caller. * util/rust-attribute-values.h: add `TRACK_CALLER` attribute. * util/rust-attributes.cc: add `track_caller` attribute definition. gcc/testsuite/ChangeLog: * rust/compile/track_caller.rs: New test. Signed-off-by: Bhavesh Mandalapu <mandalapubhavesh@gmail.com>
2 daysgccrs: install.texi: Mention Rust requirement for building gccrsArthur Cohen1-0/+6
Addresses PR#117869 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117869 gcc/ChangeLog: * doc/install.texi: Add requirements for building gccrs.
2 daysgccrs: Fix const checking of enum discriminantsOwen Avery3-0/+14
gcc/rust/ChangeLog: * checks/errors/rust-const-checker.cc (ConstChecker::visit): Visit the enum items of enums. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Resolve enum discriminants during nr1.0. gcc/testsuite/ChangeLog: * rust/compile/enum_discriminant2.rs: New test. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2 daysgccrs: format_args: Allow extraneous commas, improve safetyArthur Cohen2-0/+54
gcc/rust/ChangeLog: * expand/rust-macro-builtins-format-args.cc (format_args_parse_arguments): Improve safety, allow extra commas after end of argument list. gcc/testsuite/ChangeLog: * rust/compile/format_args_extra_comma.rs: New test.
2 daysgccrs: expansion: Desugar doc comments into attributes before expansionArthur Cohen7-1/+234
gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Call into TokenTreeDesugar. * expand/rust-token-tree-desugar.cc: New file. * expand/rust-token-tree-desugar.h: New file. * Make-lang.in: Compile them. gcc/testsuite/ChangeLog: * rust/compile/macros/mbe/macro-issue3709-1.rs: New test. * rust/compile/macros/mbe/macro-issue3709-2.rs: New test.
2 daysgccrs: expansion: Only add fragments if the matcher succeededArthur Cohen2-7/+88
gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (MacroExpander::match_n_matches): Do not insert fragments and substack fragments if the matcher failed. gcc/testsuite/ChangeLog: * rust/compile/macros/mbe/macro-issue3708.rs: New test.
2 daysgccrs: session: Desugar question mark operator after expansion instead.Arthur Cohen1-1/+1
gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Call the visitor later in the pipeline.
2 daysgccrs: ast: Add get_locus() to DelimTokenTreeArthur Cohen1-0/+1
gcc/rust/ChangeLog: * ast/rust-ast.h (DelimTokenTree::get_locus): New function.
2 daysgccrs: ast: Support outer attributes for AST::RangeExprArthur Cohen1-6/+6
gcc/rust/ChangeLog: * ast/rust-expr.h (class RangeExpr): Add empty outer attributes and allow getting them and setting them.
2 daysgccrs: nr2.0: Do not resolve modules this run if they are unloadedArthur Cohen1-1/+11
Instead, mark the visitor as dirty and wait for the next round of the fixed point to take care of them. This avoids issues with module items being loaded while not being stripped yet. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Return if module is unloaded.
2 daysgccrs: typecheck: Properly select methods when dealing with specializationArthur Cohen3-24/+172
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (is_default_fn): New. (emit_ambiguous_resolution_error): New. (handle_multiple_candidates): Properly handle multiple candidates in the case of specialization. (TypeCheckExpr::visit): Call `handle_multiple_candidates`. gcc/testsuite/ChangeLog: * rust/execute/torture/min_specialization2.rs: New test. * rust/execute/torture/min_specialization3.rs: New test.
2 daysrust: Add comment inside block [PR119342]Andrew Pinski1-0/+2
Inside a BLOCK node, all of the variables of the scope/block are chained together and that connects them to the block. This just adds a comment to that effect as reading the code it is not so obvious why they need to be chained together. gcc/rust/ChangeLog: PR rust/119342 * rust-gcc.cc (block): Add comment on why chaining the variables of the scope toether. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 daysrust: use range for inside rust-gcc.cc [PR119341]Andrew Pinski1-36/+21
There are some places inside rust-gcc.cc which are candidates to use range for instead of iterators directly. This changes the locations I saw and makes the code slightly more readable. gcc/rust/ChangeLog: PR rust/119341 * rust-gcc.cc (function_type): Use range fors. (function_type_variadic): Likewise. (fill_in_fields): Likewise. (statement_list): Likewise. (block): Likewise. (block_add_statements): Likewise. (function_set_parameters): Likewise. (write_global_definitions): Likewise. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 daysrust: Use error_operand_p in rust-gcc.ccAndrew Pinski1-101/+88
Just a simple cleanupof the code to use error_operand_p instead of directly comparing against error_mark_node. This also moves some cdoe around when dealing with error_operand_p just to be faster and/or slightly tighten up the code slightly. gcc/rust/ChangeLog: * rust-gcc.cc (Bvariable::get_tree): Use error_operand_p. (pointer_type): Likewise. (reference_type): Likewise. (immutable_type): Likewise. (function_type): Likewise. (function_type_variadic): Likewise. Cleanup the check for receiver.type first. (function_ptr_type): Use error_operand_p. (fill_in_fields): Likewise. (fill_in_array): Likewise. (named_type): Likewise. (type_size): Likewise. (type_alignment): Likewise. (type_field_alignment): Likewise. (type_field_offset): Likewise. (zero_expression): Likewise. (float_constant_expression): Likewise. (convert_expression): Likewise. (struct_field_expression): Likewise. (compound_expression): Likewise. (conditional_expression): Likewise. (negation_expression): Likewise. (arithmetic_or_logical_expression): Likewise. (arithmetic_or_logical_expression_checked): Likewise. (comparison_expression): Likewise. (lazy_boolean_expression): Likewise. (constructor_expression): Likewise. (array_constructor_expression): Likewise. (array_index_expression): Likewise. (call_expression): Likewise. (init_statement): Likewise. (assignment_statement): Likewise. (return_statement): Likewise. (exception_handler_statement): Likewise. (if_statement): Likewise. (compound_statement): Likewise. Tighten up the code, removing t variable. (statement_list): Use error_operand_p. (block): Likewise. (block_add_statements): Likewise. (convert_tree): Likewise. (global_variable): Likewise. (global_variable_set_init): Likewise. (local_variable): Likewise. (parameter_variable): Likewise. (static_chain_variable): Likewise. (temporary_variable): Likewise. (function): Likewise. Tighten up the code. (function_defer_statement): Use error_operand_p. (function_set_parameters): Use error_operand_p. (write_global_definitions): Use error_operand_p. Tighten up the code around the loop. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 daysrust: Use FLOAT_TYPE_P instead of manual checkingAndrew Pinski1-4/+4
This moves is_floating_point over to using FLOAT_TYPE_P instead of manually checking. Note before it would return true for all COMPLEX_TYPE but complex types' inner type could be integral. Also fixes up the comment to be in more of the GNU style. Bootstrapped and tested on x86_64-linux-gnu. gcc/rust/ChangeLog: * rust-gcc.cc (is_floating_point): Use FLOAT_TYPE_P instead of manually checking the type. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 daystestcase: Add testcase for already fixed PR [PR118476]Andrew Pinski1-0/+14
This testcase was fixed by r15-3052-gc7b76a076cb2c6ded but is a testcase that failed in a different fashion and a much older failure than the one added with r15-3052. Pushed as obvious after a quick test. PR tree-optimization/118476 gcc/testsuite/ChangeLog: * gcc.dg/torture/pr118476-1.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2 daysc++: wrong targs in satisfaction diagnostic context line [PR99214]Patrick Palka2-1/+16
In the three-parameter version of satisfy_declaration_constraints, when 't' isn't the most general template, then 't' won't correspond with 'args' after we augment the latter via add_outermost_template_args, and so the instantiation context that we push via push_tinst_level isn't quite correct: 'args' is a complete set of template arguments, but 't' is not necessarily the most general template. This manifests as misleading diagnostic context lines when issuing a satisfaction failure error, e.g. the below testcase without this patch we emit: In substitution of '... void A<int>::f<U>() ... [with U = int]' and with this patch we emit: In substitution of '... void A<int>::f<U>() ... [with U = char]'. This patch fixes this by passing the original 'args' to push_tinst_level, which ought to properly correspond to 't'. PR c++/99214 gcc/cp/ChangeLog: * constraint.cc (satisfy_declaration_constraints): Pass the original ARGS to push_tinst_level. gcc/testsuite/ChangeLog: * g++.dg/concepts/diagnostic20.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
2 dayslibgcobol: Add missing float128 suffixAndreas Schwab1-1/+1
* libgcobol.cc (__gg__float64_from_128): Mark literal as float128 literal.
2 daysAPX: Don't use red-zone with 32 GPRs and no caller-saved registersH.J. Lu3-0/+189
Don't use red-zone when there are no caller-saved registers with 32 GPRs since 128-byte red-zone is too small for 31 GPRs. gcc/ PR target/119784 * config/i386/i386.cc (ix86_using_red_zone): Don't use red-zone with 32 GPRs and no caller-saved registers. gcc/testsuite/ PR target/119784 * gcc.target/i386/pr119784a.c: New test. * gcc.target/i386/pr119784b.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 daysipa-cp: Use the collected pass-through types to propgate constants (PR118097)Martin Jambor1-42/+52
This patch revisits the fix for PR 118097 and instead of deducing the necessary operation type it just uses the value collected and streamed by an earlier patch. It is bigger than the ones for propagating value ranges and known bits because we track constants both in parameters themselves and also in memory they point to or within aggregates, we clone functions for them and we do fancy things for some types of recursive calls. In the case of constants in aggregates or passed by reference, the situation should not change because the code creating jump functions for them does not allow type-casts, unlike for the plain ones. However, this patch changes how we handle them for the sake of consistency and also so that we can try and eliminate this limitation in the next stage 1. gcc/ChangeLog: 2025-03-20 Martin Jambor <mjambor@suse.cz> PR ipa/118097 * ipa-cp.cc (ipa_get_jf_arith_result): Require res_operand for anything except NOP_EXPR or ADDR_EXPR, document it and remove the code trying to deduce it. (ipa_value_from_jfunc): Use the stored and streamed type of arithmetic pass-through functions. (ipa_agg_value_from_jfunc): Use the stored and streamed type of arithmetic pass-through functions, convert to the type used to store the value if necessary. (get_val_across_arith_op): New parameter op_type, pass it to ipa_get_jf_arith_result. (propagate_vals_across_arith_jfunc): New parameter op_type, pass it to get_val_across_arith_op. (propagate_vals_across_pass_through): Use the stored and streamed type of arithmetic pass-through functions. (propagate_aggregate_lattice): Likewise. (push_agg_values_for_index_from_edge): Use the stored and streamed type of arithmetic pass-through functions, convert to the type used to store the value if necessary.
2 daysipa-cp: Use the stored and streamed pass-through types in ipa-vr (PR118785)Martin Jambor1-26/+2
This patch revisits the fix for PR 118785 and intead of deducing the necessary operation type it just uses the value collected and streamed by an earlier patch. The main advantage is that we do not rely on expr_type_first_operand_type_p enumarating all operations. gcc/ChangeLog: 2025-03-20 Martin Jambor <mjambor@suse.cz> PR ipa/118785 * ipa-cp.cc (ipa_vr_intersect_with_arith_jfunc): Use the stored and streamed type of arithmetic pass-through functions.
2 daysipa-cp: Make dumping of widest_ints even more saneMartin Jambor1-4/+11
This patch just introduces a form of dumping of widest ints that only have zeros in the lowest 128 bits so that instead of printing thousands of f's the output looks like: Bits: value = 0xffff, mask = all ones folled by 0xffffffffffffffffffffffffffff0000 and then makes sure we use the function not only to print bits but also to print masks where values like these can also occur. gcc/ChangeLog: 2025-03-21 Martin Jambor <mjambor@suse.cz> * ipa-cp.cc (ipcp_print_widest_int): Also add a truncated form of dumping of widest ints which only have zeros in the lowest 128 bits. Update the comment. (ipcp_bits_lattice::print): Also dump the mask using ipcp_print_widest_int. (ipcp_store_vr_results): Likewise.