Skip to content
Snippets Groups Projects
  1. Jul 26, 2023
    • Jakub Jelinek's avatar
      range-op-float: Fix up -frounding-math frange_arithmetic +- handling [PR110755] · 21da32d9
      Jakub Jelinek authored
      IEEE754 says that x + (-x) and x - x result in +0 in all rounding modes
      but rounding towards negative infinity, in which case the result is -0
      for all finite x.  x + x and x - (-x) if it is zero retain sign of x.
      Now, range_arithmetic implements the normal rounds to even rounding,
      and as the addition or subtraction in those cases is exact, we don't do any
      further rounding etc. and e.g. on the testcase below distilled from glibc
      compute a range [+0, +INF], which is fine for -fno-rounding-math or
      if we'd have a guarantee that those statements aren't executed with rounding
      towards negative infinity.
      
      I believe it is only +- which has this problematic behavior and I think
      it is best to deal with it in frange_arithmetic; if we know -frounding-math
      is on, it is x + (-x) or x - x and we are asked to round to negative
      infinity (i.e. want low bound rather than high bound), change +0 result to
      -0.
      
      2023-07-26  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/110755
      	* range-op-float.cc (frange_arithmetic): Change +0 result to -0
      	for PLUS_EXPR or MINUS_EXPR if -frounding-math, inf is negative and
      	it is exact op1 + (-op1) or op1 - op1.
      
      	* gcc.dg/pr110755.c: New test.
      21da32d9
    • Kewen Lin's avatar
      rs6000: Correct vsx operands output for xxeval [PR110741] · 96a83923
      Kewen Lin authored
      PR110741 exposes one issue that we didn't use the correct
      character for vsx operands in output operand substitution,
      consequently it can map to the wrong registers which hold
      some unexpected values.
      
      	PR target/110741
      
      gcc/ChangeLog:
      
      	* config/rs6000/vsx.md (define_insn xxeval): Correct vsx
      	operands output with "x".
      
      gcc/testsuite/ChangeLog:
      
      	* g++.target/powerpc/pr110741.C: New test.
      96a83923
    • Aldy Hernandez's avatar
      [range-ops] Handle bitmasks for ABSU_EXPR. · 39f117d6
      Aldy Hernandez authored
      gcc/ChangeLog:
      
      	* range-op.cc (class operator_absu): Add update_bitmask.
      	(operator_absu::update_bitmask): New.
      39f117d6
    • Aldy Hernandez's avatar
      [range-ops] Handle bitmasks for ABS_EXPR. · 5346a2fc
      Aldy Hernandez authored
      gcc/ChangeLog:
      
      	* range-op-mixed.h (class operator_abs): Add update_bitmask.
      	* range-op.cc (operator_abs::update_bitmask): New.
      5346a2fc
    • Aldy Hernandez's avatar
      [range-ops] Handle bitmasks for BIT_NOT_EXPR. · 4a188dee
      Aldy Hernandez authored
      gcc/ChangeLog:
      
      	* range-op-mixed.h (class operator_bitwise_not): Add update_bitmask.
      	* range-op.cc (operator_bitwise_not::update_bitmask): New.
      4a188dee
    • Aldy Hernandez's avatar
      [range-ops] Handle bitmasks for unary operators. · 5cac2394
      Aldy Hernandez authored
      It looks like we missed out on bitmasks for unary operators because we
      were using bit_value_binop exclusively.  This patch hands off to
      bit_value_unop when appropriate, thus allowing us to handle ABS and
      BIT_NOT_EXPR, and others.  Follow-up patches will add the tweaks for the
      range-ops entries themselves.
      
      gcc/ChangeLog:
      
      	* range-op.cc (update_known_bitmask): Handle unary operators.
      5cac2394
    • Aldy Hernandez's avatar
      Initialize value in bit_value_unop. · 7a48d8d2
      Aldy Hernandez authored
      bit_value_binop initializes VAL regardless of the final mask.  It even
      has a comment to that effect:
      
        /* Ensure that VAL is initialized (to any value).  */
      
      However, bit_value_unop, which in theory shares the same API, does not.
      This causes range-ops to choke on uninitialized VALs for some inputs to
      ABS.
      
      Instead of fixing the callers, it's cleaner to make bit_value_unop and
      bit_value_binop consistent.
      
      gcc/ChangeLog:
      
      	* tree-ssa-ccp.cc (bit_value_unop): Initialize val when appropriate.
      7a48d8d2
    • Jin Ma's avatar
      RISC-V: Fixbug for fsflags instruction error using immediate. · ad0dde0a
      Jin Ma authored
      The pattern mistakenly believes that fsflags can use immediate numbers,
      but in fact it does not support it. Immediate numbers should use fsflagsi.
      
      For example:
      __builtin_riscv_fsflags(4);
      
      The following error occurred.
      /tmp/ccoWdWqT.s: Assembler messages:
      /tmp/ccoWdWqT.s:14: Error: illegal operands `fsflags 4'
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv.md: Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/fsflags.c: New test.
      ad0dde0a
    • Jan Hubicka's avatar
      Fix profile_count::to_sreal_scale · 645c67f8
      Jan Hubicka authored
      gcc/ChangeLog:
      
      	* profile-count.cc (profile_count::to_sreal_scale): Value is not know
      	if we divide by zero.
      645c67f8
    • Nathaniel Shead's avatar
      c++: Track lifetimes in constant evaluation [PR70331,PR96630,PR98675] · 9fdbd7d6
      Nathaniel Shead authored
      
      This adds rudimentary lifetime tracking in C++ constexpr contexts,
      allowing the compiler to report errors with using values after their
      backing has gone out of scope. We don't yet handle other ways of
      accessing values outside their lifetime (e.g. following explicit
      destructor calls).
      
      	PR c++/96630
      	PR c++/98675
      	PR c++/70331
      
      gcc/cp/ChangeLog:
      
      	* constexpr.cc (constexpr_global_ctx::is_outside_lifetime): New
      	function.
      	(constexpr_global_ctx::get_value): Don't return expired values.
      	(constexpr_global_ctx::get_value_ptr): Likewise.
      	(constexpr_global_ctx::remove_value): Mark value outside
      	lifetime.
      	(outside_lifetime_error): New function.
      	(cxx_eval_call_expression): No longer track save_exprs.
      	(cxx_eval_loop_expr): Likewise.
      	(cxx_eval_constant_expression): Add checks for outside lifetime
      	values. Remove local variables at end of bind exprs, and
      	temporaries after cleanup points.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1y/constexpr-lifetime1.C: New test.
      	* g++.dg/cpp1y/constexpr-lifetime2.C: New test.
      	* g++.dg/cpp1y/constexpr-lifetime3.C: New test.
      	* g++.dg/cpp1y/constexpr-lifetime4.C: New test.
      	* g++.dg/cpp1y/constexpr-lifetime5.C: New test.
      	* g++.dg/cpp1y/constexpr-lifetime6.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      9fdbd7d6
    • Nathaniel Shead's avatar
      c++: Prevent dangling pointers from becoming nullptr in constexpr [PR110619] · b8266af7
      Nathaniel Shead authored
      
      Currently, when typeck discovers that a return statement will refer to a
      local variable it rewrites to return a null pointer. This causes the
      error messages for using the return value in a constant expression to be
      unhelpful, especially for reference return values, and is also a visible
      change to otherwise valid code (as in the linked PR).
      
      The transformation is nonetheless important, however, both as a safety
      guard against attackers being able to gain a handle to other data on the
      stack, and to prevent duplicate warnings from later null-dereference
      warning passes.
      
      As such, this patch just delays the transformation until cp_genericize,
      after constexpr function definitions have been generated.
      
      	PR c++/110619
      
      gcc/cp/ChangeLog:
      
      	* cp-gimplify.cc (cp_genericize_r): Transform RETURN_EXPRs to
      	not return dangling pointers.
      	* cp-tree.h (RETURN_EXPR_LOCAL_ADDR_P): New flag.
      	(check_return_expr): Add a new parameter.
      	* semantics.cc (finish_return_stmt): Set flag on RETURN_EXPR
      	when referring to dangling pointer.
      	* typeck.cc (check_return_expr): Disable transformation of
      	dangling pointers, instead pass this information to caller.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1y/constexpr-110619.C: New test.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      b8266af7
    • Nathaniel Shead's avatar
      c++: Improve location information in constant evaluation · 5ebe5bcf
      Nathaniel Shead authored
      
      This patch updates 'input_location' during constant evaluation to ensure
      that errors in subexpressions that lack location information still
      provide accurate diagnostics.
      
      By itself this change causes some small regressions in diagnostic
      quality for circumstances where errors used 'input_location' but the
      location of the parent subexpression doesn't make sense, so this patch
      also includes a small diagnostic improvement to fix the most egregious
      case.
      
      gcc/cp/ChangeLog:
      
      	* constexpr.cc (modifying_const_object_error): Find the source
      	location of the const object's declaration.
      	(cxx_eval_constant_expression): Update input_location to the
      	location of the currently evaluated expression, if possible.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/25_algorithms/equal/constexpr_neg.cc: Update diagnostic
      	locations.
      	* testsuite/26_numerics/gcd/105844.cc: Likewise.
      	* testsuite/26_numerics/lcm/105844.cc: Likewise.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp0x/constexpr-48089.C: Update diagnostic locations.
      	* g++.dg/cpp0x/constexpr-70323.C: Likewise.
      	* g++.dg/cpp0x/constexpr-70323a.C: Likewise.
      	* g++.dg/cpp0x/constexpr-delete2.C: Likewise.
      	* g++.dg/cpp0x/constexpr-diag3.C: Likewise.
      	* g++.dg/cpp0x/constexpr-ice20.C: Likewise.
      	* g++.dg/cpp0x/constexpr-mutable3.C: Likewise.
      	* g++.dg/cpp0x/constexpr-recursion.C: Likewise.
      	* g++.dg/cpp0x/overflow1.C: Likewise.
      	* g++.dg/cpp1y/constexpr-89285.C: Likewise.
      	* g++.dg/cpp1y/constexpr-89481.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const14.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const16.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const18.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const19.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const21.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const22.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const3.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const4.C: Likewise.
      	* g++.dg/cpp1y/constexpr-tracking-const7.C: Likewise.
      	* g++.dg/cpp1y/constexpr-union5.C: Likewise.
      	* g++.dg/cpp1y/pr68180.C: Likewise.
      	* g++.dg/cpp1z/constexpr-lambda6.C: Likewise.
      	* g++.dg/cpp1z/constexpr-lambda8.C: Likewise.
      	* g++.dg/cpp2a/bit-cast11.C: Likewise.
      	* g++.dg/cpp2a/bit-cast12.C: Likewise.
      	* g++.dg/cpp2a/bit-cast14.C: Likewise.
      	* g++.dg/cpp2a/constexpr-98122.C: Likewise.
      	* g++.dg/cpp2a/constexpr-dynamic17.C: Likewise.
      	* g++.dg/cpp2a/constexpr-init1.C: Likewise.
      	* g++.dg/cpp2a/constexpr-new12.C: Likewise.
      	* g++.dg/cpp2a/constexpr-new3.C: Likewise.
      	* g++.dg/cpp2a/constinit10.C: Likewise.
      	* g++.dg/cpp2a/is-corresponding-member4.C: Likewise.
      	* g++.dg/ext/constexpr-vla2.C: Likewise.
      	* g++.dg/ext/constexpr-vla3.C: Likewise.
      	* g++.dg/ubsan/pr63956.C: Likewise.
      
      Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
      5ebe5bcf
    • Jason Merrill's avatar
      testsuite: run C++11 tests in C++11 mode · 2ace6cd6
      Jason Merrill authored
      A recent change missed updating constexpr-mutable3.C because it wasn't run
      in C++11 mode even though it checks the behavior for { target c++11_only }.
      
      gcc/testsuite/ChangeLog:
      
      	* lib/g++-dg.exp (g++-dg-runtest): Check for c++11_only.
      2ace6cd6
    • GCC Administrator's avatar
      Daily bump. · af37e394
      GCC Administrator authored
      af37e394
  2. Jul 25, 2023
    • David Faust's avatar
      bpf: don't print () in bpf_print_operand_address · 8d36a0f5
      David Faust authored
      Unfortunately, the pseudo-C dialect syntax used for some of the v3
      atomic instructions clashes with unconditionally printing the
      surrounding parentheses in bpf_print_operand_address.
      
      Instead, place the parentheses in the output templates where needed.
      
      gcc/
      
      	* config/bpf/bpf.cc (bpf_print_operand_address): Don't print
      	enclosing parentheses for pseudo-C dialect.
      	* config/bpf/bpf.md (zero_exdendhidi2): Add parentheses around
      	operands of pseudo-C dialect output templates where needed.
      	(zero_extendqidi2): Likewise.
      	(zero_extendsidi2): Likewise.
      	(*mov<MM:mode>): Likewise.
      8d36a0f5
    • Andrew Pinski's avatar
      Fix 110803: use of plain char instead of signed char · 67357270
      Andrew Pinski authored
      So the problem here is that plain char can either be signed
      or unsigned depending on the target (powerpc and aarch64 are
      unsigned while most other targets are signed). So the testcase
      gcc.c-torture/execute/pr109986.c was assuming plain char was signed
      char which is wrong so it is better to just change the `char` to be
      `signed char`.
      Note gcc.c-torture/execute/pr109986.c includes gcc.dg/tree-ssa/pr109986.c
      where the plain char was being used.
      
      Committed as obvious after a quick test to make sure gcc.c-torture/execute/pr109986.c
      now passes and gcc.dg/tree-ssa/pr109986.c still passes.
      
      gcc/testsuite/ChangeLog:
      
      	PR testsuite/110803
      	* gcc.dg/tree-ssa/pr109986.c: Change plain char to be
      	`signed char`.
      67357270
    • Joseph Myers's avatar
      Update gcc uk.po · 099d40ba
      Joseph Myers authored
      	* uk.po: Update.
      099d40ba
    • Marek Polacek's avatar
      c++: clear tf_partial et al in instantiate_template [PR108960] · 39004608
      Marek Polacek authored
      In <https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612929.html>
      we concluded that we might clear all flags except tf_warning_or_error
      when performing instantiate_template.
      
      	PR c++/108960
      
      gcc/cp/ChangeLog:
      
      	* pt.cc (lookup_and_finish_template_variable): Don't clear tf_partial
      	here.
      	(instantiate_template): Reset all complain flags except
      	tf_warning_or_error.
      39004608
    • Thomas Schwinge's avatar
      List myself as "nvptx port" maintainer · 28e3d361
      Thomas Schwinge authored
      	* MAINTAINERS: List myself as "nvptx port" maintainer.
      28e3d361
    • Aldy Hernandez's avatar
      Make some functions in CCP static. · a8649d53
      Aldy Hernandez authored
      gcc/ChangeLog:
      
      	* tree-ssa-ccp.cc (value_mask_to_min_max): Make static.
      	(bit_value_mult_const): Same.
      	(get_individual_bits): Same.
      a8649d53
    • Marek Polacek's avatar
      c++: fix ICE with constexpr ARRAY_REF [PR110382] · 6e424feb
      Marek Polacek authored
      This code in cxx_eval_array_reference has been hard to get right.
      In r12-2304 I added some code; in r13-5693 I removed some of it.
      
      Here the problematic line is "S s = arr[0];" which causes a crash
      on the assert in verify_ctor_sanity:
      
        gcc_assert (!ctx->object || !DECL_P (ctx->object)
                    || ctx->global->get_value (ctx->object) == ctx->ctor);
      
      ctx->object is the VAR_DECL 's', which is correct here.  The second
      line points to the problem: we replaced ctx->ctor in
      cxx_eval_array_reference:
      
        new_ctx.ctor = build_constructor (elem_type, NULL); // #1
      
      which I think we shouldn't have; the CONSTRUCTOR we created in
      cxx_eval_constant_expression/DECL_EXPR
      
        new_ctx.ctor = build_constructor (TREE_TYPE (r), NULL);
      
      had the right type.
      
      We still need #1 though.  E.g., in constexpr-96241.C, we never
      set ctx.ctor/object before calling cxx_eval_array_reference, so
      we have to build a CONSTRUCTOR there.  And in constexpr-101371-2.C
      we have a ctx.ctor, but it has the wrong type, so we need a new one.
      
      We can fix the problem by always clearing the object, and, as an
      optimization, only create/free a new ctor when actually needed.
      
      	PR c++/110382
      
      gcc/cp/ChangeLog:
      
      	* constexpr.cc (cxx_eval_array_reference): Create a new constructor
      	only when we don't already have a matching one.  Clear the object
      	when the type is non-scalar.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/cpp1y/constexpr-110382.C: New test.
      6e424feb
    • Tobias Burnus's avatar
      OpenMP/Fortran: Reject declarations between target + teams · 09dda270
      Tobias Burnus authored
      While commit r14-2754-g2e31fe431b08b0302e1fa8a1c18ee51adafd41df
      detected executable statements, declarations do not show up as
      executable statements.  Hence, we now check whether the first
      statement after TARGET is TEAMS - such that we can detect data
      statements like type or variable declarations.  Fortran semantics
      ensures that only executable directives/statemens can come after
      '!$omp end teams' such that those can be detected with the
      previous check.
      
      Note that statements returning ST_NONE such as 'omp nothing' or
      'omp error at(compilation)' will still slip through.
      
      	PR fortran/110725
      	PR middle-end/71065
      
      gcc/fortran/ChangeLog:
      
      	* gfortran.h (gfc_omp_clauses): Add target_first_st_is_teams.
      	* parse.cc (parse_omp_structured_block): Set it if the first
      	statement in the structured block of a TARGET is TEAMS or
      	a combined/composite starting with TEAMS.
      	* openmp.cc (resolve_omp_target): Also show an error for
      	contains_teams_construct without target_first_st_is_teams.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/gomp/teams-6.f90: New test.
      09dda270
    • Marc Poulhiès's avatar
      Adjust one Ada test · d8dc61bb
      Marc Poulhiès authored
      Recent change modified how the loops are created, with the first
      iteration being extracted out of the loops in the 2 test cases.
      Adjust the text to match from the unroll dump.
      
      gcc/testsuite/ChangeLog:
      
      	* gnat.dg/unroll3.adb: Adjust.
      d8dc61bb
    • Tobias Burnus's avatar
      gfortran.dg/gomp/pr99226.f90: Add missing dg-error · 50656980
      Tobias Burnus authored
      Follow up to r14-2754-g2e31fe431b08b0302e1fa8a1c18ee51adafd41df
      which added a check that a target region with teams does not
      have anything anything else strictly nested in the target.
      
      When changing the dg-error for this PR, somehow the addition of a
      dg-error in a second line was lost (the message uses (1) and (2) as
      location, showing two lines, both need a dg-error with the same message).
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/gomp/pr99226.f90: Update dg-error.
      50656980
    • Haochen Gui's avatar
      rs6000: Implemented f[min/max]_optab by xs[min/max]dp · 54ce3cbd
      Haochen Gui authored
      gcc/
      	PR target/103605
      	* config/rs6000/rs6000-builtin.cc (rs6000_gimple_fold_builtin): Gimple
      	fold RS6000_BIF_XSMINDP and RS6000_BIF_XSMAXDP when fast-math is set.
      	* config/rs6000/rs6000.md (FMINMAX): New int iterator.
      	(minmax_op): New int attribute.
      	(UNSPEC_FMAX, UNSPEC_FMIN): New unspecs.
      	(f<minmax_op><mode>3): New pattern by UNSPEC_FMAX and UNSPEC_FMIN.
      	* config/rs6000/rs6000-builtins.def (__builtin_vsx_xsmaxdp): Set
      	pattern to fmaxdf3.
      	(__builtin_vsx_xsmindp): Set pattern to fmindf3.
      
      gcc/testsuite/
      	PR target/103605
      	* gcc.target/powerpc/pr103605.h: New.
      	* gcc.target/powerpc/pr103605-1.c: New.
      	* gcc.target/powerpc/pr103605-2.c: New.
      54ce3cbd
    • Gaius Mulley's avatar
      PR modula2/110174 Bugfixes to M2GenGCC.mod:CodeInline preventing an ICE · c4637cbe
      Gaius Mulley authored
      
      This patch calls skip_const_decl before chaining parameter values and
      ensures that all strings passed to build_stmt (..., ASM_EXPR, ...) are
      nul terminated.  It also improves the accuracy of locations in
      function calls and asm statements.
      
      gcc/m2/
      
      	PR modula2/110174
      	* gm2-compiler/M2GCCDeclare.def (PromoteToCString): New procedure
      	function.
      	* gm2-compiler/M2GCCDeclare.mod (PromoteToCString): New procedure
      	function.
      	* gm2-compiler/M2GenGCC.mod (BuildTreeFromInterface): Call
      	skip_const_decl before chaining the parameter value.
      	Use PromoteToCString to ensure the string is nul terminated.
      	(CodeInline): Remove all parameters and replace with quad.
      	Use GetQuadOtok to get operand token numbers.
      	Remove call to DeclareConstant and replace it with PromoteToCString.
      	* gm2-compiler/M2Quads.def (BuildInline): Rename into ...
      	(BuildAsm): ... this.
      	* gm2-compiler/M2Quads.mod: (BuildInline): Rename into ...
      	(BuildAsm): ... this.
      	(BuildAsmElement): Add debugging.
      	* gm2-compiler/P1Build.bnf: Remove import of BuildInline.
      	* gm2-compiler/P2Build.bnf: Remove import of BuildInline.
      	* gm2-compiler/P3Build.bnf: Remove import of BuildInline and
      	import BuildAsm.
      	* gm2-compiler/PHBuild.bnf: Remove import of BuildInline.
      	* gm2-libs-iso/SysClock.mod (foo): Remove.
      	* gm2-libs/FIO.mod (BufferedRead): Rename parameter a to dest.
      	Rename variable t to src.
      	* m2pp.cc (pf): Correct block comment.
      	(pe): Correct block comment.
      	(m2pp_asm_expr): New function.
      	(m2pp_statement): Call m2pp_asm_expr.
      
      gcc/testsuite/
      
      	PR modula2/110174
      	* gm2/pim/pass/program2.mod: Remove import of BuildInline.
      	* gm2/extensions/asm/fail/extensions-asm-fail.exp: New test.
      	* gm2/extensions/asm/fail/stressreturn.mod: New test.
      	* gm2/extensions/asm/pass/extensions-asm-pass.exp: New test.
      	* gm2/extensions/asm/pass/fooasm.mod: New test.
      
      Signed-off-by: default avatarGaius Mulley <gaiusmod2@gmail.com>
      c4637cbe
    • GCC Administrator's avatar
      Daily bump. · 87d4356c
      GCC Administrator authored
      87d4356c
  3. Jul 24, 2023
    • Deev Patel's avatar
      libstdc++: Add missing constexpr specifiers in <format> · 96482ffe
      Deev Patel authored
      A couple of virtual functions in the libstdc++ format header are marked
      constexpr in the base class, but not in the derived class. This was
      causing build failures when trying to compile latest gcc libstdc++ with
      clang 16 using c++20. Adding the constexpr specifier resolves the issue.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/format (_Formatting_scanner::_M_on_chars): Add
      	missing constexpr specifier.
      	(_Formatting_scanner::_M_format_arg): Likewise.
      96482ffe
    • Tobias Burnus's avatar
      OpenMP/Fortran: Reject not strictly nested target -> teams [PR110725, PR71065] · 2e31fe43
      Tobias Burnus authored
      OpenMP requires: "If a teams region is nested inside a target region, the
      corresponding target construct must not contain any statements, declarations
      or directives outside of the corresponding teams construct."
      
      This commit checks now for this restriction.
      
      	PR fortran/110725
      	PR middle-end/71065
      
      gcc/fortran/ChangeLog:
      
      	* gfortran.h (gfc_omp_clauses): Add contains_teams_construct.
      	* openmp.cc (resolve_omp_target): New; check for teams nesting.
      	(gfc_resolve_omp_directive): Call it.
      	* parse.cc (decode_omp_directive): Set contains_teams_construct
      	on enclosing ST_OMP_TARGET.
      
      gcc/testsuite/ChangeLog:
      
      	* gfortran.dg/gomp/pr99226.f90: Update dg-error.
      	* gfortran.dg/gomp/teams-5.f90: New test.
      2e31fe43
    • Jonathan Wakely's avatar
      libstdc++; Do not use strtold for hppa-hpux [PR110653] · 31c3b67d
      Jonathan Wakely authored
      When I switched std::stold to depend on HAVE_STRTOLD that enabled it for
      hppa-hpux which defines HAVE_BROKEN_STRTOLD. Add a check for that macro
      so that we don't use strtold, and fall through to the check for double
      and long double having the same representation. That should mean we
      define a conforming std::stold in terms of std::stod, instead of trying
      to use the broken strtold.
      
      Also fix a logic error in the fallback definition of std::stod, which
      should not treat zero as a subnormal number.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110653
      	* include/bits/basic_string.h [!HAVE_STOF] (stof): Do not
      	throw an exception for zero result.
      	[HAVE_BROKEN_STRTOLD] (stold): Do not use strtold.
      31c3b67d
    • David Faust's avatar
      bpf: add pseudo-c asm dialect for "nop" · be16bb88
      David Faust authored
      The define_insn "nop" was missing a template for the pseudo-c dialect,
      so the normal syntax was unconditionally emitted.
      
      gcc/
      
      	* config/bpf/bpf.md (nop): Add pseudo-c asm dialect template.
      be16bb88
    • Drew Ross's avatar
      match.pd: Implement missed optimization (~X | Y) ^ X -> ~(X & Y) [PR109986] · 2a355637
      Drew Ross authored
      
      Adds a simplification for (~X | Y) ^ X to be folded into ~(X & Y).
      Also adds the macro bitwise_equal_p for generic and gimple which
      returns true iff EXPR1 and EXPR2 have the same value. This helps
      to reduce the number of nop_converts necessary to match the pattern.
      
      	PR middle-end/109986
      
      gcc/ChangeLog:
      
      	* generic-match-head.cc (bitwise_equal_p): New macro.
      	* gimple-match-head.cc (bitwise_equal_p): New macro.
      	(gimple_nop_convert): Declare.
      	(gimple_bitwise_equal_p): Helper for bitwise_equal_p.
      	* match.pd ((~X | Y) ^ X -> ~(X & Y)): New simplification.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.c-torture/execute/pr109986.c: New test.
      	* gcc.dg/tree-ssa/pr109986.c: New test.
      
      Co-authored-by: default avatarJakub Jelinek <jakub@redhat.com>
      2a355637
    • Jeff Law's avatar
      [committed] Use single quote rather than backquote in RISC-V diagnostic · d90e81af
      Jeff Law authored
      Similar to the other patch this morning, this fixes a warning that was causing
      the RISC-V bootstrap to fail.
      
      In this case the diagnostic used a backquote.  This changes it to a simple
      single quote which the diagnostic framework won't complain about.
      
      Committed to the trunk.
      
      gcc/
      	* common/config/riscv/riscv-common.cc (riscv_subset_list::add): Use
      	single quote rather than backquote in diagnostic.
      d90e81af
    • Jose E. Marchesi's avatar
      bpf: sdiv/smod are now part of BPF V4 · 4be3919f
      Jose E. Marchesi authored
      We used to support signed division and signed modulus instructions in
      the XBPF GCC-specific extensions to BPF.  However, BPF catched up by
      adding these instructions in the V4 of the ISA.
      
      This patch changes GCC in order to use sdiv/smod instructions when
      -mcpu=v4 or higher.  The testsuite and the manual have been updated
      accordingly.
      
      Tested in bpf-unknown-none.
      
      gcc/ChangeLog
      
      	PR target/110783
      	* config/bpf/bpf.opt: New command-line option -msdiv.
      	* config/bpf/bpf.md: Conditionalize sdiv/smod on bpf_has_sdiv.
      	* config/bpf/bpf.cc (bpf_option_override): Initialize
      	bpf_has_sdiv.
      	* doc/invoke.texi (eBPF Options): Document -msdiv.
      
      gcc/testsuite/ChangeLog
      
      	PR target/110783
      	* gcc.target/bpf/xbpf-sdiv-1.c: Renamed to sdiv-1.c
      	* gcc.target/bpf/xbpf-smod-1.c: Renamed to smod-1.c
      	* gcc.target/bpf/sdiv-1.c: Renamed from xbpf-sdiv-1.c, use -mcpu=v4.
      	* gcc.target/bpf/smod-1.c: Renamed from xbpf-smod-1.c, use -mcpu=v4.
      	* gcc.target/bpf/diag-sdiv.c: Use -mcpu=v3.
      	* gcc.target/bpf/diag-smod.c: Likewise.
      4be3919f
    • Jeff Law's avatar
      [committed][RISC-V] Fix minor issues in diagnostic message · aa1e2d54
      Jeff Law authored
      This fixes two minor issues with the recently adding warning about too large
      VLEN in the RISC-V backend.  These prevent the RISC-V port from bootstrapping
      as both Andreas and I have found.
      
      Specifically we'll get warnings for the use of '>' in the recently added
       message as well as using "can not" vs "cannot".  While these warnings may
      seem annoying, they're in place to make it easier for the translators.
      
      This patch fixes the message in the fairly obvious way.  Spells out the
      greater than and uses cannot.  There's a similar issue in another recently
      added diagnostic that I'll push momentarily.
      
      gcc/
      	* config/riscv/riscv.cc (riscv_option_override): Spell out
      	greater than and use cannot in diagnostic string.
      aa1e2d54
    • Richard Biener's avatar
      Remove SLP_TREE_VEC_STMTS in favor of SLP_TREE_VEC_DEFS · 2b074dc7
      Richard Biener authored
      The following unifies SLP_TREE_VEC_STMTS into SLP_TREE_VEC_DEFS
      which can handle all cases we need.
      
      	* tree-vectorizer.h (_slp_tree::push_vec_def): Add.
      	(_slp_tree::vec_stmts): Remove.
      	(SLP_TREE_VEC_STMTS): Remove.
      	* tree-vect-slp.cc (_slp_tree::push_vec_def): Define.
      	(_slp_tree::_slp_tree): Adjust.
      	(_slp_tree::~_slp_tree): Likewise.
      	(vect_get_slp_vect_def): Simplify.
      	(vect_get_slp_defs): Likewise.
      	(vect_transform_slp_perm_load_1): Adjust.
      	(vect_add_slp_permutation): Likewise.
      	(vect_schedule_slp_node): Likewise.
      	(vectorize_slp_instance_root_stmt): Likewise.
      	(vect_schedule_scc): Likewise.
      	* tree-vect-stmts.cc (vectorizable_bswap): Use push_vec_def.
      	(vectorizable_call): Likewise.
      	(vectorizable_call): Likewise.
      	(vect_create_vectorized_demotion_stmts): Likewise.
      	(vectorizable_conversion): Likewise.
      	(vectorizable_assignment): Likewise.
      	(vectorizable_shift): Likewise.
      	(vectorizable_operation): Likewise.
      	(vectorizable_load): Likewise.
      	(vectorizable_condition): Likewise.
      	(vectorizable_comparison): Likewise.
      	* tree-vect-loop.cc (vect_create_epilog_for_reduction): Adjust.
      	(vectorize_fold_left_reduction): Use push_vec_def.
      	(vect_transform_reduction): Likewise.
      	(vect_transform_cycle_phi): Likewise.
      	(vectorizable_lc_phi): Likewise.
      	(vectorizable_phi): Likewise.
      	(vectorizable_recurr): Likewise.
      	(vectorizable_induction): Likewise.
      	(vectorizable_live_operation): Likewise.
      2b074dc7
    • Richard Biener's avatar
      Remove unused tree-vectorizer.h include · 8547c451
      Richard Biener authored
      	* tree-ssa-loop.cc: Remove unused tree-vectorizer.h include.
      8547c451
    • Richard Biener's avatar
      [i386] remove unused tree-vectorizer.h includes · 2c820da2
      Richard Biener authored
      	* config/i386/i386-builtins.cc: Remove tree-vectorizer.h include.
      	* config/i386/i386-expand.cc: Likewise.
      	* config/i386/i386-features.cc: Likewise.
      	* config/i386/i386-options.cc: Likewise.
      2c820da2
    • Robin Dapp's avatar
      vect: Handle demoting FLOAT and promoting FIX_TRUNC. · fe39eca4
      Robin Dapp authored
      The recent changes that allowed multi-step conversions for
      "non-packing/unpacking", i.e. modifier == NONE targets included
      promoting to-float and demoting to-int variants.  This patch
      adds the missing demoting to-float and promoting to-int handling.
      
      gcc/ChangeLog:
      
      	* tree-vect-stmts.cc (vectorizable_conversion): Handle
      	more demotion/promotion for modifier == NONE.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/rvv/autovec/conversions/vec-narrow-int64-float16.c: New test.
      	* gcc.target/riscv/rvv/autovec/conversions/vec-widen-float16-int64.c: New test.
      fe39eca4
    • Roger Sayle's avatar
      [Committed] PR target/110787: Revert QImode offsets in {zero,sign}_extract. · 9f66753e
      Roger Sayle authored
      My recent patch to use QImode for bit offsets in ZERO_EXTRACTs and
      SIGN_EXTRACTs in the i386 backend shouldn't have resulted in any change
      behaviour, but as reported by Rainer it produces a bootstrap failure in
      gm2.  This reverts the problematic patch whilst we investigate the
      underlying cause.
      
      Committed as obvious.
      
      2023-07-23  Roger Sayle  <roger@nextmovesoftware.com>
      
      gcc/ChangeLog
      	PR target/110787
      	PR target/110790
      	Revert patch.
      	* config/i386/i386.md (extv<mode>): Use QImode for offsets.
      	(extzv<mode>): Likewise.
      	(insv<mode>): Likewise.
      	(*testqi_ext_3): Likewise.
      	(*btr<mode>_2): Likewise.
      	(define_split): Likewise.
      	(*btsq_imm): Likewise.
      	(*btrq_imm): Likewise.
      	(*btcq_imm): Likewise.
      	(define_peephole2 x3): Likewise.
      	(*bt<mode>): Likewise
      	(*bt<mode>_mask): New define_insn_and_split.
      	(*jcc_bt<mode>): Use QImode for offsets.
      	(*jcc_bt<mode>_1): Delete obsolete pattern.
      	(*jcc_bt<mode>_mask): Use QImode offsets.
      	(*jcc_bt<mode>_mask_1): Likewise.
      	(define_split): Likewise.
      	(*bt<mode>_setcqi): Likewise.
      	(*bt<mode>_setncqi): Likewise.
      	(*bt<mode>_setnc<mode>): Likewise.
      	(*bt<mode>_setncqi_2): Likewise.
      	(*bt<mode>_setc<mode>_mask): New define_insn_and_split.
      	(bmi2_bzhi_<mode>3): Use QImode offsets.
      	(*bmi2_bzhi_<mode>3): Likewise.
      	(*bmi2_bzhi_<mode>3_1): Likewise.
      	(*bmi2_bzhi_<mode>3_1_ccz): Likewise.
      	(@tbm_bextri_<mode>): Likewise.
      9f66753e
Loading