- Feb 27, 2025
-
-
Jakub Jelinek authored
The following testcase is miscompiled since r15-7597. The left comparison is unsigned (x & 0x8000U) != 0) while the right one is signed (x >> 16) >= 0 and is actually a signbit test, so rsignbit is 64. After debugging this and reading the r15-7597 change, I believe there is just a pasto, the if (lsignbit) and if (rsignbit) blocks are pretty much identical with just the first l on all variables starting with l replaced with r (the only difference is that if (lsignbit) has a comment explaining the sign <<= 1; stuff, while it isn't repeated in the second one. Except the second one was using ll_unsignedp instead of rl_unsignedp in one spot. I think it should use the latter, the signedness of the left comparison doesn't affect the other one, they are basically independent with the exception that we check that after transformations they are both EQ or both NE and later on we try to merge them together. 2025-02-27 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/119030 * gimple-fold.cc (fold_truth_andor_for_ifcombine): Fix a pasto, ll_unsignedp -> rl_unsignedp. * gcc.c-torture/execute/pr119030.c: New test.
-
Jakub Jelinek authored
The following testcase ICEs, because we first construct file_cache object inside of *global_dc, then process options and then call file_cache::tune. The earlier construction allocates the m_file_slots array (using new) based on the static data member file_cache::num_file_slots, but then tune changes it, without actually reallocating all m_file_slots arrays in already constructed file_cache objects. I think it is just weird to have the count be a static data member and the pointer be non-static data member, that is just asking for issues like this. So, this patch changes num_file_slots into m_num_file_slots and turns tune into a non-static member function and changes toplev.cc to call it on the global_gc->get_file_cache () object. And let's the tune just delete the array and allocate it freshly if there is a change in the number of slots or lines. Note, file_cache_slot has similar problem, but because there are many, I haven't moved the count into those objects; I just hope that when tune is called there is exactly one file_cache constructed and all the file_cache_slot objects constructed are pointed by its m_file_slots member, so also on lines change it just deletes it and allocates again. I think it should be unlikely that the cache actually has any used slots by the time it is called. 2025-02-27 Jakub Jelinek <jakub@redhat.com> PR middle-end/118860 * input.h (file_cache::tune): No longer static. Rename argument from num_file_slots_ to num_file_slots. Formatting fix. (file_cache::num_file_slots): Renamed to ... (file_cache::m_num_file_slots): ... this. No longer static. * input.cc (file_cache_slot::tune): Change return type from void to size_t, return previous file_cache_slot::line_record_size value. Formatting fixes. (file_cache::tune): Rename argument from num_file_slots_ to num_file_slots. Set m_num_file_slots rather than num_file_slots. If m_num_file_slots or file_cache_slot::line_record_size changes, delete[] m_file_slots and new it again. (file_cache::num_file_slots): Remove definition. (file_cache::lookup_file): Use m_num_file_slots rather than num_file_slots. (file_cache::evicted_cache_tab_entry): Likewise. (file_cache::file_cache): Likewise. Initialize m_num_file_slots to 16. (file_cache::dump): Use m_num_file_slots rather than num_file_slots. (file_cache_slot::get_next_line): Formatting fixes. (file_cache_slot::read_line_num): Likewise. (get_source_text_between): Likewise. * toplev.cc (toplev::main): Call global_dc->get_file_cache ().tune rather than file_cache::tune. * gcc.dg/pr118860.c: New test.
-
Thomas Schwinge authored
... instead of 64 via 'gcc/defaults.h': MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode) This fixes ICEs: [-FAIL: c-c++-common/pr111309-1.c -Wc++-compat (internal compiler error: in expand_fn_using_insn, at internal-fn.cc:268)-] [-FAIL:-]{+PASS:+} c-c++-common/pr111309-1.c -Wc++-compat (test for excess errors) [-UNRESOLVED:-]{+PASS:+} c-c++-common/pr111309-1.c -Wc++-compat [-compilation failed to produce executable-]{+execution test+} [-FAIL: c-c++-common/pr111309-1.c -std=gnu++17 (internal compiler error: in expand_fn_using_insn, at internal-fn.cc:268)-] [-FAIL:-]{+PASS:+} c-c++-common/pr111309-1.c -std=gnu++17 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} c-c++-common/pr111309-1.c -std=gnu++17 [-compilation failed to produce executable-]{+execution test+} [-FAIL: c-c++-common/pr111309-1.c -std=gnu++26 (internal compiler error: in expand_fn_using_insn, at internal-fn.cc:268)-] [-FAIL:-]{+PASS:+} c-c++-common/pr111309-1.c -std=gnu++26 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} c-c++-common/pr111309-1.c -std=gnu++26 [-compilation failed to produce executable-]{+execution test+} [-FAIL: c-c++-common/pr111309-1.c -std=gnu++98 (internal compiler error: in expand_fn_using_insn, at internal-fn.cc:268)-] [-FAIL:-]{+PASS:+} c-c++-common/pr111309-1.c -std=gnu++98 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} c-c++-common/pr111309-1.c -std=gnu++98 [-compilation failed to produce executable-]{+execution test+} [-FAIL: gcc.dg/torture/pr116480-1.c -O0 (internal compiler error: in expand_fn_using_insn, at internal-fn.cc:268)-] [-FAIL:-]{+PASS:+} gcc.dg/torture/pr116480-1.c -O0 (test for excess errors) [-FAIL: gcc.dg/torture/pr116480-1.c -O1 (internal compiler error: in expand_fn_using_insn, at internal-fn.cc:268)-] [-FAIL:-]{+PASS:+} gcc.dg/torture/pr116480-1.c -O1 (test for excess errors) PASS: gcc.dg/torture/pr116480-1.c -O2 (test for excess errors) PASS: gcc.dg/torture/pr116480-1.c -O3 -g (test for excess errors) PASS: gcc.dg/torture/pr116480-1.c -Os (test for excess errors) ..., where we ran into 'gcc_assert (icode != CODE_FOR_nothing);' in 'gcc/internal-fn.cc:expand_fn_using_insn' for '__int128' '__builtin_clzg' etc.: during RTL pass: expand [...]/c-c++-common/pr111309-1.c: In function 'clzI': [...]/c-c++-common/pr111309-1.c:69:10: internal compiler error: in expand_fn_using_insn, at internal-fn.cc:268 0x120ec2cf internal_error(char const*, ...) [...]/gcc/diagnostic-global-context.cc:517 0x102c7c5b fancy_abort(char const*, int, char const*) [...]/gcc/diagnostic.cc:1722 0x109708eb expand_fn_using_insn [...]/gcc/internal-fn.cc:268 0x1098114f expand_internal_call(internal_fn, gcall*) [...]/gcc/internal-fn.cc:5273 0x1098114f expand_internal_call(gcall*) [...]/gcc/internal-fn.cc:5281 0x10594fc7 expand_call_stmt [...]/gcc/cfgexpand.cc:3049 [...] Likewise, as of commit e8ad697a "libstdc++: Use new type-generic built-ins in <bit> [PR118855]", the libstdc++ target library build ICEd in the same way. Additionally, this change fixes: [-FAIL:-]{+PASS:+} gcc.dg/pr105094.c (test for excess errors) ..., which was: [...]/gcc.dg/pr105094.c: In function 'foo': [...]/gcc.dg/pr105094.c:11:12: error: size of variable 's' is too large And, finally, regarding 'gcc.target/nvptx/stack_frame-1.c'. Before, in 'gcc/cfgexpand.cc': 'expand_used_vars' -> 'expand_used_vars_for_block' -> 'expand_one_var' for 'ww' -> 'gcc/function.cc:use_register_for_decl' due to 'DECL_MODE (decl) == BLKmode' did 'return false;', thus -> 'add_stack_var' (even if 'ww' wasn't then actually living on the stack). Now, 'ww' has 'TImode' and 'use_register_for_decl' does 'return true;', thus -> 'expand_one_register_var', and therefore no unused stack frame emitted. gcc/ * config/nvptx/nvptx.h (MAX_FIXED_MODE_SIZE): '#define'. gcc/testsuite/ * gcc.target/nvptx/stack_frame-1.c: Adjust.
-
Thomas Schwinge authored
gcc/testsuite/ * gcc.target/nvptx/stack_frame-1.c: New.
-
Thomas Schwinge authored
As of recent commit 8bf0ee8d "Fortran: Add transfer_between_remotes [PR107635]", we've got 'alloca' usage in 'libgfortran/caf/single.c:_gfortran_caf_transfer_between_remotes', and the libgfortran target library fails to build for legacy configurations where PTX 'alloca' is not available: ../../../../source-gcc/libgfortran/caf/single.c: In function ‘_gfortran_caf_transfer_between_remotes’: ../../../../source-gcc/libgfortran/caf/single.c:675:23: sorry, unimplemented: dynamic stack allocation not supported 675 | transfer_desc = __builtin_alloca (desc_size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../source-gcc/libgfortran/caf/single.c:680:20: sorry, unimplemented: dynamic stack allocation not supported 680 | transfer_ptr = __builtin_alloca (*opt_dst_charlen * src_size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[6]: *** [Makefile:4675: caf/single.lo] Error 1 With '-mfake-ptx-alloca', libgfortran again succeeds to build, and compared to before, we've got only a small number of regressions due to nvptx 'ld' complaining about 'unresolved symbol __GCC_nvptx__PTX_alloca_not_supported': [-PASS:-]{+FAIL:+} gfortran.dg/coarray/codimension_2.f90 -fcoarray=lib -O2 -lcaf_single (test for excess errors) [-PASS:-]{+FAIL:+} gfortran.dg/coarray/event_4.f08 -fcoarray=lib -O2 -lcaf_single (test for excess errors) [-PASS:-]{+UNRESOLVED:+} gfortran.dg/coarray/event_4.f08 -fcoarray=lib -O2 -lcaf_single [-execution test-]{+compilation failed to produce executable+} [-PASS:-]{+FAIL:+} gfortran.dg/coarray/fail_image_2.f08 -fcoarray=lib -O2 -lcaf_single (test for excess errors) [-PASS:-]{+UNRESOLVED:+} gfortran.dg/coarray/fail_image_2.f08 -fcoarray=lib -O2 -lcaf_single [-execution test-]{+compilation failed to produce executable+} [-PASS:-]{+FAIL:+} gfortran.dg/coarray/proc_pointer_assign_1.f90 -fcoarray=lib -O2 -lcaf_single (test for excess errors) [-PASS:-]{+UNRESOLVED:+} gfortran.dg/coarray/proc_pointer_assign_1.f90 -fcoarray=lib -O2 -lcaf_single [-execution test-]{+compilation failed to produce executable+} [-PASS:-]{+FAIL:+} gfortran.dg/coarray_43.f90 -O (test for excess errors) That's acceptable for such legacy PTX configurations. PR target/107635 libgfortran/ * config/t-nvptx: New. * configure.host [nvptx] (tmake_file): Add it.
-
Thomas Schwinge authored
With '-mfake-ptx-alloca' enabled, the user-visible behavior changes only for configurations where PTX 'alloca' is not available. Rather than a compile-time 'sorry, unimplemented: dynamic stack allocation not supported' in presence of dynamic stack allocation, compilation and assembly then succeeds. However, attempting to link in such '*.o' files then fails due to unresolved symbol '__GCC_nvptx__PTX_alloca_not_supported'. This is meant to be used in scenarios where large volumes of code are compiled, a small fraction of which runs into dynamic stack allocation, but these parts are not important for specific use cases, and we'd thus like the build to succeed, and error out just upon actual, very rare use of the offending '*.o' files. gcc/ * config/nvptx/nvptx.opt (-mfake-ptx-alloca): New. * config/nvptx/nvptx-protos.h (nvptx_output_fake_ptx_alloca): Declare. * config/nvptx/nvptx.cc (nvptx_output_fake_ptx_alloca): New. * config/nvptx/nvptx.md (define_insn "@nvptx_alloca_<mode>") [!(TARGET_PTX_7_3 && TARGET_SM52)]: Use it for '-mfake-ptx-alloca'. gcc/testsuite/ * gcc.target/nvptx/alloca-1-O0_-mfake-ptx-alloca.c: New. * gcc.target/nvptx/alloca-2-O0_-mfake-ptx-alloca.c: Likewise. * gcc.target/nvptx/alloca-4-O3_-mfake-ptx-alloca.c: Likewise. * gcc.target/nvptx/vla-1-O0_-mfake-ptx-alloca.c: Likewise. * gcc.target/nvptx/alloca-4-O3.c: 'dg-additional-options -mfake-ptx-alloca'.
-
Thomas Schwinge authored
nvptx: Delay 'sorry, unimplemented: dynamic stack allocation not supported' from expansion time to code generation This gives the back end a chance to clean out a few more unnecessary instances of dynamic stack allocation. This progresses: PASS: gcc.dg/pr78902.c (test for warnings, line 7) PASS: gcc.dg/pr78902.c (test for warnings, line 8) PASS: gcc.dg/pr78902.c (test for warnings, line 9) PASS: gcc.dg/pr78902.c (test for warnings, line 10) PASS: gcc.dg/pr78902.c (test for warnings, line 11) PASS: gcc.dg/pr78902.c (test for warnings, line 12) PASS: gcc.dg/pr78902.c (test for warnings, line 13) PASS: gcc.dg/pr78902.c strndup excessive bound at line 14 (test for warnings, line 13) [-UNSUPPORTED: gcc.dg/pr78902.c: dynamic stack allocation not supported-] {+PASS: gcc.dg/pr78902.c (test for excess errors)+} UNSUPPORTED: gcc.dg/torture/pr71901.c -O0 : dynamic stack allocation not supported [-UNSUPPORTED:-]{+PASS:+} gcc.dg/torture/pr71901.c -O1 [-: dynamic stack allocation not supported-]{+(test for excess errors)+} UNSUPPORTED: gcc.dg/torture/pr71901.c -O2 : dynamic stack allocation not supported UNSUPPORTED: gcc.dg/torture/pr71901.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions : dynamic stack allocation not supported UNSUPPORTED: gcc.dg/torture/pr71901.c -O3 -g : dynamic stack allocation not supported [-UNSUPPORTED:-]{+PASS:+} gcc.dg/torture/pr71901.c -Os [-: dynamic stack allocation not supported-]{+(test for excess errors)+} UNSUPPORTED: gcc.dg/torture/pr78742.c -O0 : dynamic stack allocation not supported [-UNSUPPORTED:-]{+PASS:+} gcc.dg/torture/pr78742.c -O1 [-: dynamic stack allocation not supported-]{+(test for excess errors)+} [-UNSUPPORTED:-]{+PASS:+} gcc.dg/torture/pr78742.c -O2 [-: dynamic stack allocation not supported-]{+(test for excess errors)+} [-UNSUPPORTED:-]{+PASS:+} gcc.dg/torture/pr78742.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions [-: dynamic stack allocation not supported-]{+(test for excess errors)+} [-UNSUPPORTED:-]{+PASS:+} gcc.dg/torture/pr78742.c -O3 -g [-: dynamic stack allocation not supported-]{+(test for excess errors)+} UNSUPPORTED: gcc.dg/torture/pr78742.c -Os : dynamic stack allocation not supported [-UNSUPPORTED:-]{+PASS:+} gfortran.dg/pr101267.f90 -O [-: dynamic stack allocation not supported-]{+(test for excess errors)+} [-UNSUPPORTED:-]{+PASS:+} gfortran.dg/pr112404.f90 -O [-: dynamic stack allocation not supported-]{+(test for excess errors)+} gcc/ * config/nvptx/nvptx.md (define_expand "allocate_stack") [!TARGET_SOFT_STACK]: Move 'sorry ("dynamic stack allocation not supported");'... (define_insn "@nvptx_alloca_<mode>"): ... here. gcc/testsuite/ * gcc.target/nvptx/alloca-1-unused-O0-sm_30.c: Adjust.
-
Thomas Schwinge authored
gcc/testsuite/ * gcc.target/nvptx/alloca-1-dead-O0-sm_30.c: New. * gcc.target/nvptx/alloca-1-dead-O0.c: Likewise. * gcc.target/nvptx/alloca-1-dead-O1-sm_30.c: Likewise. * gcc.target/nvptx/alloca-1-dead-O1.c: Likewise. * gcc.target/nvptx/alloca-1-unused-O0-sm_30.c: Likewise. * gcc.target/nvptx/alloca-1-unused-O0.c: Likewise. * gcc.target/nvptx/alloca-1-unused-O1-sm_30.c: Likewise. * gcc.target/nvptx/alloca-1-unused-O1.c: Likewise. * gcc.target/nvptx/vla-1-dead-O0-sm_30.c: Likewise. * gcc.target/nvptx/vla-1-dead-O0.c: Likewise. * gcc.target/nvptx/vla-1-dead-O1-sm_30.c: Likewise. * gcc.target/nvptx/vla-1-dead-O1.c: Likewise. * gcc.target/nvptx/vla-1-unused-O0-sm_30.c: Likewise. * gcc.target/nvptx/vla-1-unused-O0.c: Likewise. * gcc.target/nvptx/vla-1-unused-O1-sm_30.c: Likewise. * gcc.target/nvptx/vla-1-unused-O1.c: Likewise.
-
Jerry DeLisle authored
This change updates information about the -x option to clarify that it does not ensure standards compliance. Sparked by discussions in the following PR. PR fortran/108369 gcc/ChangeLog: * doc/invoke.texi: Add a note to clarify. Adjust some wording.
-
Marek Polacek authored
In this PR we crash in cxx_eval_constant_expression/GOTO_EXPR on: gcc_assert (cxx_dialect >= cxx23); The code obviously doesn't expect to see a goto pre-C++23. But we can get here with the new prvalue optimization. In this test we found ourselves in synthesize_method for X::X(). This function calls: a) finish_function, which does cp_genericize -> ... -> genericize_c_loops, which creates the GOTO_EXPR; b) expand_or_defer_fn -> maybe_clone_body -> ... -> cp_fold_function where we reach the new maybe_constant_init call and crash on the goto. Since we can validly get to that assert, I think we should just remove it. I don't see other similar asserts like this one. PR c++/118928 gcc/cp/ChangeLog: * constexpr.cc (cxx_eval_constant_expression) <case GOTO_EXPR>: Remove an assert. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-prvalue5.C: New test. Reviewed-by:
Jason Merrill <jason@redhat.com>
-
Vladimir N. Makarov authored
PR115458 also solves given PR. So the patch adds only a test case which can be used for testing LRA work aspects different from PR115458 test case. gcc/testsuite/ChangeLog: PR target/118940 * gcc.target/i386/pr118940.c: New test.
-
Vladimir N. Makarov authored
Patch for PR116234 solves given PR116366. So the patch adds only the test case which is very different from PR116234 one. gcc/testsuite/ChangeLog: PR rtl-optimization/116336 * gcc.dg/pr116336.c: New test.
-
Marek Polacek authored
Since C++20 P0846, a name followed by a < can be treated as a template-name even though name lookup did not find a template-name. That happens in this test with "i < foo ()": for (int id = 0; i < foo(); ++id); and results in a raft of errors about non-constant foo(). The problem is that the require_potential_constant_expression call in cp_parser_template_argument emits errors even when we're parsing tentatively. So we repeat the error when we're trying to parse as a nested-name-specifier, type-name, etc. Guarding the call with !cp_parser_uncommitted_to_tentative_parse_p would mean that require_potential_constant_expression never gets called. But we don't need the call at all as far as I can tell. Stuff like template<int N> struct S { }; int foo () { return 4; } void g () { S<foo()> s; } gets diagnosed in convert_nontype_argument. In fact, with this patch, we only emit "call to non-constexpr function" once. (That is, in C++17 only; C++14 uses a different path.) PR c++/118516 gcc/cp/ChangeLog: * parser.cc (cp_parser_template_argument): Don't call require_potential_constant_expression. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/fn-template11.C: * g++.dg/template/fn-template1.C: New test. * g++.dg/template/fn-template2.C: New test.
-
Richard Earnshaw authored
This test uses incremental linking, but that can generate warnings if the LTO step contains a mix of LTO and non-LTO object files (this can happen when there's a testglue file that is normally included during linking). We don't care about the testglue, though, so just tell the LTO optimizer to generate nolto-rel output, which is what it is falling back to anyway. gcc/testsuite: * gcc.target/arm/lto/pr61123-enum-size_0.c: (dg-lto-options) Move linker related options to ... (dg-extra-ld-options): ... here. Add -flinker-output=nolto-rel.
-
Andre Vehreschild authored
Fix ICE when associating a pointer to void (c_ptr) by looking at the compatibility of the type hierarchy. PR fortran/118789 gcc/fortran/ChangeLog: * trans-stmt.cc (trans_associate_var): Compare pointed to types when expr to associate is already a pointer. gcc/testsuite/ChangeLog: * gfortran.dg/associate_73.f90: New test.
-
Haochen Jiang authored
i386: Treat Granite Rapids/Granite Rapids-D/Diamond Rapids similar as Sapphire Rapids in x86-tune.def Since GNR, GNR-D, DMR are both P-core based, we should treat them just like SPR for now. gcc/ChangeLog: * config/i386/x86-tune.def (X86_TUNE_DEST_FALSE_DEP_FOR_GLC): Add GNR, GNR-D, DMR. (X86_TUNE_AVOID_256FMA_CHAINS): Ditto. (X86_TUNE_AVX512_MOVE_BY_PIECES): Ditto. (X86_TUNE_AVX512_STORE_BY_PIECES): Ditto.
-
Jakub Jelinek authored
During reading of this file I've noticed a typo in the comment, which this patch fixes. 2025-02-27 Jakub Jelinek <jakub@redhat.com> * gimple-range-phi.cc (phi_analyzer::process_phi): Fix comment typo, dpoesn;t -> doesn't.
-
Jakub Jelinek authored
Some of the plugin.exp tests FAIL in --enable-checking=release builds while they succeed in --enable-checking=yes builds. Initially I've changed some small simple out of line methods into inline ones in the header, but the tests kept failing, just with different symbols. The _ZN22simple_diagnostic_path9add_eventEmP9tree_nodeiPKcz symbol (and the others too) are normally emitted in simple-diagnostic-path.o, it isn't some fancy C++ optimization of classes with final method or LTO optimization. The problem is that simple-diagnostic-path.o is like most objects added into libbackend.a and we then link libbackend.a without -Wl,--whole-archive ... -Wl,--no-whole-archive around it (and can't easily, not all system compilers and linkers will support that). With --enable-checking=yes simple-diagnostic-path.o is pulled in, because selftest-run-tests.o calls simple_diagnostic_path_cc_tests and so simple-diagnostic-path.o is linked in. With --enable-checking=release self-tests aren't done and nothing links in simple-diagnostic-path.o, because nothing in the compiler proper needs anything from it, only the plugin tests. Using -Wl,-M on cc1 linking, I see that in --enable-checking=release build analyzer/analyzer-selftests.o digraph.o dwarf2codeview.o fibonacci_heap.o function-tests.o hash-map-tests.o hash-set-tests.o hw-doloop.o insn-peep.o lazy-diagnostic-path.o options-urls.o ordered-hash-map-tests.o pair-fusion.o print-rtl-function.o resource.o rtl-tests.o selftest-rtl.o selftest-run-tests.o simple-diagnostic-path.o splay-tree-utils.o typed-splay-tree.o vmsdbgout.o aren't linked into cc1 (the *test* for obvious reasons of not doing selftests, pair-fusion.o because it is aarch64 specific, hw-doloop.o because x86 doesn't have doloop opts, vmsdbgout.o because not on VMS). So, the question is if and what from digraph.o, fibinacci_heap.o, hw-doloop.o, insn-peep.o, lazy-diagnostic-path.o, options-urls.o, pair-fusion.o, print-rtl-function.o, resource.o, simple-diagnostic-path.o, splay-tree-utils.o, typed-splay-tree.o are supposed to be part of the plugin API if anything and how we arrange for those to be linked in when plugins are enabled. The following patch just adds unconditionally the {simple,lazy}-diagnostic-path.o objects to the link lines before libbackend.a so that their content is available to plugin users. 2025-02-27 Jakub Jelinek <jakub@redhat.com> PR testsuite/116143 * Makefile.in (EXTRA_BACKEND_OBJS): New variable. (BACKEND): Use it before libbackend.a.
-
Jakub Jelinek authored
This PR is about ubsan error on the c - cx1 + cy1 evaluation in the first hunk. The following patch hopefully fixes that by doing the additions/subtractions in poly_offset_int rather than poly_int64 and then converting back to poly_int64. If it doesn't fit, -1 is returned (which means it is unknown if there is a conflict or not). 2025-02-27 Jakub Jelinek <jakub@redhat.com> PR middle-end/118819 * alias.cc (memrefs_conflict_p): Perform arithmetics on c, xsize and ysize in poly_offset_int and return -1 if it is not representable in poly_int64.
-
GCC Administrator authored
-
- Feb 26, 2025
-
-
Patrick Palka authored
PR libstdc++/118083 libstdc++-v3/ChangeLog: * include/bits/ranges_base.h (ranges::__access::__possibly_const_range): Mention LWG 4027.
-
Jakub Jelinek authored
r15-209 allowed flexible array members inside of unions, but as the following testcase shows, not everything has been adjusted for that. Unlike structures, in unions flexible array member (as an extension) can be any of the members, not just the last one, as in union all members are effectively last. The first hunk is about an ICE on the initialization of the FAM in union which is not the last FIELD_DECL with a string literal, the second hunk just formatting fix, third hunk fixes a bug in which we were just throwing away the initializers (except for with string literal) of FAMs in unions which aren't the last FIELD_DECL, and the last hunk is to diagnose FAM errors in unions the same as for structures, in particular trying to initialize a FAM with non-constant or initialization in nested context. 2025-02-26 Jakub Jelinek <jakub@redhat.com> PR c/119001 gcc/ * varasm.cc (output_constructor_regular_field): Don't fail assertion if next is non-NULL and FIELD_DECL if TREE_CODE (local->type) is UNION_TYPE. gcc/c/ * c-typeck.cc (pop_init_level): Don't clear constructor_type if DECL_CHAIN of constructor_fields is NULL but p->type is UNION_TYPE. Formatting fix. (process_init_element): Diagnose non-static initialization of flexible array member in union or FAM in union initialization in nested context. gcc/testsuite/ * gcc.dg/pr119001-1.c: New test. * gcc.dg/pr119001-2.c: New test.
-
Jakub Jelinek authored
The stddef.h header for C23 defines __STDC_VERSION_STDDEF_H__ and unreachable macros multiple times in some cases. The header doesn't have normal multiple inclusion guard, because it supports for glibc inclusion with __need_{size_t,wchar_t,ptrdiff_t,wint_t,NULL}. While the definition of __STDC_VERSION_STDDEF_H__ and unreachable is done solely in the #ifdef _STDDEF_H part, so they are defined only if stddef.h is included without those __need_* macros defined. But actually once stddef.h is included without the __need_* macros, _STDDEF_H is then defined and while further stddef.h includes without __need_* macros don't do anything: #if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \ && !defined(__STDDEF_H__)) \ || defined(__need_wchar_t) || defined(__need_size_t) \ || defined(__need_ptrdiff_t) || defined(__need_NULL) \ || defined(__need_wint_t) if one includes whole stddef.h first and then stddef.h with some of the __need_* macros defined, the #ifdef _STDDEF_H part is used again. It isn't that big deal for most cases, as it uses extra guarding macros like: #ifndef _GCC_MAX_ALIGN_T #define _GCC_MAX_ALIGN_T ... #endif etc., but for __STDC_VERSION_STDDEF_H__/unreachable nothing like that is used. So, either we do what the following patch does and just don't define __STDC_VERSION_STDDEF_H__/unreachable second time, or use #ifndef unreachable separately for the #define unreachable() case, or use new _GCC_STDC_VERSION_STDDEF_H macro to guard this (or two, one for __STDC_VERSION_STDDEF_H__ and one for unreachable), or rework the initial condition to be just #if !defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \ && !defined(__STDDEF_H__) - I really don't understand why the header should do anything at all after it has been included once without __need_* macros. But changing how this behaves after 35 years might be risky for various OS/libc combinations. 2025-02-26 Jakub Jelinek <jakub@redhat.com> PR c/114870 * ginclude/stddef.h (__STDC_VERSION_STDDEF_H__, unreachable): Don't redefine multiple times if stddef.h is first included without __need_* defines and later with them. Move nullptr_t and unreachable and __STDC_VERSION_STDDEF_H__ definitions into the same defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L #if block. * gcc.dg/c23-stddef-2.c: New test.
-
Jakub Jelinek authored
The linaro CI found my PR119002 patch broke bootstrap on arm. Seems the problem is that it has incorrect REVERSE_CONDITION macro definition. All other target's REVERSE_CONDITION definitions and the default one just use the macro's arguments, while arm.h definition uses the MODE argument but uses code instead of CODE (the first argument). This happens to work because before my patch the only use of the macro was in jump.cc with /* First see if machine description supplies us way to reverse the comparison. Give it priority over everything else to allow machine description to do tricks. */ if (GET_MODE_CLASS (mode) == MODE_CC && REVERSIBLE_CC_MODE (mode)) return REVERSE_CONDITION (code, mode); but in my patch it is used with GT rather than code. 2025-02-26 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/119002 * config/arm/arm.h (REVERSE_CONDITION): Use CODE - the macro argument - in the macro rather than code.
-
Vladimir N. Makarov authored
Patch to fix PR115458 contained a code change in dealing with asm errors to avoid cycling in reporting the error for asm gotos. This code was wrong and resulted in checking RTL correctness failure. This patch reverts the code change and solves cycling in asm error reporting in a different way. gcc/ChangeLog: PR middle-end/119021 * lra.cc (lra_asm_insn_error): Use lra_invalidate_insn_data instead of lra_update_insn_regno_info. * lra-assigns.cc (lra_split_hard_reg_for): Restore old code.
-
Alexandre Oliva authored
I got tired of repeating the conditional that recognizes ia32 or x86_64, and introduced 'x86' as a shorthand for that, adjusting all occurrences in target-supports.exp, to set an example. I found some patterns that recognized i?86* and x86_64*, but I took those as likely cut&pastos instead of trying to preserve those weirdnesses. for gcc/ChangeLog * doc/sourcebuild.texi: Add x86 effective target. for gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_x86): New. Replace all uses of i?86-*-* and x86_64-*-* in this file.
-
Alexandre Oliva authored
Some vect-simd-clone tests fail when targeting ancient x86 variants, because the expected transformations only take place with -msse4 or higher. So arrange for these tests to take an -msse4 option on x86, so that the expected vectorization takes place, but decay to a compile test if vect.exp would enable execution but the target doesn't have an sse4 runtime. This requires the new dg-do-if to override the action on a target while retaining the default action on others, instead of disabling the test. We can count on avx512f compile-time support for these tests, because vect_simd_clones requires that on x86, and that implies sse4 support, so we need not complicate the scan conditionals with tests for sse4, except on the last test. for gcc/ChangeLog * doc/sourcebuild.texi (dg-do-if): Document. for gcc/testsuite/ChangeLog * lib/target-supports-dg.exp (dg-do-if): New. * gcc.dg/vect/vect-simd-clone-16f.c: Use -msse4 on x86, and skip in case execution is enabled but the runtime isn't. * gcc.dg/vect/vect-simd-clone-17f.c: Likewise. * gcc.dg/vect/vect-simd-clone-18f.c: Likewise. * gcc.dg/vect/vect-simd-clone-20.c: Likewise, but only skip the scan test.
-
Jakub Jelinek authored
Various plugin tests fail with --enable-checking=release, because the num_events and num_threads methods of simple_diagnostic_path are only used inside of #if CHECKING_P code inside of GCC proper and then tested inside of some plugin tests. So, with --enable-checking=yes they are compiled into cc1/cc1plus etc. binaries and plugins can call those, but with --enable-checking=release they are optimized away (at least for LTO builds). As they are trivial, the following patch just defines them inline, so that the plugin tests get their definitions directly and don't have to rely on cc1/cc1plus etc. exporting those. 2025-02-26 Jakub Jelinek <jakub@redhat.com> PR testsuite/116143 * simple-diagnostic-path.h (simple_diagnostic_path::num_events): Define inline. (simple_diagnostic_path::num_threads): Likewise. * simple-diagnostic-path.cc (simple_diagnostic_path::num_events): Remove out of line definition. (simple_diagnostic_path::num_threads): Likewise.
-
Andre Vehreschild authored
With vectorial shaped datatypes like e.g. complex numbers, fold_convert inserts a SAVE_EXPR. Using that on the lhs in an assignment prevented the update of the variable, when in a coarray. PR fortran/108233 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_trans_assignment_1): Remove SAVE_EXPR on lhs. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/complex_1.f90: New test.
-
Tamar Christina authored
These loops will now vectorize the entry finding loops. As such we get more failures because they were not expecting to be vectorized. Fixed by adding #pragma GCC novector. gcc/testsuite/ChangeLog: PR tree-optimization/118464 PR tree-optimization/116855 * g++.dg/ext/pragma-unroll-lambda-lto.C: Add pragma novector. * gcc.dg/tree-ssa/gen-vect-2.c: Likewise. * gcc.dg/tree-ssa/gen-vect-25.c: Likewise. * gcc.dg/tree-ssa/gen-vect-32.c: Likewise. * gcc.dg/tree-ssa/ivopt_mult_2g.c: Likewise. * gcc.dg/tree-ssa/ivopts-5.c: Likewise. * gcc.dg/tree-ssa/ivopts-6.c: Likewise. * gcc.dg/tree-ssa/ivopts-7.c: Likewise. * gcc.dg/tree-ssa/ivopts-8.c: Likewise. * gcc.dg/tree-ssa/ivopts-9.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-1.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-10.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-11.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-12.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-2.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-3.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-4.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-5.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-6.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-7.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-8.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-9.c: Likewise. * gcc.target/i386/pr90178.c: Likewise.
-
GCC Administrator authored
-
- Feb 25, 2025
-
-
Iain Buclaw authored
Extracts all public unittests from libphobos/src and emits them as standalone tests in the testsuite using the tests_extractor script. Compiling every module in the Phobos library with unittests included is computationally expensive, and these tests are now only ran when GCC_TEST_RUN_EXPENSIVE is not empty. When instead just compiling the unittests and linking in the module under test, this has been observed to reduce the time spent running the testsuite by more than half. libphobos/ChangeLog: * testsuite/libphobos.phobos/shared/phobos-shared.exp: Require is-effective-target run_expensive_tests. * testsuite/libphobos.phobos/static/phobos-static.exp: Likewise. * testsuite/libphobos.phobos/phobos.exp: New test. * testsuite/libphobos.phobos/std_algorithm_comparison.d: New test. * testsuite/libphobos.phobos/std_algorithm_iteration.d: New test. * testsuite/libphobos.phobos/std_algorithm_mutation.d: New test. * testsuite/libphobos.phobos/std_algorithm_searching.d: New test. * testsuite/libphobos.phobos/std_algorithm_setops.d: New test. * testsuite/libphobos.phobos/std_algorithm_sorting.d: New test. * testsuite/libphobos.phobos/std_array.d: New test. * testsuite/libphobos.phobos/std_ascii.d: New test. * testsuite/libphobos.phobos/std_base64.d: New test. * testsuite/libphobos.phobos/std_bigint.d: New test. * testsuite/libphobos.phobos/std_bitmanip.d: New test. * testsuite/libphobos.phobos/std_checkedint.d: New test. * testsuite/libphobos.phobos/std_complex.d: New test. * testsuite/libphobos.phobos/std_concurrency.d: New test. * testsuite/libphobos.phobos/std_container_array.d: New test. * testsuite/libphobos.phobos/std_container_binaryheap.d: New test. * testsuite/libphobos.phobos/std_container_dlist.d: New test. * testsuite/libphobos.phobos/std_container_rbtree.d: New test. * testsuite/libphobos.phobos/std_container_slist.d: New test. * testsuite/libphobos.phobos/std_container_util.d: New test. * testsuite/libphobos.phobos/std_conv.d: New test. * testsuite/libphobos.phobos/std_csv.d: New test. * testsuite/libphobos.phobos/std_datetime_date.d: New test. * testsuite/libphobos.phobos/std_datetime_interval.d: New test. * testsuite/libphobos.phobos/std_datetime_package.d: New test. * testsuite/libphobos.phobos/std_datetime_stopwatch.d: New test. * testsuite/libphobos.phobos/std_datetime_systime.d: New test. * testsuite/libphobos.phobos/std_datetime_timezone.d: New test. * testsuite/libphobos.phobos/std_demangle.d: New test. * testsuite/libphobos.phobos/std_digest_crc.d: New test. * testsuite/libphobos.phobos/std_digest_hmac.d: New test. * testsuite/libphobos.phobos/std_digest_md.d: New test. * testsuite/libphobos.phobos/std_digest_murmurhash.d: New test. * testsuite/libphobos.phobos/std_digest_package.d: New test. * testsuite/libphobos.phobos/std_digest_ripemd.d: New test. * testsuite/libphobos.phobos/std_digest_sha.d: New test. * testsuite/libphobos.phobos/std_encoding.d: New test. * testsuite/libphobos.phobos/std_exception.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_affix_allocator.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_aligned_block_list.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_allocator_list.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_ascending_page_allocator.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_bitmapped_block.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_bucketizer.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_fallback_allocator.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_free_list.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_kernighan_ritchie.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_quantizer.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_region.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_scoped_allocator.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_segregator.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_stats_collector.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_common.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_gc_allocator.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_mallocator.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_package.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_showcase.d: New test. * testsuite/libphobos.phobos/std_experimental_allocator_typed.d: New test. * testsuite/libphobos.phobos/std_file.d: New test. * testsuite/libphobos.phobos/std_format_package.d: New test. * testsuite/libphobos.phobos/std_format_read.d: New test. * testsuite/libphobos.phobos/std_format_spec.d: New test. * testsuite/libphobos.phobos/std_format_write.d: New test. * testsuite/libphobos.phobos/std_functional.d: New test. * testsuite/libphobos.phobos/std_getopt.d: New test. * testsuite/libphobos.phobos/std_int128.d: New test. * testsuite/libphobos.phobos/std_internal_cstring.d: New test. * testsuite/libphobos.phobos/std_internal_scopebuffer.d: New test. * testsuite/libphobos.phobos/std_json.d: New test. * testsuite/libphobos.phobos/std_logger_core.d: New test. * testsuite/libphobos.phobos/std_logger_nulllogger.d: New test. * testsuite/libphobos.phobos/std_math_algebraic.d: New test. * testsuite/libphobos.phobos/std_math_exponential.d: New test. * testsuite/libphobos.phobos/std_math_hardware.d: New test. * testsuite/libphobos.phobos/std_math_operations.d: New test. * testsuite/libphobos.phobos/std_math_remainder.d: New test. * testsuite/libphobos.phobos/std_math_rounding.d: New test. * testsuite/libphobos.phobos/std_math_traits.d: New test. * testsuite/libphobos.phobos/std_math_trigonometry.d: New test. * testsuite/libphobos.phobos/std_meta.d: New test. * testsuite/libphobos.phobos/std_mmfile.d: New test. * testsuite/libphobos.phobos/std_numeric.d: New test. * testsuite/libphobos.phobos/std_outbuffer.d: New test. * testsuite/libphobos.phobos/std_package.d: New test. * testsuite/libphobos.phobos/std_parallelism.d: New test. * testsuite/libphobos.phobos/std_path.d: New test. * testsuite/libphobos.phobos/std_random.d: New test. * testsuite/libphobos.phobos/std_range_interfaces.d: New test. * testsuite/libphobos.phobos/std_range_package.d: New test. * testsuite/libphobos.phobos/std_range_primitives.d: New test. * testsuite/libphobos.phobos/std_regex_package.d: New test. * testsuite/libphobos.phobos/std_signals.d: New test. * testsuite/libphobos.phobos/std_socket.d: New test. * testsuite/libphobos.phobos/std_stdio.d: New test. * testsuite/libphobos.phobos/std_string.d: New test. * testsuite/libphobos.phobos/std_sumtype.d: New test. * testsuite/libphobos.phobos/std_traits.d: New test. * testsuite/libphobos.phobos/std_typecons.d: New test. * testsuite/libphobos.phobos/std_typetuple.d: New test. * testsuite/libphobos.phobos/std_uni_package.d: New test. * testsuite/libphobos.phobos/std_uri.d: New test. * testsuite/libphobos.phobos/std_utf.d: New test. * testsuite/libphobos.phobos/std_uuid.d: New test. * testsuite/libphobos.phobos/std_variant.d: New test. * testsuite/libphobos.phobos/std_zlib.d: New test.
-
Giuseppe D'Angelo authored
stable_sort has been made constexpr in C++26. Apart from plastering a few functions with constexpr, there's an implementation challenge, that is: stable_sort takes different codepaths in case extra memory can be allocated. Rather than doing some major refactorings, simply use the non-allocating path during constant evaluation. That's the same codepath used when extra memory could not be allocated, as well as by freestanding. libstdc++-v3/ChangeLog: * include/bits/algorithmfwd.h (stable_sort): Add constexpr. * include/bits/ranges_algo.h (__stable_sort_fn): Add constexpr to the function call operators. * include/bits/stl_algo.h (__stable_sort): Add constexpr. During constant evaluation, always use the non-allocating path. (stable_sort): Add constexpr. (__inplace_stable_sort): Likewise. (__merge_without_buffer): Likewise. * include/bits/version.def (constexpr_algorithms): Bump value for C++26. * include/bits/version.h: Regnerate. * testsuite/25_algorithms/cpp_lib_constexpr.cc: Test the bumped feature-testing macro. * testsuite/25_algorithms/headers/algorithm/synopsis.cc: Adapt the test to constexpr stable_sort. * testsuite/25_algorithms/stable_sort/constexpr.cc: New test. Signed-off-by:
Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-
Giuseppe D'Angelo authored
Following the precedent of _GLIBCXX20_CONSTEXPR. It will be used to decorate some functions which have been made constexpr in C++26 (for instance P2562R1, and maybe P3508R0, P3369R0, ...). libstdc++-v3/ChangeLog: * include/bits/c++config (_GLIBCXX26_CONSTEXPR): New macro. Signed-off-by:
Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-
Jonathan Wakely authored
The r15-4321-gd8ef4471cb9c9f change incorrectly used __value as the member of the __memcpyable_integer trait, but it should have been __width. That meant this overload was not being used for _Tp != _Up. Also return after doing the loop for the consteval case. The missing return wasn't causing incorrect behaviour because the consteval loop increments the iterator until it equals the end of the range, so the memset isn't done. But it's still better to return and not even try to do the memset. libstdc++-v3/ChangeLog: PR libstdc++/93059 * include/bits/stl_algobase.h (__fill_a1): Fix typo in SFINAE constraint.
-
Andrew Pinski authored
So what is happening here is that after r15-268-g9dbff9c05520a7, a move instruction still exists after combine and the register allocator choses different register allocation order for the xor and because the input operand of lzcntq is not the same as output operand, there is an extra xor that happens (due to an errata). This fixes the testcase by using loading from a pointer instead of a function argument directly. The register allocator has more freedom since the load has no hard register associated with it (rdi) so it can be in eax register right away. Tested for both -m32 and -m64 on x86_64-linux-gnu. gcc/testsuite/ChangeLog: PR testsuite/115028 * gcc.target/i386/pr101950-2.c: Use a pointer argument instead of the argument directly. Signed-off-by:
Andrew Pinski <quic_apinski@quicinc.com>
-
Iain Buclaw authored
This script parses all unittests annotated with three slashes (`///') and extracts them into a standalone test case. The intended use is for generating inexpensive tests to be ran for the phobos testsuite. libphobos/ChangeLog: * scripts/.gitignore: Add tests_extractor. * scripts/README: Document tests_extractor.d. * scripts/tests_extractor.d: New file.
-
Iain Buclaw authored
The druntime and druntime_shared tests are identical, save for one compiled with `-static-libphobos' and the other `-shared-libphobos'. Move them to libphobos.druntime/static and libphobos.druntime/shared respectively. This has also been done for libphobos.phobos. libphobos/ChangeLog: * testsuite/libphobos.druntime_shared/druntime_shared.exp: Move to... * testsuite/libphobos.druntime/shared/druntime-shared.exp: ...here. * testsuite/libphobos.druntime/druntime.exp: Move to... * testsuite/libphobos.druntime/static/druntime-static.exp: ...here. * testsuite/libphobos.phobos_shared/phobos_shared.exp: Move to... * testsuite/libphobos.phobos/shared/phobos-shared.exp: ...here. * testsuite/libphobos.phobos/phobos.exp: Move to... * testsuite/libphobos.phobos/static/phobos-static.exp: ...here.
-
François Dumont authored
It is wrong to reuse a cached hash code from another container when this code depends on the state of the container's Hash functor. Add checks that Hash functor is stateless before reusing the cached hash code. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h (_Hash_code_base::_M_copy_code, _Hash_code_base::_M_store_code): Remove. * include/bits/hashtable.h (_M_hash_code_ext): New. (_M_merge_multi(_Hashtable&)): Use latter. (_M_copy_code): New. (_M_assign): Use latter. (_M_bucket_index_ex): New. (_M_equals): Use latter. (_M_store_code): New. (_M_src_hash_code): Remove key_type parameter. * testsuite/23_containers/unordered_map/modifiers/merge.cc (test10): New test case.
-
Jason Merrill authored
r10-11132 uses C++11 default member initializers, which breaks bootstrapping with a C++98 compiler. gcc/ChangeLog: * doc/install.texi: 10.5 won't bootstrap with C++98.
-