Skip to content
Snippets Groups Projects
  1. Aug 21, 2024
    • Richard Biener's avatar
      tree-optimization/116406 - ICE with int<->float punning prevention · 893cef36
      Richard Biener authored
      The following does away with the idea to use non-symmetrical
      testing of mode_can_transfer_bits in hash-table equality testing.
      It isn't feasible to always control query order to maintain
      consistency.
      
      	PR tree-optimization/116406
      	* tree-ssa-sccvn.cc (vn_reference_eq): Never equate
      	float and int when the float mode cannot transfer bits.
      	Do not try to anticipate which is the mode we actually load
      	from.
      
      	* gcc.dg/tree-ssa/pr116406.c: New testcase.
      	* gcc.dg/tree-ssa/ssa-pre-30.c: On x86 dd -msse -mfpmath=sse.
      893cef36
    • Martin Jambor's avatar
      sra: Avoid risking x87 magling binary representation of a replacement (PR 58416) · f577959f
      Martin Jambor authored
      PR 58416 shows that storing non-floating point data to floating point
      scalar registers can lead to miscompilations when the data is
      normalized or otherwise processed upon loading to a register.  To
      avoid that risk, this patch detects situations where we have multiple
      types and a we decide to represent the data in a type with a mode that
      is known to not be able to transfer actual bits reliably using the new
      TARGET_MODE_CAN_TRANSFER_BITS hook.
      
      gcc/ChangeLog:
      
      2024-08-19  Martin Jambor  <mjambor@suse.cz>
      
      	PR target/58416
      	* tree-sra.cc (types_risk_mangled_binary_repr_p): New function.
      	(sort_and_splice_var_accesses): Use it.
      	(propagate_subaccesses_from_rhs): Likewise.
      
      gcc/testsuite/ChangeLog:
      
      2024-08-19  Martin Jambor  <mjambor@suse.cz>
      
      	PR target/58416
      	* gcc.dg/torture/pr58416.c: New test.
      f577959f
    • Richard Biener's avatar
      tree-optimization/116380 - bogus SSA update with loop distribution · af0d2d95
      Richard Biener authored
      When updating LC PHIs after copying loops we have to handle defs
      defined outside of the loop appropriately (by not setting them to
      NULL ...).  This mimics how we handle this in the SSA updating
      code of the vectorizer.
      
      	PR tree-optimization/116380
      	* tree-loop-distribution.cc (copy_loop_before): Handle
      	out-of-loop defs appropriately.
      
      	* gcc.dg/torture/pr116380.c: New testcase.
      af0d2d95
    • Jonathan Wakely's avatar
      libstdc++: Use strlen for std::char_traits<char8_t>::length [PR102958] · fd7dabc1
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	PR tree-optimization/102958
      	* include/bits/char_traits.h (char_traits<char8_t>::length): Use
      	strlen.
      fd7dabc1
    • Jonathan Wakely's avatar
      libstdc++: Check ios::uppercase for ios::fixed floating-point output [PR114862] · 878bb62c
      Jonathan Wakely authored
      This is LWG 4084 which I filed recently. LWG seems to support making the
      change, so that std::num_put can use the %F format for floating-point
      numbers.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/114862
      	* src/c++98/locale_facets.cc (__num_base::_S_format_float):
      	Check uppercase flag for fixed format.
      	* testsuite/22_locale/num_put/put/char/lwg4084.cc: New test.
      878bb62c
    • Andre Vehreschild's avatar
      Fix coarray rank for non-coarrays in derived types. [PR86468] · 723b30be
      Andre Vehreschild authored
      The corank was propagated to array components in derived types.  Fix
      this by setting a zero corank when the array component is not a pointer.
      For pointer typed array components propagate the corank of the derived
      type to allow associating the component to a coarray.
      
      gcc/fortran/ChangeLog:
      
      	PR fortran/86468
      
      	* trans-intrinsic.cc (conv_intrinsic_move_alloc): Correct
      	comment.
      	* trans-types.cc (gfc_sym_type): Pass coarray rank, not	false.
      	(gfc_get_derived_type): Only propagate	codimension for coarrays
      	and pointers to array components in derived typed coarrays.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/coarray_lib_this_image_2.f90: Fix array rank in
      	tree dump scan.
      	* gfortran.dg/coarray_lib_token_4.f90: Same.
      	* gfortran.dg/coarray/move_alloc_2.f90: New test.
      723b30be
    • Jonathan Wakely's avatar
      libstdc++: Fix std::variant to reject array types [PR116381] · 1e10b3b8
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/116381
      	* include/std/variant (variant): Fix conditions for
      	static_assert to match the spec.
      	* testsuite/20_util/variant/types_neg.cc: New test.
      1e10b3b8
    • Iain Sandoe's avatar
      c++, coroutines: Check for malformed functions before splitting. · 3949b7c0
      Iain Sandoe authored
      
      This performs the same basic check that is done by finish_function
      to catch cases where the function is so badly malformed that we
      do not have a consistent binding level.
      
      gcc/cp/ChangeLog:
      
      	* coroutines.cc (split_coroutine_body_from_ramp): Check
      	that the binding level is as expected before attempting
      	to outline the function body.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      3949b7c0
    • Rainer Orth's avatar
      testsuite: i386: Fix g++.target/i386/pr116275-2.C on Solaris/x86 · cc8fc985
      Rainer Orth authored
      The new g++.target/i386/pr116275-2.C test FAILs on 32-bit Solaris/x86:
      
      FAIL: g++.target/i386/pr116275-2.C   scan-assembler vpslld
      
      This happens because Solaris defaults to -mstackrealign, disabling -mstv.
      
      Fixed by disabling the former and enabling the latter.
      
      Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu.
      
      2024-08-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
      
      	gcc/testsuite:
      	* g++.target/i386/pr116275-2.C (dg-options): Add -mstv
      	-mno-stackrealign.
      cc8fc985
    • Andre Vehreschild's avatar
      Fortran: Fix ICE in sizeof(coarray) [PR77518] · 515730fd
      Andre Vehreschild authored
      Use se's class_container where present in sizeof().
      
      	PR fortran/77518
      
      gcc/fortran/ChangeLog:
      
      	* trans-intrinsic.cc (gfc_conv_intrinsic_sizeof): Use
      	class_container of se when set.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/coarray/sizeof_1.f90: New test.
      515730fd
    • Kewen Lin's avatar
      rs6000: Remove "+" constraint modifier from *vsx_le_perm_store_* insns · 34292a1a
      Kewen Lin authored
      Since *vsx_le_perm_store_* can be split into vector
      permute and vector store, after reload_completed, we reuse
      the operand 1 as the destination of vector permute, so we
      set operand 1 with constraint modifier "+".  But since
      it's taken as pure input in DF and most passes as Richard
      pointed out in [1], to ensure it's correct when operand 1
      is still live, we actually restore the operand 1's value
      after the store with vector permute, that is:
        op1 = vector permute op1 (doubleword swapping)
        op0 = op2
        op1 = vector permute op1 (doubleword swapping)
      , it means op1's value isn't changed by this insn.
      
      So according to the comments from Richard and Segher in
      that thread, this patch is to remove the "+" constraint
      modifier of operand 1 from *vsx_le_perm_store_* insns.
      
      [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-August/660145.html
      
      gcc/ChangeLog:
      
      	* config/rs6000/vsx.md (define_insn *vsx_le_perm_store_{<VSX_D:mode>,
      	<VSX_W:mode>,v8hi,v16qi,<VSX_LE_128:mode>}): Remove constraint modifier
      	"+" from operand 1.
      34292a1a
    • Kewen Lin's avatar
      rs6000: Fix vsx_le_perm_store_* splitters for !reload_completed · ae53e4b9
      Kewen Lin authored
      For vsx_le_perm_store_* we have two splitters, one is for
      !reload_completed and the other is for reload_completed.
      As Richard pointed out in [1], operand 1 here is a pure
      input for DF and most passes, but it could be used as the
      vector rotation (64 bit) destination of itself, so we
      re-compute the source (back to the original value) for
      the case reload_completed, while for !reload_completed we
      generate one new pseudo, so both cases are fine if operand
      1 is still live after this insn.  But according to the
      source code, for !reload_completed case, it can logically
      reuse the operand 1 as the new pseudo generation is
      conditional on can_create_pseudo_p, then it can cause
      wrong result once operand 1 is live.  So considering this
      and there is no splitting for this when reload_in_progress,
      this patch is to fix the code to assert can_create_pseudo_p
      there, so that both !reload_completed and reload_completed
      cases would ensure operand 1 is unchanged (pure input), it
      is also prepared for the following up patch which would
      strip the unnecessary INOUT constraint modifier "+".
      
      This also fixes an oversight in the splitter for VSX_LE_128
      (!reload_completed), it should use operand 1 rather than
      operand 0.
      
      [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-August/660145.html
      
      gcc/ChangeLog:
      
      	* config/rs6000/vsx.md (*vsx_le_perm_store_{<VSX_D:mode>,<VSX_W:mode>,
      	v8hi,v16qi,<VSX_LE_128:mode>} !reload_completed splitters): Assert
      	can_create_pseudo_p and always generate one new pseudo for operand 1.
      ae53e4b9
    • Kewen Lin's avatar
      testsuite, rs6000: Remove all powerpc-*paired* uses · 118a7241
      Kewen Lin authored
      Similar to r15-710-g458b23bc8b3e2b which removed all uses of
      powerpc-*-linux*paired*, this patch is to remove the remaining
      powerpc-*paired* uses which I missed to catch with "*linux*"
      in search keyword.
      
      gcc/testsuite/ChangeLog:
      
      	* lib/target-supports.exp (check_vect_support_and_set_flags): Remove
      	the if arm checking powerpc-*paired*.
      	(check_750cl_hw_available): Remove.
      	(check_effective_target_vect_unpack): Remove the check on
      	powerpc-*paired*.
      118a7241
    • liuhongt's avatar
      Align predicates for operands[1] between mov<mode> and *mov<mode>_internal. · bb42c551
      liuhongt authored
       > It's not obvious to me why movv16qi requires a nonimmediate_operand
      > > source, especially since ix86_expand_vector_mode does have code to
      > > cope with constant operand[1]s.  emit_move_insn_1 doesn't check the
      > > predicates anyway, so the predicate will have little effect.
      > >
      > > A workaround would be to check legitimate_constant_p instead of the
      > > predicate, but I'm not sure that that should be necessary.
      > >
      > > Has this already been discussed?  If not, we should loop in the x86
      > > maintainers (but I didn't do that here in case it would be a repeat).
      >
      > I also noticed it. Not sure why movv16qi requires a
      > nonimmediate_operand, while ix86_expand_vector_mode could deal with
      > constant op. Looking forward to Hongtao's comments.
      The code has been there since 2005 before I'm involved.
       It looks to me at the beginning both mov<mode> and
      *mov<mode>_internal only support nonimmediate_operand for the
      operands[1].
      And r0-75606-g5656a184e83983 adjusted the nonimmediate_operand to
      nonimmediate_or_sse_const_operand for *mov<mode>_internal, but not for
      mov<mode>. I think we can align the predicate between mov<mode>
      and *mov<mode>_internal.
      
      gcc/ChangeLog:
      
      	* config/i386/sse.md (mov<mode>): Align predicates for
      	operands[1] between mov<mode> and *mov<mode>_internal.
      	* config/i386/mmx.md (mov<mode>): Ditto.
      bb42c551
    • GCC Administrator's avatar
      Daily bump. · 964c9c24
      GCC Administrator authored
      964c9c24
    • Andrew Pinski's avatar
      builtins: Don't expand bit query builtins for __int128_t if the target supports an optab for it · 50b5000a
      Andrew Pinski authored
      
      On aarch64 (without !CSSC instructions), since popcount is implemented using the SIMD instruction cnt,
      instead of using two SIMD cnt (V8QI mode), it is better to use one 128bit cnt (V16QI mode). And only one
      reduction addition instead of 2. Currently fold_builtin_bit_query will expand always without checking
      if there was an optab for the type, so this changes that to check the optab to see if we should expand
      or have the backend handle it.
      
      Bootstrapped and tested on x86_64-linux-gnu and built and tested for aarch64-linux-gnu.
      
      gcc/ChangeLog:
      
      	* builtins.cc (fold_builtin_bit_query): Don't expand double
      	`unsigned long long` typess if there is an optab entry for that
      	type.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      50b5000a
    • Andrew Pinski's avatar
      ASAN: call initialize_sanitizer_builtins for hwasan [PR115205] · efe3da62
      Andrew Pinski authored
      
      Sometimes initialize_sanitizer_builtins is not called before emitting
      the asan builtins with hwasan. In the case of the bug report, there
      was a path with the fortran front-end where it was not called.
      So let's call it in asan_instrument before calling transform_statements
      and from hwasan_finish_file.
      
      Built and tested for aarch64-linux-gnu with no regressions.
      
      Changes since v1:
      * v2: Add call of asan_instrument to hwasan_finish_file also.
      
      gcc/ChangeLog:
      
      	PR sanitizer/115205
      	* asan.cc (asan_instrument): Call initialize_sanitizer_builtins
      	for hwasan.
      	(hwasan_finish_file): Likewise.
      
      Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
      efe3da62
  2. 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
Loading