- Jan 10, 2024
-
-
Maciej W. Rozycki authored
Add terminating `/' character missing from one of the test harness command clauses in pr105314.c. This causes no issue with compilation owing to another comment immediately following, but would cause a: pr105314.c:3:1: warning: "/*" within comment [-Wcomment] message if warnings were enabled. gcc/testsuite/ * gcc.target/riscv/pr105314.c: Fix comment termination.
-
Maciej W. Rozycki authored
Complement commit c1e8cb3d ("RISC-V: Rework branch costing model for if-conversion") and also handle extraneous sign extend operations that are sometimes produced by `noce_try_cmove_arith' instead of zero extend operations, making branch costing consistent. It is unclear what the condition is for the middle end to choose between the zero extend and sign extend operation, but the test case included uses sign extension with 64-bit targets, preventing if-conversion from triggering across all the architectural variants. There are further anomalies revealed by the test case, specifically the exceedingly high branch cost of 6 required for the `-mmovcc' variant despite that the final branchless sequence only uses 4 instructions, the missed conversion at -O1 for 32-bit targets even though code is machine word size agnostic, and the missed conversion at -Os and -Oz for 32-bit Zicond targets even though the branchless sequence would be shorter than the branched one. These will have to be handled separately. gcc/ * config/riscv/riscv.cc (riscv_noce_conversion_profitable_p): Also handle sign extension. gcc/testsuite/ * gcc.target/riscv/cset-sext-sfb.c: New test. * gcc.target/riscv/cset-sext-thead.c: New test. * gcc.target/riscv/cset-sext-ventana.c: New test. * gcc.target/riscv/cset-sext-zicond.c: New test. * gcc.target/riscv/cset-sext.c: New test.
-
Jakub Jelinek authored
This test was already fixed by r14-6051 aka PR112770 fix. 2024-01-10 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/112734 * gcc.dg/bitint-64.c: New test.
-
Alex Coplan authored
As discussed on IRC, this makes the aarch64 ldp/stp pass off by default. This should stabilize the trunk and give some time to address the P1 regressions. gcc/ChangeLog: * config/aarch64/aarch64.opt (-mearly-ldp-fusion): Set default to 0. (-mlate-ldp-fusion): Likewise.
-
Tamar Christina authored
The vectorizer needs to know during early break vectorization whether the edge that will be taken if the condition is true stays or leaves the loop. This is because the code assumes that if you take the true branch you exit the loop. If you don't exit the loop it has to generate a different condition. Basically it uses this information to decide whether it's generating a "any element" or an "all element" check. Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu and no issues with --enable-lto --with-build-config=bootstrap-O3 --enable-checking=release,yes,rtl,extra. gcc/ChangeLog: PR tree-optimization/113287 * tree-vect-stmts.cc (vectorizable_early_exit): Check the flags on edge instead of using BRANCH_EDGE to determine true edge. gcc/testsuite/ChangeLog: PR tree-optimization/113287 * gcc.dg/vect/vect-early-break_100-pr113287.c: New test. * gcc.dg/vect/vect-early-break_99-pr113287.c: New test.
-
Richard Biener authored
When if-conversion was changed to use .COND_ADD/SUB for conditional reduction it was forgotten to update reduction path handling to canonicalize .COND_SUB to .COND_ADD for vectorizable_reduction similar to what we do for MINUS_EXPR. The following adds this and testcases exercising this at runtime and looking for the appropriate masked subtraction in the vectorized code on x86. PR tree-optimization/113078 * tree-vect-loop.cc (check_reduction_path): Canonicalize .COND_SUB to .COND_ADD. * gcc.dg/vect/vect-reduc-cond-sub.c: New testcase. * gcc.target/i386/vect-pr113078.c: Likewise.
-
Tamar Christina authored
Should control enter the switch from one of the cases other than the IVDEP one then the variable remains uninitialized. This fixes it by initializing it to false. gcc/cp/ChangeLog: * parser.cc (cp_parser_pragma): Initialize to false.
-
David Malcolm authored
Given e.g. this missppelled option (omitting the trailing 's'): $ LANG=C ./xgcc -B. -fno-inline-small-function xgcc: error: unrecognized command-line option '-fno-inline-small-function'; did you mean '-fno-inline-small-functions'? we weren't providing a documentation URL for the suggestion. The issue is the URLification code uses find_opt, which doesn't consider the various '-fno-' prefixes. This patch adds a way to find the pertinent prefix remapping and uses it when determining URLs. With this patch, the suggestion '-fno-inline-small-functions' now gets a documentation link (to that of '-finline-small-functions'). gcc/ChangeLog: * gcc-urlifier.cc (gcc_urlifier::get_url_suffix_for_option): Handle prefix mappings before calling find_opt. (selftest::gcc_urlifier_cc_tests): Add example of urlifying a "-fno-"-prefixed command-line option. * opts-common.cc (get_option_prefix_remapping): New. * opts.h (get_option_prefix_remapping): New decl. Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
David Malcolm authored
TL;DR: for the case when the user misspells a command-line option and we suggest one, with this patch we now provide a documentation URL for the suggestion. In r14-5118-gc5db4d8ba5f3de I added a mechanism to automatically add URLs to quoted strings in diagnostics, and in r14-6920-g9e49746da303b8 through r14-6923-g4ded42c2c5a5c9 wired this up so that any time we mention a command-line option in a diagnostic message in quotes, the user gets a URL to the HTML documentation for that option. However this only worked for quoted strings that were fully within a single "chunk" within the pretty-printer implementation, such as: * "%<-foption%>" (handled in phase 1) * "%qs", "-foption" (handled in phase 2) but not where the the quoted string straddled multiple chunks, in particular for this important case in the gcc.cc: error ("unrecognized command-line option %<-%s%>;" " did you mean %<-%s%>?", switches[i].part1, hint); e.g. for: $ LANG=C ./xgcc -B. -finling-small-functions xgcc: error: unrecognized command-line option '-finling-small-functions'; did you mean '-finline-small-functions'? which within pp_format becomes these chunks: * chunk 0: "unrecognized command-line option `-" * chunk 1: switches[i].part1 (e.g. "finling-small-functions") * chunk 2: "'; did you mean `-" * chunk 3: hint (e.g. "finline-small-functions") * chunk 4: "'?" where the first quoted run is in chunks 1-3 and the second in chunks 2-4. Hence we were not attempting to provide a URL for the two quoted runs, and, in particular not for the hint. This patch refactors the urlification mechanism in pretty-print.cc so that it checks for quoted runs that appear in phase 3 (as well as in phases 1 and 2, as before). With this, the quoted text runs "-finling-small-functions" and "-finline-small-functions" are passed to the urlifier, which successfully finds a documentation URL for the latter. As before, the urlification code is only run if the URL escapes are enabled, and only for messages from diagnostic.cc (error, warn, inform, etc), not for all pretty_printer usage. gcc/ChangeLog: * diagnostic.cc (diagnostic_context::report_diagnostic): Pass m_urlifier to pp_output_formatted_text. * pretty-print.cc: Add #define of INCLUDE_VECTOR. (obstack_append_string): New overload, taking a length. (urlify_quoted_string): Pass in an obstack ptr, rather than using that of the pp's buffer. Generalize to handle trailing text in the buffer beyond the run of quoted text. (class quoting_info): New. (on_begin_quote): New. (on_end_quote): New. (pp_format): Refactor phase 1 and phase 2 quoting support, moving it to calls to on_begin_quote and on_end_quote. (struct auto_obstack): New. (quoting_info::handle_phase_3): New. (pp_output_formatted_text): Add urlifier param. Use it if there is deferred urlification. Delete m_quotes. (selftest::pp_printf_with_urlifier): Pass urlifier to pp_output_formatted_text. (selftest::test_urlification): Update results for the existing case of quoted text stradding chunks; add more such test cases. * pretty-print.h (class quoting_info): New forward decl. (chunk_info::m_quotes): New field. (pp_output_formatted_text): Add optional urlifier param. Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
David Malcolm authored
No functional change intended. gcc/ChangeLog: * pretty-print.cc (selftest::test_pp_format): Add selftest coverage for numbered args. Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
-
Julian Brown authored
This patch adjusts diagnostic output for C++23 and above for the test case mentioned in the commit title. 2024-01-10 Julian Brown <julian@codesourcery.com> gcc/testsuite/ * g++.dg/gomp/bad-array-section-10.C: Adjust diagnostics for C++23 and up.
-
Julian Brown authored
This patch fixes several tests introduced by the commit r14-7033-g1413af02d62182 for 32-bit targets. 2024-01-10 Julian Brown <julian@codesourcery.com> gcc/testsuite/ * g++.dg/gomp/array-section-1.C: Fix scan output for 32-bit target. * g++.dg/gomp/array-section-2.C: Likewise. * g++.dg/gomp/bad-array-section-4.C: Adjust error output for 32-bit target.
-
Tamar Christina authored
When we peel at_exit we are moving the new loop at the exit of the previous loop. This means that the blocks outside the loop dat the previous loop used to dominate are no longer being dominated by it. The new dominators however are hard to predict since if the loop has multiple exits and all the exits are an "early" one then we always execute the scalar loop. In this case the scalar loop can completely dominate the new loop. If we later have skip_vector then there's an additional skip edge added that might change the dominators. The previous patch would force an update of all blocks reachable from the new exits. This one updates *only* blocks that we know the scalar exits dominated. For the examples this reduces the blocks to update from 18 to 3. gcc/ChangeLog: PR tree-optimization/113144 PR tree-optimization/113145 * tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg): Update all BB that the original exits dominated. gcc/testsuite/ChangeLog: PR tree-optimization/113144 PR tree-optimization/113145 * gcc.dg/vect/vect-early-break_94-pr113144.c: New test.
-
Jakub Jelinek authored
2024-01-10 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/113297 * gcc.dg/bitint-63.c: Fix PR number.
-
Jakub Jelinek authored
My earlier change broke Solaris testing, because @FLOCK@ isn't substituted just into libgomp/Makefile where it worked, but also the testsuite/libgomp-site-extra.exp file where Make variables aren't present and can't be substituted. The following patch instead computes the absolute srcdir path and uses it for FLOCK. 2024-01-10 Jakub Jelinek <jakub@redhat.com> PR libgomp/113192 * configure.ac (FLOCK): Use $libgomp_abs_srcdir/testsuite/flock instead of \$(abs_top_srcdir)/testsuite/flock. * configure: Regenerated.
-
Eric Botcazou authored
This implements the support of DW_AT_endianity for enumeration types because they are scalar and therefore, reverse Scalar_Storage_Order is supported for them, but only when the -gstrict-dwarf switch is not passed because this is an extension. There is an associated GDB patch to be submitted to grok the new DWARF. gcc/ * dwarf2out.cc (modified_type_die): Extend the support of reverse storage order to enumeration types if -gstrict-dwarf is not passed. (gen_enumeration_type_die): Add REVERSE parameter and generate the DIE immediately after the existing one if it is true. (gen_tagged_type_die): Add REVERSE parameter and pass it in the call to gen_enumeration_type_die. (gen_type_die_with_usage): Add REVERSE parameter and pass it in the first recursive call as well as the call to gen_tagged_type_die. (gen_type_die): Add REVERSE parameter and pass it in the call to gen_type_die_with_usage.
-
chenxiaolong authored
The function of this test is to check that the compiler supports vectorization using SLP and vec_{load/store/*}_lanes. However, vec_{load/store/*}_lanes are not supported on LoongArch, such as the corresponding "st4/ld4" directives on aarch64. gcc/testsuite/ChangeLog: * gcc.dg/vect/slp-21.c: Add loongarch.
-
chenxiaolong authored
After the code is committed in r14-6948, GCC regression testing on some architectures will produce the following error: "error executing dg-final: unknown effective target keyword `loongarch*-*-*'" gcc/testsuite/ChangeLog: * lib/target-supports.exp: Removed an issue with "target keyword" checking errors on LoongArch architecture.
-
Jakub Jelinek authored
As changed in other parts of the compiler, using build_nonstandard_integer_type is not appropriate for arbitrary precisions, especially if the precision comes from a BITINT_TYPE or something based on that, build_nonstandard_integer_type relies on some integral mode being supported that can support the precision. The following patch uses build_bitint_type instead for BITINT_TYPE precisions. Note, it would be good if we were able to punt on the optimization (but this code doesn't seem to be able to punt, so it needs to be done somewhere earlier) at least in cases where building it would be invalid. E.g. right now BITINT_TYPE can support precisions up to 65535 (inclusive), but 65536 will not work anymore (we can't have > 16-bit TYPE_PRECISION). I've tried to replace 513 with 65532 in the testcase and it didn't ICE, so maybe it ran into some other SRA limit. 2024-01-10 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/113120 * tree-sra.cc (analyze_access_subtree): For BITINT_TYPE with root->size TYPE_PRECISION don't build anything new. Otherwise, if root->type is a BITINT_TYPE, use build_bitint_type rather than build_nonstandard_integer_type. * gcc.dg/bitint-63.c: New test.
-
Hongyu Wang authored
For APX, the inline asm behavior was not mentioned in any document before. Add description for it. gcc/ChangeLog: * config/i386/i386.opt: Adjust document. * doc/invoke.texi: Add description for -mapx-inline-asm-use-gpr32.
-
Juzhe-Zhong authored
This patch is inspired by LLVM patches: https://github.com/llvm/llvm-project/pull/76550 https://github.com/llvm/llvm-project/pull/77473 Use vaaddu for AVG vectorization. Before this patch: vsetivli zero,8,e8,mf2,ta,ma vle8.v v3,0(a1) vle8.v v2,0(a2) vwaddu.vv v1,v3,v2 vsetvli zero,zero,e16,m1,ta,ma vadd.vi v1,v1,1 vsetvli zero,zero,e8,mf2,ta,ma vnsrl.wi v1,v1,1 vse8.v v1,0(a0) ret After this patch: vsetivli zero,8,e8,mf2,ta,ma csrwi vxrm,0 vle8.v v1,0(a1) vle8.v v2,0(a2) vaaddu.vv v1,v1,v2 vse8.v v1,0(a0) ret Note on signed averaging addition Based on the rvv spec, there is also a variant for signed averaging addition called vaadd. But AFAIU, no matter in which rounding mode, we cannot achieve the semantic of signed averaging addition through vaadd. Thus this patch only introduces vaaddu. More details in: https://github.com/riscv/riscv-v-spec/issues/935 https://github.com/riscv/riscv-v-spec/issues/934 Tested on both RV32 and RV64 no regression. Ok for trunk ? gcc/ChangeLog: * config/riscv/autovec.md (<u>avg<v_double_trunc>3_floor): Remove. (avg<v_double_trunc>3_floor): New pattern. (<u>avg<v_double_trunc>3_ceil): Remove. (avg<v_double_trunc>3_ceil): New pattern. (uavg<mode>3_floor): Ditto. (uavg<mode>3_ceil): Ditto. * config/riscv/riscv-protos.h (enum insn_flags): Add for average addition. (enum insn_type): Ditto. * config/riscv/riscv-v.cc: Ditto. * config/riscv/vector-iterators.md (ashiftrt): Remove. (ASHIFTRT): Ditto. * config/riscv/vector.md: Add VLS modes. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/vls/avg-1.c: Adapt test. * gcc.target/riscv/rvv/autovec/vls/avg-2.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/avg-3.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/avg-4.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/avg-5.c: Ditto. * gcc.target/riscv/rvv/autovec/vls/avg-6.c: Ditto. * gcc.target/riscv/rvv/autovec/widen/vec-avg-rv32gcv.c: Ditto. * gcc.target/riscv/rvv/autovec/widen/vec-avg-rv64gcv.c: Ditto.
-
Kewen Lin authored
As PR112751 shows, commit r14-5628 caused pcrel-sibcall-1.c to fail as it enables ipa-vrp which makes return values of functions {x,y,xx} as known and propagated. This patch is to adjust it with noipa to make it not fragile. PR testsuite/112751 gcc/testsuite/ChangeLog: * gcc.target/powerpc/pcrel-sibcall-1.c: Replace noinline as noipa.
-
Kewen Lin authored
As PR111480 shows, commit r14-4079 only optimizes the case of vctzlsbb but not for the similar vclzlsbb. This patch is to consider vclzlsbb as well and avoid the failure on the reported test case. It also simplifies the patterns with iterator and attribute. PR target/111480 gcc/ChangeLog: * config/rs6000/vsx.md (VCZLSBB): New int iterator. (vczlsbb_char): New int attribute. (vclzlsbb_<mode>, vctzlsbb_<mode>): Merge to ... (vc<vczlsbb_char>zlsbb_<mode>): ... this. (*vctzlsbb_zext_<mode>): Rename to ... (*vc<vczlsbb_char>zlsbb_zext_<mode>): ... this, and extend it to cover vclzlsbb.
-
Kewen Lin authored
I noticed that commit r14-6192 can't help PR112606 #c3 as it only takes care of SF/DF but TF/KF can still suffer the issue. Similar to commit r14-6192, this patch is to take care of copysign<mode>3 with IEEE128 as well. PR target/112606 gcc/ChangeLog: * config/rs6000/rs6000.md (copysign<mode>3 IEEE128): Change predicate of the last argument from altivec_register_operand to any_operand. If operands[2] is CONST_DOUBLE, emit abs or neg abs depending on its sign otherwise if it doesn't satisfy altivec_register_operand, force it to REG using copy_to_mode_reg.
-
Kewen Lin authored
As PR113100 shows, the unbiasing introduced by r14-6737 can cause the scrubbing to overrun and screw some critical data on stack like saved toc base consequently cause segfault. By checking PR112917, IMHO we should keep this unbiasing guarded under SPARC_STACK_BOUNDARY_HACK (TARGET_ARCH64 && TARGET_STACK_BIAS), similar to some existing code special treating SPARC stack bias. PR middle-end/113100 gcc/ChangeLog: * builtins.cc (expand_builtin_stack_address): Guard stack point adjustment with SPARC_STACK_BOUNDARY_HACK.
-
Yang Yujie authored
Since we do not need printing or manual parsing of this option, (whether in the driver or for target attributes to be supported later) it can be handled in the .opt file framework. gcc/ChangeLog: * config/loongarch/genopts/loongarch-strings: Remove explicit-reloc argument string definitions. * config/loongarch/loongarch-str.h: Same. * config/loongarch/genopts/loongarch.opt.in: Mark -m[no-]explicit-relocs as aliases to -mexplicit-relocs={always,none} * config/loongarch/loongarch.opt: Regenerate. * config/loongarch/loongarch.cc: Same.
-
Yang Yujie authored
Target features constants from loongarch-def.h are currently defined as macros. Switch to enums for better look in the debugger. gcc/ChangeLog: * config/loongarch/loongarch-def.h: Define constants with enums instead of Macros.
-
Yang Yujie authored
LoongArch ISA manual v1.10 suggests that software should not depend on the ISA version number for marking processor features. The ISA version number is now defined as a collective name of individual ISA evolutions. Since there is a independent ISA evolution mask now, we can drop the version information from the base ISA. gcc/ChangeLog: * config/loongarch/genopts/loongarch-strings: Rename. * config/loongarch/genopts/loongarch.opt.in: Same. * config/loongarch/loongarch-cpu.cc: Same. * config/loongarch/loongarch-def.cc: Same. * config/loongarch/loongarch-def.h: Same. * config/loongarch/loongarch-opts.cc: Same. * config/loongarch/loongarch-opts.h: Same. * config/loongarch/loongarch-str.h: Same. * config/loongarch/loongarch.opt: Same.
-
Yang Yujie authored
gcc/ChangeLog: * config/loongarch/genopts/genstr.sh: Prepend the isa_evolution variable with the common la_ prefix. * config/loongarch/genopts/loongarch.opt.in: Mark ISA evolution flags as saved using TargetVariable. * config/loongarch/loongarch.opt: Same. * config/loongarch/loongarch-def.h: Define evolution_set to mark changes to the -march default. * config/loongarch/loongarch-driver.cc: Same. * config/loongarch/loongarch-opts.cc: Same. * config/loongarch/loongarch-opts.h: Define and use ISA evolution conditions around the la_target structure. * config/loongarch/loongarch.cc: Same. * config/loongarch/loongarch.md: Same. * config/loongarch/loongarch-builtins.cc: Same. * config/loongarch/loongarch-c.cc: Same. * config/loongarch/lasx.md: Same. * config/loongarch/lsx.md: Same. * config/loongarch/sync.md: Same.
-
Juzhe-Zhong authored
While working on refining the cost model, I notice this test will generate unexpected scalar xor instructions if we don't tune cost model carefully. Add more assembler to avoid future regression. Committed. gcc/testsuite/ChangeLog: * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-7.c: Add assembler-not check.
-
GCC Administrator authored
-
- Jan 09, 2024
-
-
Jonathan Wakely authored
Fix some copy & pasted logic in __is_extended_pictographic. This function should yield false for the values before the first edge, not true. Also add a missing boundary condition check in __incb_property. Also Fix an off-by-one error in _Utf_iterator::operator++() that would make dereferencing a past-the-end iterator undefined (where the intended design is that the iterator is always incrementable and dereferenceable, for better memory safety). Also simplify the grapheme view iterator, which still contained some remnants of an earlier design I was experimenting with. Slightly tweak the gen_libstdcxx_unicode_data.py script so that the _Gcb_property enumerators are in the order we encounter them in the data file, instead of sorting them alphabetically. Start with the "Other" property at value 0, because that's the default property for anything not in the file. This makes no practical difference, but seems cleaner. It causes the values in the __gcb_edges table to change, so can only be done now before anybody is using this code yet. The enumerator values and table entries become ABI artefacts for the function using them. contrib/ChangeLog: * unicode/gen_libstdcxx_unicode_data.py: Print out Gcb_property enumerators in the order they're seen, not alphabetical order. libstdc++-v3/ChangeLog: * include/bits/unicode-data.h: Regenerate. * include/bits/unicode.h (_Utf_iterator::operator++()): Fix off by one error. (__incb_property): Add missing check for values before the first edge. (__is_extended_pictographic): Invert return values to fix copy&pasted logic. (_Grapheme_cluster_view::_Iterator): Remove second iterator member and find end of cluster lazily. * testsuite/ext/unicode/grapheme_view.cc: New test. * testsuite/ext/unicode/properties.cc: New test. * testsuite/ext/unicode/view.cc: New test.
-
Andreas Schwab authored
Tighten the regex to find the start of the .dynsym symtab in the readelf output to avoid matching the section symbol in the normal symtab. libstdc++-v3: * scripts/extract_symvers.in: Require final colon to only match .dsynsym in the header of the dynamic symtab.
-
Jason Merrill authored
In a couple of places in the xobj patch I noticed that is_this_parameter probably wanted to change to is_object_parameter; this implements that and does the additional adjustments needed to make the accessor fixits handle xobj parms. gcc/cp/ChangeLog: * semantics.cc (is_object_parameter): New. * cp-tree.h (is_object_parameter): Declare. * call.cc (maybe_warn_class_memaccess): Use it. * search.cc (field_access_p): Use it. (class_of_object_parm): New. (field_accessor_p): Adjust for explicit object parms. gcc/testsuite/ChangeLog: * g++.dg/torture/accessor-fixits-9-xobj.C: New test.
-
Jason Merrill authored
The FIXME in xobj_iobj_parameters_correspond was due to expecting TYPE_MAIN_VARIANT to be the same for all equivalent types, which is not the case. And I adjusted some comments that I disagree with; the iobj parameter adjustment only applies to overload resolution, we can handle that in cand_parms_match (and I have WIP for that). gcc/cp/ChangeLog: * call.cc (build_over_call): Refactor handle_arg lambda. * class.cc (xobj_iobj_parameters_correspond): Fix FIXME. * method.cc (defaulted_late_check): Adjust comments.
-
waffl3x authored
This adds support for defaulted comparison operators and copy/move assignment operators, as well as allowing user defined xobj copy/move assignment operators. It turns out defaulted comparison operators already worked though, so this just adds a test for them. Defaulted comparison operators were not so nice and required a bit of a hack. Should work fine though! The diagnostics leave something to be desired, and there are some things that could be improved with more extensive design changes. There are a few notes left indicating where I think we could make improvements. Aside from some small bugs, with this commit xobj member functions should be feature complete. PR c++/102609 gcc/cp/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - CWG2586. * decl.cc (copy_fn_p): Accept xobj copy assignment functions. (move_signature_fn_p): Accept xobj move assignment functions. * method.cc (do_build_copy_assign): Handle defaulted xobj member functions. (defaulted_late_check): Comment. (defaultable_fn_check): Comment. gcc/testsuite/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - CWG2586. * g++.dg/cpp23/explicit-obj-basic6.C: New test. * g++.dg/cpp23/explicit-obj-default1.C: New test. * g++.dg/cpp23/explicit-obj-default2.C: New test. Signed-off-by:
Waffl3x <waffl3x@protonmail.com>
-
waffl3x authored
This implements support for xobj lambdas. There are extensive tests included, but not exhaustive. Dependent lambdas should work and have been tested lightly, but we need more exhaustive tests for them. PR c++/102609 gcc/cp/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - xobj lambdas. * lambda.cc (build_capture_proxy): Don't fold direct object types. * parser.cc (cp_parser_lambda_declarator_opt): Handle xobj lambdas, diagnostics. Comments also updated. * pt.cc (tsubst_function_decl): Handle xobj lambdas. Check object type of xobj lambda call operator, diagnose incorrect types. (tsubst_lambda_expr): Update comment. * semantics.cc (finish_decltype_type): Also consider by-value object parameter qualifications. gcc/testsuite/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - xobj lambdas. * g++.dg/cpp23/explicit-obj-diagnostics8.C: New test. * g++.dg/cpp23/explicit-obj-lambda1.C: New test. * g++.dg/cpp23/explicit-obj-lambda10.C: New test. * g++.dg/cpp23/explicit-obj-lambda11.C: New test. * g++.dg/cpp23/explicit-obj-lambda12.C: New test. * g++.dg/cpp23/explicit-obj-lambda13.C: New test. * g++.dg/cpp23/explicit-obj-lambda2.C: New test. * g++.dg/cpp23/explicit-obj-lambda3.C: New test. * g++.dg/cpp23/explicit-obj-lambda4.C: New test. * g++.dg/cpp23/explicit-obj-lambda5.C: New test. * g++.dg/cpp23/explicit-obj-lambda6.C: New test. * g++.dg/cpp23/explicit-obj-lambda7.C: New test. * g++.dg/cpp23/explicit-obj-lambda8.C: New test. * g++.dg/cpp23/explicit-obj-lambda9.C: New test. Signed-off-by:
Waffl3x <waffl3x@protonmail.com>
-
waffl3x authored
Diagnostics for xobj member functions. Also includes some diagnostics for xobj lambdas which are not implemented here. CWG2554 is also implemented here, we explicitly error when an xobj member function overrides a virtual function. PR c++/102609 gcc/c-family/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - diagnostics. * c-cppbuiltin.cc (c_cpp_builtins): Define __cpp_explicit_this_parameter=202110L feature test macro. gcc/cp/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - diagnostics. * class.cc (resolve_address_of_overloaded_function): Diagnostics. * cp-tree.h (TFF_XOBJ_FUNC): Define. * decl.cc (grokfndecl): Diagnostics. (grokdeclarator): Diagnostics. * error.cc (dump_aggr_type): Pass TFF_XOBJ_FUNC. (dump_lambda_function): Formatting for xobj lambda. (dump_function_decl): Pass TFF_XOBJ_FUNC. (dump_parameters): Formatting for xobj member functions. (function_category): Formatting for xobj member functions. * parser.cc (cp_parser_decl_specifier_seq): Diagnostics. (cp_parser_parameter_declaration): Diagnostics. * search.cc (look_for_overrides_here): Make xobj member functions override. (look_for_overrides_r): Reject an overriding xobj member function and diagnose it. * semantics.cc (finish_this_expr): Diagnostics. * typeck.cc (cp_build_addr_expr_1): Diagnostics. gcc/testsuite/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - diagnostics. * g++.dg/cpp23/feat-cxx2b.C: Test existance and value of __cpp_explicit_this_parameter feature test macro. * g++.dg/cpp26/feat-cxx26.C: Likewise. * g++.dg/cpp23/explicit-obj-cxx-dialect-A.C: New test. * g++.dg/cpp23/explicit-obj-cxx-dialect-B.C: New test. * g++.dg/cpp23/explicit-obj-cxx-dialect-C.C: New test. * g++.dg/cpp23/explicit-obj-cxx-dialect-D.C: New test. * g++.dg/cpp23/explicit-obj-cxx-dialect-E.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics1.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics2.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics3.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics4.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics5.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics6.C: New test. * g++.dg/cpp23/explicit-obj-diagnostics7.C: New test. Signed-off-by:
Waffl3x <waffl3x@protonmail.com>
-
waffl3x authored
This implements the initial functionality for P0847R7. CWG2789 is implemented, but instead of "same type" for the object parameters we take correspondence into account instead. Without this alteration, the behavior here would be slightly different than the behavior with constrained member function templates, which I believe would be undesirable. There are a few outstanding issues related to xobj member functions overloading iobj member functions that are introduced by using declarations. Unfortunately, fixing this will be a little more involved and will have to be pushed back until later. Most diagnostics have been split out into another patch to improve its clarity and allow all the strictly functional changes to be more distinct. Explicit object lambdas and CWG2586 are addressed in a follow up patch. PR c++/102609 gcc/cp/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - initial functionality. * class.cc (xobj_iobj_parameters_correspond): New function, checks for corresponding object parameters between xobj and iobj member functions. (add_method): Handle object parameters of xobj member functions, use xobj_iobj_parameters_correspond. * call.cc (build_over_call): Refactor, handle xobj member functions. (cand_parms_match): Handle object parameters of xobj and iobj member functions, use xobj_iobj_parameters_correspond. * cp-tree.h (enum cp_decl_spec): Add ds_this, add comments. * decl.cc (grokfndecl): Add xobj_func_p parameter. For xobj member functions, Set xobj_flag, don't set static_function flag. (grokdeclarator): Handle xobj member functions, tell grokfndecl. (grok_op_properties): Don't error for xobj operators. * parser.cc (cp_parser_decl_specifier_seq): Handle this specifier. (cp_parser_parameter_declaration): Set default argument to "this_identifier" for xobj parameters. (set_and_check_decl_spec_loc): Add "this", add comments. * tree.cc (build_min_non_dep_op_overload): Handle xobj operators. * typeck.cc (cp_build_addr_expr_1): Handle address-of xobj member functions. gcc/testsuite/ChangeLog: PR c++/102609 C++23 P0847R7 (deducing this) - initial functionality. * g++.dg/cpp23/explicit-obj-basic1.C: New test. * g++.dg/cpp23/explicit-obj-basic2.C: New test. * g++.dg/cpp23/explicit-obj-basic3.C: New test. * g++.dg/cpp23/explicit-obj-basic4.C: New test. * g++.dg/cpp23/explicit-obj-basic5.C: New test. * g++.dg/cpp23/explicit-obj-by-value1.C: New test. * g++.dg/cpp23/explicit-obj-by-value2.C: New test. * g++.dg/cpp23/explicit-obj-by-value3.C: New test. * g++.dg/cpp23/explicit-obj-by-value4.C: New test. * g++.dg/cpp23/explicit-obj-constraints.C: New test. * g++.dg/cpp23/explicit-obj-constraints2.C: New test. * g++.dg/cpp23/explicit-obj-ops-mem-arrow.C: New test. * g++.dg/cpp23/explicit-obj-ops-mem-assignment.C: New test. * g++.dg/cpp23/explicit-obj-ops-mem-call.C: New test. * g++.dg/cpp23/explicit-obj-ops-mem-subscript.C: New test. * g++.dg/cpp23/explicit-obj-ops-non-mem-dep.C: New test. * g++.dg/cpp23/explicit-obj-ops-non-mem-non-dep.C: New test. * g++.dg/cpp23/explicit-obj-ops-non-mem.h: New test. * g++.dg/cpp23/explicit-obj-ops-requires-mem.C: New test. * g++.dg/cpp23/explicit-obj-ops-requires-non-mem.C: New test. * g++.dg/cpp23/explicit-obj-redecl.C: New test. * g++.dg/cpp23/explicit-obj-redecl2.C: New test. * g++.dg/cpp23/explicit-obj-redecl3.C: New test. * g++.dg/cpp23/explicit-obj-redecl4.C: New test. Signed-off-by:
Waffl3x <waffl3x@protonmail.com>
-
waffl3x authored
Adds the xobj_flag member to lang_decl_fn and a corresponding member access macro and predicate to support the addition of explicit object member functions. Additionally, since explicit object member functions are also non-static member functions, we need to change uses of DECL_NONSTATIC_MEMBER_FUNCTION_P to clarify whether they intend to include or exclude them. PR c++/102609 gcc/cp/ChangeLog: * cp-tree.h (struct lang_decl_fn): New data member. (DECL_NONSTATIC_MEMBER_FUNCTION_P): Poison. (DECL_IOBJ_MEMBER_FUNCTION_P): Define. (DECL_FUNCTION_XOBJ_FLAG): Define. (DECL_XOBJ_MEMBER_FUNCTION_P): Define. (DECL_OBJECT_MEMBER_FUNCTION_P): Define. (DECL_FUNCTION_MEMBER_P): Don't use DECL_NONSTATIC_MEMBER_FUNCTION_P. (DECL_CONST_MEMFUNC_P): Likewise. (DECL_VOLATILE_MEMFUNC_P): Likewise. (DECL_NONSTATIC_MEMBER_P): Likewise. * module.cc (trees_out::lang_decl_bools): Handle xobj_flag. (trees_in::lang_decl_bools): Handle xobj_flag. * call.cc (build_this_conversion) (add_function_candidate) (add_template_candidate_real) (add_candidates) (maybe_warn_class_memaccess) (cand_parms_match) (joust) (do_warn_dangling_reference) * class.cc (finalize_literal_type_property) (finish_struct) (resolve_address_of_overloaded_function) * constexpr.cc (is_valid_constexpr_fn) (cxx_bind_parameters_in_call) * contracts.cc (build_contract_condition_function) * cp-objcp-common.cc (cp_decl_dwarf_attribute) * cxx-pretty-print.cc (cxx_pretty_printer::postfix_expression) (cxx_pretty_printer::declaration_specifiers) (cxx_pretty_printer::direct_declarator) * decl.cc (cp_finish_decl) (grok_special_member_properties) (start_preparsed_function) (record_key_method_defined) * decl2.cc (cp_handle_deprecated_or_unavailable) * init.cc (find_uninit_fields_r) (build_offset_ref) * lambda.cc (lambda_expr_this_capture) (maybe_generic_this_capture) (nonlambda_method_basetype) * mangle.cc (write_nested_name) * method.cc (early_check_defaulted_comparison) (skip_artificial_parms_for) (num_artificial_parms_for) * pt.cc (is_specialization_of_friend) (determine_specialization) (copy_default_args_to_explicit_spec) (check_explicit_specialization) (tsubst_contract_attribute) (check_non_deducible_conversions) (more_specialized_fn) (maybe_instantiate_noexcept) (register_parameter_specializations) (value_dependent_expression_p) * search.cc (shared_member_p) (lookup_member) (field_access_p) * semantics.cc (finish_omp_declare_simd_methods) * tree.cc (lvalue_kind) * typeck.cc (invalid_nonstatic_memfn_p): Don't use DECL_NONSTATIC_MEMBER_FUNCTION_P. libcc1/ChangeLog: * libcp1plugin.cc (plugin_pragma_push_user_expression): Don't use DECL_NONSTATIC_MEMBER_FUNCTION_P. Signed-off-by:
Waffl3x <waffl3x@protonmail.com> Co-authored-by:
Jason Merrill <jason@redhat.com>
-