Skip to content
Snippets Groups Projects
  1. Aug 20, 2024
    • Pan Li's avatar
      RISC-V: Fix one typo in .SAT_TRUNC test func name [NFC] · 1b72e076
      Pan Li authored
      
      Fix one typo `sat_truc` to `sat_trunc`, as well as `SAT_TRUC` to `SAT_TRUNC`.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/sat_arith.h: Fix SAT_TRUNC typo.
      	* gcc.target/riscv/sat_u_trunc-1.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-13.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-14.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-15.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-2.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-3.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-4.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-5.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-6.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-7.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-8.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-9.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-1.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-13.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-14.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-15.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-2.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-3.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-4.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-5.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-6.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-7.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-8.c: Ditto.
      	* gcc.target/riscv/sat_u_trunc-run-9.c: Ditto.
      
      Signed-off-by: default avatarPan Li <pan2.li@intel.com>
      1b72e076
    • Nathaniel Shead's avatar
      c++/modules: Remove unnecessary errors when not writing compiled module · e668771f
      Nathaniel Shead authored
      
      It was pointed out to me that the current error referencing an internal
      linkage entity reads almost like an ICE message, with the message
      finishing with the unhelpful:
      
      m.cpp:1:8: error: failed to write compiled module: Bad file data
          1 | export module M;
            |        ^~~~~~
      
      Similarly, whenever we decide not to emit a module CMI due to other
      errors we currently emit the following message:
      
      m.cpp:1:8: warning: not writing module ‘M’ due to errors
          1 | export module M;
            |        ^~~~~~
      
      Neither of these messages really add anything useful; users already
      understand that when an error is reported then the normal outputs will
      not be created, so these messages are just noise.
      
      There is one case we still need this latter message, however; when an
      error in a template has been silenced with '-Wno-template-body' we still
      don't want to write a module CMI, so emit an error now instead.
      
      This patch also removes a number of dg-prune-output directives in the
      testsuite that are no longer needed with this change.
      
      gcc/cp/ChangeLog:
      
      	* module.cc (module_state::write_begin): Return a boolean to
      	indicate errors rather than just doing set_error().
      	(finish_module_processing): Prevent emission of unnecessary
      	errors; only indicate module writing occurred if write_begin
      	succeeds.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/export-1.C: Remove message.
      	* g++.dg/modules/internal-1.C: Remove message.
      	* g++.dg/modules/ambig-2_b.C: Remove unnecessary pruning.
      	* g++.dg/modules/atom-decl-2.C: Likewise.
      	* g++.dg/modules/atom-pragma-3.C: Likewise.
      	* g++.dg/modules/atom-preamble-2_f.C: Likewise.
      	* g++.dg/modules/block-decl-2.C: Likewise.
      	* g++.dg/modules/dir-only-4.C: Likewise.
      	* g++.dg/modules/enum-12.C: Likewise.
      	* g++.dg/modules/exp-xlate-1_b.C: Likewise.
      	* g++.dg/modules/export-3.C: Likewise.
      	* g++.dg/modules/friend-3.C: Likewise.
      	* g++.dg/modules/friend-5_b.C: Likewise.
      	* g++.dg/modules/inc-xlate-1_e.C: Likewise.
      	* g++.dg/modules/linkage-2.C: Likewise.
      	* g++.dg/modules/local-extern-1.C: Likewise.
      	* g++.dg/modules/main-1.C: Likewise.
      	* g++.dg/modules/map-2.C: Likewise.
      	* g++.dg/modules/mod-decl-1.C: Likewise.
      	* g++.dg/modules/mod-decl-3.C: Likewise.
      	* g++.dg/modules/pr99174.H: Likewise.
      	* g++.dg/modules/pr99468.H: Likewise.
      	* g++.dg/modules/token-1.C: Likewise.
      	* g++.dg/modules/token-3.C: Likewise.
      	* g++.dg/modules/token-4.C: Likewise.
      	* g++.dg/modules/token-5.C: Likewise.
      	* g++.dg/modules/using-10.C: Likewise.
      	* g++.dg/modules/using-12.C: Likewise.
      	* g++.dg/modules/using-3.C: Likewise.
      	* g++.dg/modules/using-9.C: Likewise.
      	* g++.dg/modules/using-enum-2.C: Likewise.
      	* g++.dg/modules/permissive-error-1.C: New test.
      	* g++.dg/modules/permissive-error-2.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      e668771f
    • Andrew Pinski's avatar
      match: Reject non-ssa name/min invariants in gimple_extract [PR116412] · c7b76a07
      Andrew Pinski authored
      
      After the conversion for phiopt's conditional operand
      to use maybe_push_res_to_seq, it was found that gimple_extract
      will extract out from REALPART_EXPR/IMAGPART_EXPR/VCE and BIT_FIELD_REF,
      a memory load. But that extraction was not needed as memory loads are not
      simplified in match and simplify. So gimple_extract should return false
      in those cases.
      
      Changes since v1:
      * Move the rejection to gimple_extract from factor_out_conditional_operation.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      	PR tree-optimization/116412
      
      gcc/ChangeLog:
      
      	* gimple-match-exports.cc (gimple_extract): Return false if op0
      	was not a SSA name nor a min invariant for REALPART_EXPR/IMAGPART_EXPR/VCE
      	and BIT_FIELD_REF.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/torture/pr116412-1.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      c7b76a07
    • Jonathan Wakely's avatar
      libstdc++: Remove redundant reclaration of std::optional · 5d5193f0
      Jonathan Wakely authored
      We've already declared optional at the top of the header, so don't need
      to do it again.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/optional: Remove redundant redeclaration.
      5d5193f0
    • Jonathan Wakely's avatar
      libstdc++: Fix indentation of lines that follow a [[likely]] attribute · 91ae4685
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* include/std/text_encoding: Fix indentation.
      91ae4685
    • Jonathan Wakely's avatar
      libstdc++: Adjust testcase for constexpr placement new [PR115744] · 20c63093
      Jonathan Wakely authored
      This test now fails in C++26 mode because the declaration in <new> is
      constexpr and the one in the test isn't. Add constexpr to the test.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/115744
      	* testsuite/18_support/headers/new/synopsis.cc [C++26]: Add
      	constexpr to placement operator new and operator new[].
      20c63093
    • Jakub Jelinek's avatar
      libcpp: Adjust lang_defaults · 447c32c5
      Jakub Jelinek authored
      The table over the years turned to be very wide, 147 columns
      and any addition would add a couple of new ones.
      We need a 28x23 bit matrix right now.
      
      This patch changes the formatting, so that we need just 2 columns
      per new feature and so we have some room for expansion.
      In addition, the patch changes it to bitfields, which reduces
      .rodata by 532 bytes (so 5.75x reduction of the variable) and
      on x86_64-linux grows the cpp_set_lang function by 26 bytes (8.4%
      growth).
      
      2024-08-20  Jakub Jelinek  <jakub@redhat.com>
      
      	* init.cc (struct lang_flags): Change all members from char
      	typed fields to unsigned bit-fields.
      	(lang_defaults): Change formatting of the initializer so that it
      	fits to 68 columns rather than 147.
      447c32c5
    • Andrew Pinski's avatar
      phi-opt: Fix for failing maybe_push_res_to_seq in factor_out_conditional_operation [PR 116409] · 404d947d
      Andrew Pinski authored
      
      The code was assuming that maybe_push_res_to_seq would not fail if the gimple_extract_op returned true.
      But for some cases when the function is pure rather than const, then it can fail.
      This change moves around the code to check the result of maybe_push_res_to_seq instead of assuming it will
      always work.
      
      Changes since v1:
      * v2: Instead of directly testing non-pure builtin functions change to test if maybe_push_res_to_seq fails.
      
      Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      	PR tree-optimization/116409
      
      gcc/ChangeLog:
      
      	* tree-ssa-phiopt.cc (factor_out_conditional_operation): Move
      	maybe_push_res_to_seq before creating the phi node and the debug dump.
      	Return false if maybe_push_res_to_seq fails.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/torture/pr116409-1.c: New test.
      	* gcc.dg/torture/pr116409-2.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      404d947d
    • Jakub Jelinek's avatar
      c++: Appertain standard attributes after array closing square bracket to array... · d0594955
      Jakub Jelinek authored
      c++: Appertain standard attributes after array closing square bracket to array type rather than declarator [PR110345]
      
      For C++ 26 P2552R3 I went through all the spots (except modules) where
      attribute-specifier-seq appears in the grammar and tried to construct
      a testcase in all those spots, for now for [[deprecated]] attribute.
      
      This is the second issue I found.  The comment already correctly says that
      attributes after closing ] appertain to the array type, but we were
      appending them to returned_attrs, so effectively applying them to the
      declarator (as if they appeared right after declarator-id).
      
      2024-08-20  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/110345
      	* decl.cc (grokdeclarator): Apply declarator->std_attributes
      	for cdk_array to type, rather than chaining it to returned_attrs.
      
      	* g++.dg/cpp0x/gen-attrs-82.C: New test.
      	* g++.dg/gomp/attrs-3.C (foo): Expect different diagnostics for
      	omp::directive attribute after closing square bracket of an automatic
      	declaration and add a test with the attribute after array's
      	declarator-id.
      d0594955
    • Jakub Jelinek's avatar
      c++: Parse and ignore attributes on base specifiers [PR110345] · 1db5ca04
      Jakub Jelinek authored
      For C++ 26 P2552R3 I went through all the spots (except modules) where
      attribute-specifier-seq appears in the grammar and tried to construct
      a testcase in all those spots, for now for [[deprecated]] attribute.
      
      This is the third issue I found.
      
      https://eel.is/c++draft/class.derived#general-1 has attribute-specifier-seq
      at the start of base-specifier.  The following patch parses it there and
      warns about those.
      
      2024-08-20  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/110345
      	* parser.cc (cp_parser_base_specifier): Parse standard attributes
      	at the start and emit a warning if there are any non-ignored ones.
      
      	* g++.dg/cpp0x/gen-attrs-83.C: New test.
      1db5ca04
    • Edwin Lu's avatar
      RISC-V: Remove testcase XFAIL · 3676816c
      Edwin Lu authored
      
      The testcase has been modified to include the -fwrapv flag which now
      causes the test to pass. Remove the xfail exception
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.dg/signbit-5.c: Remove riscv xfail exception
      
      Signed-off-by: default avatarEdwin Lu <ewlu@rivosinc.com>
      3676816c
    • Franciszek Witt's avatar
      c++: Improve errors parsing a braced list [PR101232] · 64028d62
      Franciszek Witt authored
      
      	PR c++/101232
      
      gcc/cp/ChangeLog:
      
      	* parser.cc (cp_parser_postfix_expression): Commit to the
      	parse in case we know its either a cast or invalid syntax.
      	(cp_parser_braced_list): Add a heuristic to inform about
      	missing comma or operator.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp0x/initlist-err1.C: New test.
      	* g++.dg/cpp0x/initlist-err2.C: New test.
      	* g++.dg/cpp0x/initlist-err3.C: New test.
      
      Signed-off-by: default avatarFranciszek Witt <franek.witt@gmail.com>
      64028d62
    • Gerald Pfeifer's avatar
      doc: Normalize reference to binutils version for C6X · 81bf84cf
      Gerald Pfeifer authored
      We generally do not use a hyphen between project name and version.
      
      gcc:
      	* doc/install.texi (Specific) <c6x-*-*>: Normalize reference to
      	binutils.
      81bf84cf
    • Andrew Pinski's avatar
      Match: Add pattern for `(a ? b : 0) | (a ? 0 : c)` into `a ? b : c` [PR103660] · eface71c
      Andrew Pinski authored
      
      This adds a pattern to convert `(a ? b : 0) | (a ? 0 : c)` into `a ? b : c`
      which is simplier. It adds both for cond and vec_cond; even though vec_cond is
      handled via a different pattern currently but requires extra steps for matching
      so this should be slightly faster.
      
      Also handle it for xor and plus too since those can be handled the same way.
      
      Bootstrapped and tested on x86_64-linux-gnu with no regressions.
      
      	PR tree-optimization/103660
      
      gcc/ChangeLog:
      
      	* match.pd (`(a ? b : 0) | (a ? 0 : c)`): New pattern.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/tree-ssa/pr103660-4.C: New test.
      	* gcc.dg/tree-ssa/pr103660-4.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      eface71c
    • Andrew Pinski's avatar
      match: extend the `((a CMP b) ? c : 0) | ((a CMP' b) ? d : 0)` patterns to... · b7337352
      Andrew Pinski authored
      match: extend the `((a CMP b) ? c : 0) | ((a CMP' b) ? d : 0)` patterns to support ^ and + [PR103660]
      
      r13-4620-g4d9db4bdd458 Added a few patterns and some of them can be extended to support XOR and PLUS.
      This extends the patterns to support XOR and PLUS instead of just IOR.
      
      Bootstrapped and tested on x86_64-linux-gnu.
      
      	PR tree-optimization/103660
      
      gcc/ChangeLog:
      
      	* match.pd (`((a CMP b) ? c : 0) | ((a CMP' b) ? d : 0)`): Extend to support
      	XOR and PLUS.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/tree-ssa/pr103660-2.C: New test.
      	* g++.dg/tree-ssa/pr103660-3.C: New test.
      	* gcc.dg/tree-ssa/pr103660-2.c: New test.
      	* gcc.dg/tree-ssa/pr103660-3.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      b7337352
    • Andrew Pinski's avatar
      testsuite: Add testcases for part of PR 103660 · 82a2f138
      Andrew Pinski authored
      
      IOR part of the bug report was fixed by r13-4620-g4d9db4bdd458 but
      that added only aarch64 specific testcases. This adds 4
      generic testcases for this to check to make sure they are optimized.
      The C++ testcases are the vector type versions.
      
      	PR tree-optimization/103660
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/tree-ssa/pr103660-0.C: New test.
      	* g++.dg/tree-ssa/pr103660-1.C: New test.
      	* gcc.dg/tree-ssa/pr103660-0.c: New test.
      	* gcc.dg/tree-ssa/pr103660-1.c: New test.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      82a2f138
    • Patrick Palka's avatar
      c++: default targ eligibility refinement [PR101463] · 5348e3cb
      Patrick Palka authored
      On Tue, 9 Jan 2024, Jason Merrill wrote:
      > On 1/5/24 15:01, Patrick Palka wrote[1]:
      > > Here during default template argument substitution we wrongly consider
      > > the (substituted) default arguments v and vt<int> as value-dependent[1]
      > > which ultimately leads to deduction failure for the calls.
      > >
      > > The bogus value_dependent_expression_p result aside, I noticed
      > > type_unification_real during default targ substitution keeps track of
      > > whether all previous targs are known and non-dependent, as is the case
      > > for these calls.  And in such cases it should be safe to avoid checking
      > > dependence of the substituted default targ and just assume it's not.
      > > This patch implements this optimization, which lets us accept both
      > > testcases by sidestepping the value_dependent_expression_p issue
      > > altogether.
      >
      > Hmm, maybe instead of substituting and asking if it's dependent, we should
      > specifically look for undeduced parameters.
      
      This patch implements this refinement, which incidentally fixes PR101463
      just as well.
      
      [1]: https://gcc.gnu.org/pipermail/gcc-patches/2024-January/641957.html
      
      
      
      	PR c++/101463
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (type_unification_real): Directly look for undeduced
      	parameters in the default argument instead of doing a trial
      	substitution.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1z/nontype6.C: New test.
      	* g++.dg/cpp1z/nontype6a.C: New test.
      
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      5348e3cb
    • Alexander Monakov's avatar
      libcpp: replace SSE4.2 helper with an SSSE3 one · 20a5b482
      Alexander Monakov authored
      Since the characters we are searching for (CR, LF, '\', '?') all have
      distinct ASCII codes mod 16, PSHUFB can help match them all at once.
      
      Directly use the new helper if __SSSE3__ is defined. It makes the other
      helpers unused, so mark them inline to prevent warnings.
      
      Rewrite and simplify init_vectorized_lexer.
      
      libcpp/ChangeLog:
      
      	* config.in: Regenerate.
      	* configure: Regenerate.
      	* configure.ac: Check for SSSE3 instead of SSE4.2.
      	* files.cc (read_file_guts): Bump padding to 64 if HAVE_SSSE3.
      	* lex.cc (search_line_acc_char): Mark inline, not "unused".
      	(search_line_sse2): Mark inline.
      	(search_line_sse42): Replace with...
      	(search_line_ssse3): ... this new function.  Adjust the use...
      	(init_vectorized_lexer): ... here.  Simplify.
      20a5b482
    • Richard Biener's avatar
      tree-optimization/116274 - overzealous SLP vectorization · b8ea13eb
      Richard Biener authored
      The following tries to address that the vectorizer fails to have
      precise knowledge of argument and return calling conventions and
      views some accesses as loads and stores that are not.
      This is mainly important when doing basic-block vectorization as
      otherwise loop indexing would force such arguments to memory.
      
      On x86 the reduction in the number of apparent loads and stores
      often dominates cost analysis so the following tries to mitigate
      this aggressively by adjusting only the scalar load and store
      cost, reducing them to the cost of a simple scalar statement,
      but not touching the vector access cost which would be much
      harder to estimate.  Thereby we error on the side of not performing
      basic-block vectorization.
      
      	PR tree-optimization/116274
      	* tree-vect-slp.cc (vect_bb_slp_scalar_cost): Cost scalar loads
      	and stores as simple scalar stmts when they access a non-global,
      	not address-taken variable that doesn't have BLKmode assigned.
      
      	* gcc.target/i386/pr116274-2.c: New testcase.
      b8ea13eb
    • Andre Vehreschild's avatar
      Fortran: Fix [Coarray] ICE in conv_caf_send, at fortran/trans-intrinsic.c:1950 [PR84246] · 35f56012
      Andre Vehreschild authored
      Fix ICE caused by converted expression already being pointer by checking
      for its type.  Lift rewrite to caf_send completely into resolve and
      prevent more temporary arrays.
      
      	PR fortran/84246
      
      gcc/fortran/ChangeLog:
      
      	* resolve.cc (caf_possible_reallocate): Detect arrays that may
      	be reallocated by caf_send.
      	(resolve_ordinary_assign): More reliably detect assignments
      	where a rewrite to caf_send is needed.
      	* trans-expr.cc (gfc_trans_assignment_1): Remove rewrite to
      	caf_send, because this is done by resolve now.
      	* trans-intrinsic.cc (conv_caf_send): Prevent unneeded temporary
      	arrays.
      
      libgfortran/ChangeLog:
      
      	* caf/single.c (send_by_ref): Created array's lbound is now 1
      	and the offset set correctly.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/coarray_allocate_7.f08: Adapt to array being
      	allocate by caf_send.
      35f56012
    • Prathamesh Kulkarni's avatar
      [optc-save-gen.awk] Fix streaming of command line options for offloading. · db2e9a2a
      Prathamesh Kulkarni authored
      
      The patch modifies optc-save-gen.awk to generate if (!lto_stream_offload_p)
      check before streaming out target-specific opt in cl_optimization_stream_out,
      when offloading is enabled.
      
      Also, it modifies cl_optimization_stream_in to issue an error during build time
      if accelerator backend defines a target-specific Optimization option. This
      restriction currently is in place to maintain consistency for streaming of
      Optimization options between host and accelerator. A proper fix would be
      to merge target-specific Optimization options for host and accelerators
      enabled for offloading.
      
      gcc/ChangeLog:
      	* optc-save-gen.awk: New array var_target_opt. Use it to generate
      	if (!lto_stream_offload_p) check in cl_optimization_stream_out,
      	and generate a diagnostic with #error if accelerator backend uses
      	Optimization for target-specifc options in cl_optimization_stream_in.
      
      Signed-off-by: default avatarPrathamesh Kulkarni <prathameshk@nvidia.com>
      db2e9a2a
    • Nathaniel Shead's avatar
      c++/modules: Disable streaming definitions of non-vague-linkage GMF decls [PR115020] · c1a53d9d
      Nathaniel Shead authored
      
      The error in the linked PR is caused because 'DECL_THIS_STATIC' is true
      for the static member function, causing the streaming code to assume
      that this is an internal linkage GM entity that needs to be explicitly
      streamed, which then on read-in gets marked as a vague linkage function
      (despite being non-inline) causing import_export_decl to complain.
      
      However, I don't see any reason why we should care about this:
      definitions in the GMF should just be emitted as per usual regardless of
      whether they're internal-linkage or not.  Actually the only thing we
      care about here are header modules, since they have no TU to write
      definitions into.  As such this patch removes these conditions from
      'has_definition' and updates some comments to clarify.
      
      	PR c++/115020
      
      gcc/cp/ChangeLog:
      
      	* module.cc (has_definition): Only force writing definitions for
      	header_module_p.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/pr115020_a.C: New test.
      	* g++.dg/modules/pr115020_b.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      c1a53d9d
    • Nathaniel Shead's avatar
      c++/modules: Handle transitive reachability for deduction guides [PR116403] · 6f115a8e
      Nathaniel Shead authored
      
      Currently we implement [temp.deduct.guide] p1 by forcing all deduction
      guides to be considered as exported.  However this is not sufficient:
      for transitive non-exported imports we will still hide the deduction
      guide from name lookup, causing errors.
      
      This patch instead adjusts name lookup to have a new ANY_REACHABLE flag
      to allow for this case.  Currently this is only used by deduction guides
      but there are some other circumstances where this may be useful in the
      future (e.g. finding existing temploid friends).
      
      	PR c++/116403
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (deduction_guides_for): Use ANY_REACHABLE for lookup of
      	deduction guides.
      	* module.cc (depset::hash::add_deduction_guides): Likewise.
      	(module_state::write_cluster): No longer override deduction
      	guides as exported.
      	* name-lookup.cc (name_lookup::search_namespace_only): Ignore
      	visibility when LOOK_want::ANY_REACHABLE is specified.
      	(check_module_override): Ignore visibility when checking for
      	ambiguating deduction guides.
      	* name-lookup.h (LOOK_want): New flag 'ANY_REACHABLE'.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/dguide-4_a.C: New test.
      	* g++.dg/modules/dguide-4_b.C: New test.
      	* g++.dg/modules/dguide-4_c.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      6f115a8e
    • Nathaniel Shead's avatar
      c++/modules: Avoid rechecking initializers when streaming NTTPs [PR116382] · 0b7904e2
      Nathaniel Shead authored
      
      When reading an NTTP we call get_template_parm_object which delegates
      setting of DECL_INITIAL to the general cp_finish_decl procedure, which
      calls check_initializer to validate and record it.
      
      Apart from being unnecessary (it must have already been validated by the
      writing module), this also causes errors in cases like the linked PR, as
      validating may end up needing to call lazy_load_pendings to determine
      any specialisations that may exist which violates assumptions of the
      modules streaming code.
      
      This patch works around the issue by adding a flag to
      get_template_parm_object to disable these checks when not needed.
      
      	PR c++/116382
      
      gcc/cp/ChangeLog:
      
      	* cp-tree.h (get_template_parm_object): Add check_init param.
      	* module.cc (trees_in::tree_node): Pass check_init=false when
      	building NTTPs.
      	* pt.cc (get_template_parm_object): Prevent cp_finish_decl from
      	validating the initializer when check_init=false.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/tpl-nttp-1_a.C: New test.
      	* g++.dg/modules/tpl-nttp-1_b.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      0b7904e2
    • Nathaniel Shead's avatar
      c++/modules: Fix type lookup in DECL_TEMPLATE_INSTANTIATIONS [PR116364] · c310d29c
      Nathaniel Shead authored
      
      We need to use the DECL_TEMPLATE_INSTANTIATIONS property to find
      reachable specialisations from a template to ensure that any GM
      specialisations are properly marked as reachable.
      
      Currently the modules code uses the decl when rebuilding this property,
      but this is not always correct; it appears that for type specialisations
      we need to use the TREE_TYPE of the decl instead so that the
      specialisation is correctly found.  This patch makes the required
      adjustments.
      
      	PR c++/116364
      
      gcc/cp/ChangeLog:
      
      	* cp-tree.h (get_mergeable_specialization_flags): Adjust
      	signature.
      	* module.cc (trees_out::decl_value): Indicate whether this is a
      	type or decl specialisation.
      	* pt.cc (get_mergeable_specialization_flags): Match against the
      	type of a non-decl specialisation.
      	(add_mergeable_specialization): Use the already calculated spec
      	instead of always adding decl to DECL_TEMPLATE_INSTANTIATIONS.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/modules/tpl-spec-9_a.C: New test.
      	* g++.dg/modules/tpl-spec-9_b.C: New test.
      	* g++.dg/modules/tpl-spec-9_c.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      Reviewed-by: default avatarJason Merrill <jason@redhat.com>
      c310d29c
    • GCC Administrator's avatar
      Daily bump. · 80fda0ad
      GCC Administrator authored
      80fda0ad
  2. Aug 19, 2024
    • Andreas Schwab's avatar
      m68k: Add -mlra · c4971bae
      Andreas Schwab authored
      	PR target/113939
      	* config/m68k/m68k.opt (mlra): New target option.
      	* config/m68k/m68k.cc (m68k_use_lra_p): New function.
      	(TARGET_LRA_P): Use it.
      	* config/m68k/m68k.opt.urls: Regenerate.
      c4971bae
    • Marek Polacek's avatar
      c++: ICE with enum and conversion fn in template [PR115657] · 53283c32
      Marek Polacek authored
      Here we initialize an enumerator with a class prvalue with a conversion
      function.  When we fold it in build_enumerator, we create a TARGET_EXPR
      for the object, and subsequently crash in tsubst_expr, which should not
      see such a code.
      
      Normally, we fix similar problems by using an IMPLICIT_CONV_EXPR but here
      I may get away with not using the result of fold_non_dependent_expr unless
      the result is a constant.  A TARGET_EXPR is not constant.
      
      	PR c++/115657
      
      gcc/cp/ChangeLog:
      
      	* decl.cc (build_enumerator): Call maybe_fold_non_dependent_expr
      	instead of fold_non_dependent_expr.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1y/constexpr-recursion2.C: New test.
      	* g++.dg/template/conv21.C: New test.
      53283c32
    • Marek Polacek's avatar
      c++: fix ICE in convert_nontype_argument [PR116384] · 8191f150
      Marek Polacek authored
      Here we ICE since r14-8291 in C++11/C++14 modes.  Fortunately
      this is an easy one.
      
      The important bit of r14-8291 is this:
      
      @@ -20056,9 +20071,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
              RETURN (retval);
            }
          if (IMPLICIT_CONV_EXPR_NONTYPE_ARG (t))
      -     /* We'll pass this to convert_nontype_argument again, we don't need
      -        to actually perform any conversion here.  */
      -     RETURN (expr);
      +     {
      +       tree r = convert_nontype_argument (type, expr, complain);
      +       if (r == NULL_TREE)
      +         r = error_mark_node;
      +       RETURN (r);
      +     }
      
      which obviously means that instead of returning right away we go
      to convert_nontype_argument.  When type is error_mark_node and we're
      in C++17, in convert_nontype_argument we go down this path:
      
            else if (INTEGRAL_OR_ENUMERATION_TYPE_P (type)
                     || cxx_dialect >= cxx17)
              {
                expr = build_converted_constant_expr (type, expr, complain);
                if (expr == error_mark_node)
                  return (complain & tf_error) ? NULL_TREE : error_mark_node;
      	  // ...
      	}
      
      but pre-C++17, we take a different route and end up crashing on
      gcc_unreachable.
      
      It would of course also work to check for error_mark_node early in
      build_converted_constant_expr.
      
      	PR c++/116384
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (tsubst_expr) <case IMPLICIT_CONV_EXPR>: Bail if tsubst
      	returns error_mark_node.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp0x/vt-116384.C: New test.
      8191f150
    • Andrew Carlotti's avatar
      aarch64: Fix ls64 intrinsic availability · fceecc51
      Andrew Carlotti authored
      The availability of ls64 intrinsics and data types were determined
      solely by the globally specified architecture features, which did not
      reflect any changes specified in target pragmas or attributes.
      
      This patch removes the initialisation-time guards for the intrinsics,
      and replaces them with checks at use time. We also get better error
      messages when ls64 is not available (matching the existing error
      messages for SVE intrinsics).
      
      The data512_t type is made always available; this is consistent with the
      present behaviour for Neon fp16/bf16 types.
      
      gcc/ChangeLog:
      
      	PR target/112108
      	* config/aarch64/aarch64-builtins.cc (handle_arm_acle_h): Remove
      	feature check at initialisation.
      	(aarch64_general_check_builtin_call): Check ls64 intrinsics.
      	* config/aarch64/arm_acle.h: (data512_t) Make always available.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/112108
      	* gcc.target/aarch64/acle/ls64_guard-1.c: New test.
      	* gcc.target/aarch64/acle/ls64_guard-2.c: New test.
      	* gcc.target/aarch64/acle/ls64_guard-3.c: New test.
      	* gcc.target/aarch64/acle/ls64_guard-4.c: New test.
      fceecc51
    • Andrew Carlotti's avatar
      aarch64: Fix memtag intrinsic availability · 4e1b617b
      Andrew Carlotti authored
      The availability of memtag intrinsics and data types were determined
      solely by the globally specified architecture features, which did not
      reflect any changes specified in target pragmas or attributes.
      
      This patch removes the initialisation-time guards for the intrinsics,
      and replaces them with checks at use time. It also removes the macro
      indirection from the header file - this simplifies the header, and
      allows the missing extension error reporting to find the user-facing
      intrinsic names.
      
      gcc/ChangeLog:
      
      	PR target/112108
      	* config/aarch64/aarch64-builtins.cc (aarch64_init_memtag_builtins):
      	Define intrinsic names directly.
      	(aarch64_general_init_builtins): Move memtag intialisation...
      	(handle_arm_acle_h): ...to here, and remove feature check.
      	(aarch64_general_check_builtin_call): Check memtag intrinsics.
      	* config/aarch64/arm_acle.h (__arm_mte_create_random_tag)
      	(__arm_mte_exclude_tag, __arm_mte_ptrdiff)
      	(__arm_mte_increment_tag, __arm_mte_set_tag, __arm_mte_get_tag):
      	Remove.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/112108
      	* gcc.target/aarch64/acle/memtag_guard-1.c: New test.
      	* gcc.target/aarch64/acle/memtag_guard-2.c: New test.
      	* gcc.target/aarch64/acle/memtag_guard-3.c: New test.
      	* gcc.target/aarch64/acle/memtag_guard-4.c: New test.
      4e1b617b
    • Andrew Carlotti's avatar
      aarch64: Fix tme intrinsic availability · 32afbb60
      Andrew Carlotti authored
      The availability of tme intrinsics was previously gated at both
      initialisation time (using global target options) and usage time
      (accounting for function-specific target options).  This patch removes
      the check at initialisation time, and also moves the intrinsics out of
      the header file to allow for better error messages (matching the
      existing error messages for SVE intrinsics).
      
      gcc/ChangeLog:
      
      	PR target/112108
      	* config/aarch64/aarch64-builtins.cc (aarch64_init_tme_builtins):
      	Define intrinsic names directly.
      	(aarch64_general_init_builtins): Move tme initialisation...
      	(handle_arm_acle_h): ...to here, and remove feature check.
      	(aarch64_general_check_builtin_call): Check tme intrinsics.
      	* config/aarch64/arm_acle.h (__tstart, __tcommit, __tcancel)
      	(__ttest): Remove.
      	(_TMFAILURE_*): Define unconditionally.
      
      gcc/testsuite/ChangeLog:
      
      	PR target/112108
      	* gcc.target/aarch64/acle/tme_guard-1.c: New test.
      	* gcc.target/aarch64/acle/tme_guard-2.c: New test.
      	* gcc.target/aarch64/acle/tme_guard-3.c: New test.
      	* gcc.target/aarch64/acle/tme_guard-4.c: New test.
      32afbb60
    • Andrew Carlotti's avatar
      aarch64: Move check_required_extensions · baf71ec5
      Andrew Carlotti authored
      Move SVE extension checking functionality to aarch64-builtins.cc, so
      that it can be shared by non-SVE intrinsics.
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-sve-builtins.cc (check_builtin_call)
      	(expand_builtin): Update calls to the below.
      	(report_missing_extension, report_missing_registers)
      	(check_required_extensions): Move out of aarch64_sve namespace,
      	rename, and move into...
      	* config/aarch64/aarch64-builtins.cc (aarch64_report_missing_extension)
      	(aarch64_report_missing_registers)
      	(aarch64_check_required_extensions) ...here.
      	* config/aarch64/aarch64-protos.h (aarch64_check_required_extensions):
      	Add prototype.
      baf71ec5
    • Andrew Carlotti's avatar
      aarch64: Refactor check_required_extensions · a4b39dc4
      Andrew Carlotti authored
      Replace TARGET_GENERAL_REGS_ONLY check with an explicit check that
      aarch64_isa_flags enables all required extensions.  This will be more
      flexible when repurposing this function for non-SVE intrinsics.
      
      gcc/ChangeLog:
      
      	* config/aarch64/aarch64-sve-builtins.cc
      	(check_required_registers): Remove target check and rename to...
      	(report_missing_registers): ...this.
      	(check_required_extensions): Refactor.
      a4b39dc4
    • Andre Vehreschild's avatar
      Allow coarrays in select type. [PR46371, PR56496] · 8871489c
      Andre Vehreschild authored
      Fix ICE when scalar coarrays are used in a select type. Prevent
      coindexing in associate/select type/select rank selector expression.
      
      gcc/fortran/ChangeLog:
      
      	PR fortran/46371
      	PR fortran/56496
      
      	* expr.cc (gfc_is_coindexed): Detect is coindexed also when
      	rewritten to caf_get.
      	* trans-stmt.cc (trans_associate_var): Always accept a
      	descriptor for coarrays.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/coarray/select_type_1.f90: New test.
      	* gfortran.dg/coarray/select_type_2.f90: New test.
      	* gfortran.dg/coarray/select_type_3.f90: New test.
      8871489c
    • Arsen Arsenović's avatar
      gnat: fix lto-type-mismatch between C_Version_String and gnat_version_string [PR115917] · 9cbcf8d1
      Arsen Arsenović authored
      gcc/ada/ChangeLog:
      
      	PR ada/115917
      	* gnatvsn.ads: Add note about the duplication of this value in
      	version.c.
      	* version.c (VER_LEN_MAX): Define to the same value as
      	Gnatvsn.Ver_Len_Max.
      	(gnat_version_string): Use VER_LEN_MAX as bound.
      9cbcf8d1
    • Kyrylo Tkachov's avatar
      aarch64: Reduce FP reassociation width for Neoverse V2 and set... · cc572242
      Kyrylo Tkachov authored
      aarch64: Reduce FP reassociation width for Neoverse V2 and set AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA
      
      The fp reassociation width for Neoverse V2 was set to 6 since its
      introduction and I guess it was empirically tuned.  But since
      AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA was added the tree reassociation
      pass seems to be more deliberate in forming FMAs and when that flag is
      used it seems to more properly evaluate the FMA vs non-FMA reassociation
      widths.
      According to the Neoverse V2 SWOG the core has a throughput of 4 for
      most FP operations, so the value 6 is not accurate anyway.
      Also, the SWOG does state that FMADD operations are pipelined and the
      results can be forwarded from FP multiplies to the accumulation operands
      of FMADD instructions, which seems to be what
      AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA expresses.
      
      This patch sets the fp_reassoc_width field to 4 and enables
      AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA for -mcpu=neoverse-v2.
      
      On SPEC2017 fprate I see the following changes on a Grace system:
      503.bwaves_r	0.16%
      507.cactuBSSN_r	-0.32%
      508.namd_r	3.04%
      510.parest_r	0.00%
      511.povray_r	0.78%
      519.lbm_r 	0.35%
      521.wrf_r	0.69%
      526.blender_r	-0.53%
      527.cam4_r	0.84%
      538.imagick_r	0.00%
      544.nab_r	-0.97%
      549.fotonik3d_r	-0.45%
      554.roms_r	0.97%
      Geomean	        0.35%
      
      with -Ofast -mcpu=grace -flto.
      
      So slight overall improvement with a meaningful improvement in
      508.namd_r.
      
      I think other tunings in aarch64 should look into
      AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA as well, but I'll leave the
      benchmarking to someone else.
      
      Signed-off-by: default avatarKyrylo Tkachov <ktkachov@nvidia.com>
      
      gcc/ChangeLog:
      
      	* config/aarch64/tuning_models/neoversev2.h (fp_reassoc_width):
      	Set to 4.
      	(tune_flags): Add AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA.
      cc572242
    • Torbjörn SVENSSON's avatar
      testsuite: Prune warning about size of enums · 6d8b9b77
      Torbjörn SVENSSON authored
      This fixes reported regression at
      https://linaro.atlassian.net/browse/GNU-1315
      
      .
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/warn/pr33738-2.C: dg-prune arm linker messages about
      	size of enums.
      
      Signed-off-by: default avatarTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
      6d8b9b77
    • Andre Vieira's avatar
      rtl: Enable the use of rtx values with int and mode attributes · e57d3cce
      Andre Vieira authored
      The 'code' part of a 'define_code_attr' refers to the type of the key, in other
      words, it uses a code_iterator to pick the 'value' from their (key "value") pair
      list.
      
      However, rtx_alloc_for_name requires a code_attribute to be used when the
      'value' needs to be a type. In other words, no other type of attributes could be
      used, before this patch, to produce a rtx typed 'value'.
      
      This patch removes that restriction and allows the backend to use any kind of
      attribute as long as that attribute always produces a valid code typed 'value'.
      
      gcc/ChangeLog:
      
      	* read-rtl.cc (rtx_reader::rtx_alloc_for_name): Allow all attribute
      	types to produce code 'values'.
      	(check_code_attribute): Rename ...
      	(check_attribute_codes): ... to this.  And change comments to refer to
      	* doc/md.texi: Add paragraph to document that you can use int and mode
      	attributes to produce codes.
      e57d3cce
    • Richard Sandiford's avatar
      testsuite: Reduce cut-&-paste in scanltranstree.exp · 71059d26
      Richard Sandiford authored
      scanltranstree.exp defines some LTO wrappers around standard
      non-LTO scanners.  Four of them are cut-&-paste variants of
      one another, so this patch generates them from a single template.
      It also does the same for scan-ltrans-tree-dump-times, so that
      other *-times scanners can be added easily in future.
      
      The scanners seem to be lightly used.  gcc.dg/ipa/ipa-icf-38.c uses
      scan-ltrans-tree-dump{,-not} and libgomp.c/declare-variant-1.c
      uses scan-ltrans-tree-dump-{not,times}.  Nothing currently seems
      to use scan-ltrans-tree-dump-dem*.
      
      gcc/testsuite/
      	* lib/scanltranstree.exp: Redefine the routines using two
      	templates.
      71059d26
Loading