Skip to content
Snippets Groups Projects
  1. Nov 16, 2022
    • Jonathan Wakely's avatar
      libstdc++: Fix dumb typos in ALT128 support in <format> [PR107720] · dbdce6ad
      Jonathan Wakely authored
      This is only a partial fix for the PR.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/107720
      	* include/std/format (__format::_Arg_t): Fix typo in enumerator
      	name.
      	(_Arg_value::_S_get): Fix missing semi-colons.
      dbdce6ad
    • Jonathan Wakely's avatar
      libstdc++: Improve performance of chrono::utc_clock::now() · 629897ed
      Jonathan Wakely authored
      We can use an array instead of a std::vector, and we can avoid the
      binary search for the common case of a time point after the most recent
      leap second. On one system where I tested this, utc_clock::now() now
      takes about 16ns instead of 31ns.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/chrono (get_leap_second_info): Optimize.
      629897ed
    • Jonathan Wakely's avatar
      libstdc++: Adjust <format> for Clang compatibility [PR107712] · 2f5c0718
      Jonathan Wakely authored
      Clang doesn't define __builtin_toupper, so use std::toupper.
      
      Also add some (not actually required since C++20) typename keywords to
      help Clang versions up to and including 15.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/107712
      	* include/std/format (__format::__formatter_int::format): Use
      	std::toupper when __builtin_toupper isn't available.
      	(basic_format_arg::handle): Add 'typename'.
      	* include/std/complex (complex<T>): Add 'typename'.
      2f5c0718
    • Jonathan Wakely's avatar
      libstdc++: Disable std::format of _Float128 if std::to_chars is innaccurate · 22cb0fea
      Jonathan Wakely authored
      This restricts std::format support for _Float128 (and __float128) to
      targets where glibc provides __strfromf128 and so can give correct
      output.
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/format [__FLT128_DIG__] (_GLIBCXX_FORMAT_F128):
      	Only support formatting _Float128 when glibc provides the
      	functionality needed for accurate std::to_chars.
      22cb0fea
    • Harald Anlauf's avatar
      Fortran: error recovery after reference to bad CLASS variable [PR107681] · 96e4244e
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/107681
      	* resolve.cc (resolve_fl_var_and_proc): Prevent NULL pointer
      	dereference with reference to bad CLASS variable.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/107681
      	* gfortran.dg/pr107681.f90: New test.
      96e4244e
    • Harald Anlauf's avatar
      Fortran: ICE in simplification of array expression involving power [PR107680] · 713dcfc8
      Harald Anlauf authored
      gcc/fortran/ChangeLog:
      
      	PR fortran/107680
      	* arith.cc (arith_power): Check that operands are properly converted
      	before attempting to simplify.
      
      gcc/testsuite/ChangeLog:
      
      	PR fortran/107680
      	* gfortran.dg/pr107680.f90: New test.
      713dcfc8
    • Philipp Tomsich's avatar
      RISC-V: Split "(a & (1UL << bitno)) ? 0 : 1" to bext + xori · ac74b3f8
      Philipp Tomsich authored
      
      We avoid reassociating "(~(a >> BIT_NO)) & 1" into "((~a) >> BIT_NO) & 1"
      by splitting it into a zero-extraction (bext) and an xori.  This both
      avoids burning a register on a temporary and generates a sequence that
      clearly captures 'extract bit, then invert bit'.
      
      This change improves the previously generated
          srl   a0,a0,a1
          not	  a0,a0
          andi  a0,a0,1
      into
          bext  a0,a0,a1
          xori  a0,a0,1
      
      Signed-off-by: default avatarPhilipp Tomsich <philipp.tomsich@vrull.eu>
      
      gcc/ChangeLog:
      
      	* config/riscv/bitmanip.md: Add split covering
      	"(a & (1 << BIT_NO)) ? 0 : 1".
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/zbs-bext.c: Add testcases.
      	* gcc.target/riscv/zbs-bexti.c: Add testcases.
      ac74b3f8
    • Philipp Tomsich's avatar
      RISC-V: Split "(a & (1UL << bitno)) ? 0 : -1" to bext + addi · 32462550
      Philipp Tomsich authored
      For a straightforward application of bext for the following function
        long bext64(long a, char bitno)
        {
          return (a & (1UL << bitno)) ? 0 : -1;
        }
      we generate
      	srl	a0,a0,a1	# 7	[c=4 l=4]  lshrdi3
      	andi	a0,a0,1	# 8	[c=4 l=4]  anddi3/1
      	addi	a0,a0,-1	# 14	[c=4 l=4]  adddi3/1
      due to the following failed match at combine time:
        (set (reg:DI 82)
             (zero_extract:DI (reg:DI 83)
                  (const_int 1 [0x1])
                  (reg:DI 84)))
      
      The existing pattern for bext requires the 3rd argument to
      zero_extract to be a QImode register wrapped in a zero_extension.
      This adds an additional pattern that allows an Xmode argument.
      
      With this change, the testcase compiles to
      	bext	a0,a0,a1	# 8	[c=4 l=4]  *bextdi
      	addi	a0,a0,-1	# 14	[c=4 l=4]  adddi3/1
      
      gcc/ChangeLog:
      
      	* config/riscv/bitmanip.md (*bext<mode>): Add an additional
      	pattern that allows the 3rd argument to zero_extract to be
      	an Xmode register operand.
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/zbs-bext.c: Add testcases.
      	* gcc.target/riscv/zbs-bexti.c: Add testcases.
      32462550
    • Hans-Peter Nilsson's avatar
      testsuite: Fix mistransformed gcov · e91d5145
      Hans-Peter Nilsson authored
      In commit r13-2619-g34b9a03353d3fd, [transform] was applied to all
      invocations of gcov, for both out-of-tree and in-tree testing.
      For in-tree cross builds, this means gcov was called as
      "/path/to/gccobj/gcc/target-tuple-gcov" gcov-pr94029.c which is
      incorrect, as it's there "/path/to/gccobj/gcc/gcov" until it's
      installed.  This caused a testsuite failure, like:
      
      Running /x/gcc/gcc/testsuite/gcc.misc-tests/gcov.exp ...
      FAIL: gcc.misc-tests/gcov-pr94029.c gcov failed: spawn failed
      
      To avoid cumbersome conditionals, use a dedicated new helper function.
      
      gcc/testsuite:
      	* lib/gcc-dg.exp (gcc-transform-out-of-tree): New proc.
      	* g++.dg/gcov/gcov.exp, gcc.misc-tests/gcov.exp: Call
      	gcc-transform-out-of-tree instead of transform.
      e91d5145
    • Richard Biener's avatar
      tree-optimization/107686 - fix bitfield ref through vec_unpack optimization · 246bbdaa
      Richard Biener authored
      The following propely restricts the bitfield access to integral types
      when we look through VEC_UNPACK with the intent to emit a widening
      conversion.
      
      	PR tree-optimization/107686
      	* tree-ssa-forwprop.cc (optimize_vector_load): Restrict
      	VEC_UNPACK support to integral typed bitfield refs.
      
      	* gcc.dg/pr107686.c: New testcase.
      246bbdaa
    • Richard Biener's avatar
      middle-end/107679 - fix SSA rewrite of clobber of parameter · 8a5f3663
      Richard Biener authored
      When the frontend clobbers a parameter and that parameter gets
      rewritten into SSA then we ICE because we didn't expect this.  Avoid
      using the parameter decl to create a SSA default def in this case.
      
      	PR middle-end/107679
      	* tree-into-ssa.cc (maybe_register_def): Use new temporary if
      	we require an uninitialized value for a parameter decl.
      
      	* gfortran.dg/pr107679.f90: New testcase.
      8a5f3663
    • Jonathan Wakely's avatar
      libstdc++: Add test for chrono::utc_clock leap second offset · 7026d045
      Jonathan Wakely authored
      This test of leap second handling is taken from the C++20 standard.
      
      libstdc++-v3/ChangeLog:
      
      	* testsuite/std/time/clock/utc/1.cc: Check handling across leap
      	second insertion.
      7026d045
    • Martin Liska's avatar
      libatomic: regenerate Makefile.in · f6d6fd05
      Martin Liska authored
      libatomic/ChangeLog:
      
      	* Makefile.in: Re-generate.
      f6d6fd05
    • Patrick Palka's avatar
      libstdc++: Fix stream initialization with static library [PR107701] · ec598480
      Patrick Palka authored
      When linking with a static library, the linker seems to discard a
      constituent .o object (including its global initializers) if nothing
      defined in the object is referenced by the program (unless e.g.
      --whole-archive is used).  This behavior breaks iostream with static
      libstdc++.a (on systems that support init priorities) because we define
      the global initializer for the standard stream objects in a separate TU
      (ios_init.cc) from the stream object definitions (globals_io.cc).
      
      This patch fixes this by moving the stream initialization object into
      the same TU that defines the stream objects, so that any use of the
      streams prevents the linker from discarding this global initializer.
      
      	PR libstdc++/107701
      
      libstdc++-v3/ChangeLog:
      
      	* include/std/iostream (__ioinit): Adjust comment.
      	* src/c++98/globals_io.cc: Include "io_base_init.h" here
      	instead of ...
      	* src/c++98/ios_init.cc: ... here.
      	* src/c++98/ios_base_init.h (__ioinit): More comments.
      	* testsuite/17_intro/static.cc: dg-do run instead of just link.
      ec598480
    • Jakub Jelinek's avatar
      c++: Alignment changes to layout compatibility/common initial sequence - DR2583 · c5e8c6c1
      Jakub Jelinek authored
      When trying to figure out what to do about alignment,
      layout_compatible_type_p returns false if TYPE_ALIGN on
      ENUMERAL_TYPE/CLASS_TYPE_P (but not scalar types?) differ, or if members
      don't have the same positions.
      
      What is in DR2583 doesn't say anything like that though, on the other side
      it says that if the corresponding entities don't have the same alignment
      requirements, they aren't part of the common initial sequence.
      
      So, my understanding of this is we shouldn't check TYPE_ALIGN in
      layout_compatible_type_p, but instead DECL_ALIGN in
      next_common_initial_seqence.
      
      2022-11-16  Jakub Jelinek  <jakub@redhat.com>
      
      	* typeck.cc (next_common_initial_sequence): Return false members have
      	different DECL_ALIGN.
      	(layout_compatible_type_p): Don't test TYPE_ALIGN of ENUMERAL_TYPE
      	or CLASS_TYPE_P.
      
      	* g++.dg/cpp2a/is-layout-compatible3.C: Expect enums with different
      	alignas to be layout compatible, while classes with different
      	alignas on members layout incompatible.
      	* g++.dg/DRs/dr2583.C: New test.
      c5e8c6c1
    • Jakub Jelinek's avatar
      libstdc++: Fix up <complex> for extended floating point types [PR107649] · 0e2c5510
      Jakub Jelinek authored
      As filed by Jonathan in the PR, I've screwed up the requires syntax
      in the extended floating point specialization:
      -    requires(__complex_type<_Tp>::type)
      +    requires requires { typename __complex_type<_Tp>::type; }
      and doing this change resulted in lots of errors because __complex_whatever
      overfloads from extended floating point types were declared after the
      templates which used them.
      
      The following patch fixes that.
      
      Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
      I've tested that with _GLIBCXX_HAVE_FLOAT128_MATH not being defined
      while __STDCPP_FLOAT128_T__ defined one can still use
      std::complex<std::float128_t> for basic arithmetic etc., just one can't
      expect std::sin etc. to work in that case (because we don't have any
      implementation).
      
      2022-11-16  Jakub Jelinek  <jakub@redhat.com>
      	    Jonathan Wakely  <jwakely@redhat.com>
      
      	PR libstdc++/107649
      	* include/std/complex (__complex_abs, __complex_arg, __complex_cos,
      	__complex_cosh, __complex_exp, __complex_log, __complex_sin,
      	__complex_sinh, __complex_sqrt, __complex_tan, __complex_tanh,
      	__complex_pow): Move __complex__ _Float{16,32,64,128} and
      	__complex__ decltype(0.0bf16) overloads earlier in the file.
      	(complex): Fix up requires on the partial specialization for extended
      	float types.
      	(__complex_acos, __complex_asin, __complex_atan, __complex_acosh,
      	__complex_asinh, __complex_atanh): Move
      	__complex__ _Float{16,32,64,128} and __complex__ decltype(0.0bf16)
      	overloads earlier in the file.
      0e2c5510
    • Jakub Jelinek's avatar
      c++: Fix up calls to static operator() or operator[] [PR107624] · cf958f8f
      Jakub Jelinek authored
      One thing that doesn't work properly is the same problem as I've filed
      yesterday for static operator() - PR107624 - that side-effects of
      the postfix-expression on which the call or subscript operator are
      applied are thrown away, I assume we have to add them into COMPOUND_EXPR
      somewhere after we find out that the we've chosen a static member function
      operator.
      
      On Mon, Nov 14, 2022 at 06:29:44PM -0500, Jason Merrill wrote:
      > Indeed.  The code in build_new_method_call for this case has the comment
      >
      >               /* In an expression of the form `a->f()' where `f' turns
      >                  out to be a static member function, `a' is
      >                  none-the-less evaluated.  */
      
      Had to tweak 3 spots for this.  Furthermore, found that if in non-pedantic
      C++20 compilation static operator[] is accepted, we required that it has 2
      arguments, I think it is better to require exactly one because that case
      is the only one that will actually work in C++20 and older.
      
      2022-11-16  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/107624
      	* call.cc (keep_unused_object_arg): New function.
      	(build_op_call): Use it.
      	(build_op_subscript): Likewise.
      	(build_new_op): Similarly for ARRAY_REF.
      	(build_new_method_call): Use it.
      	* decl.cc (grok_op_properties): For C++20 and earlier, if operator[]
      	is static member function, require exactly one parameter rather than
      	exactly two parameters.
      
      	* g++.dg/cpp23/static-operator-call4.C: New test.
      	* g++.dg/cpp23/subscript10.C: New test.
      	* g++.dg/cpp23/subscript11.C: New test.
      cf958f8f
    • Alexander Monakov's avatar
      doc: fix description of -mrelax-cmpxchg-loop [PR 107676] · 85966f0d
      Alexander Monakov authored
      gcc/ChangeLog:
      
      	PR target/107676
      	* doc/invoke.texi (-mrelax-cmpxchg-loop): Reword description.
      85966f0d
    • Alexander Monakov's avatar
      i386: correct x87&SSE multiplication modeling in znver.md · d4cc7a8c
      Alexander Monakov authored
      All multiplication instructions are fully pipelined, except AVX256
      instructions on Zen 1, which issue over two cycles on a 128-bit unit.
      Correct the model accordingly to reduce combinatorial explosion in
      automaton tables.
      
      Top znver table sizes in insn-automata.o:
      
      Before:
      
      30056 r znver1_fp_min_issue_delay
      120224 r znver1_fp_transitions
      
      After:
      
      6720 r znver1_fp_min_issue_delay
      53760 r znver1_fp_transitions
      
      gcc/ChangeLog:
      
      	PR target/87832
      	* config/i386/znver.md: (znver1_fp_op_mul): Correct cycles in
      	the reservation.
      	(znver1_fp_op_mul_load): Ditto.
      	(znver1_mmx_mul): Ditto.
      	(znver1_mmx_load): Ditto.
      	(znver1_ssemul_ss_ps): Ditto.
      	(znver1_ssemul_ss_ps_load): Ditto.
      	(znver1_ssemul_avx256_ps): Ditto.
      	(znver1_ssemul_avx256_ps_load): Ditto.
      	(znver1_ssemul_sd_pd): Ditto.
      	(znver1_ssemul_sd_pd_load): Ditto.
      	(znver2_ssemul_sd_pd): Ditto.
      	(znver2_ssemul_sd_pd_load): Ditto.
      	(znver1_ssemul_avx256_pd): Ditto.
      	(znver1_ssemul_avx256_pd_load): Ditto.
      	(znver1_sseimul): Ditto.
      	(znver1_sseimul_avx256): Ditto.
      	(znver1_sseimul_load): Ditto.
      	(znver1_sseimul_avx256_load): Ditto.
      	(znver1_sseimul_di): Ditto.
      	(znver1_sseimul_load_di): Ditto.
      d4cc7a8c
    • Alexander Monakov's avatar
      i386: correct x87&SSE division modeling in znver.md · dd744f06
      Alexander Monakov authored
      Correct modeling of division instructions in the SIMD/FP domain for
      AMD Zen architectures and avoid combinatorial explosion of automaton
      tables by modeling the separate floating-point division unit and
      correcting reservations to reflect reciprocal throughput of the
      corresponding instructions, similar to earlier commit
      5cee5f94 ("i386: correct integer division modeling in znver.md").
      
      Division is partially pipelined and some instructions have fractional
      throughput (e.g. Zen 3 can issue divss and divsd each 3.5 and 4.5
      cycles on average, respectively). Considering these CPUs implement
      out-of-order execution, the model doesn't need to be exact to the last
      cycle, so simplify it by using 4/5 cycles for SF/DF modes, and not
      modeling the fact that FP3 pipe is occupied for one cycle.
      
      Top znver table sizes in insn-automata.o:
      
      Before:
      
      428108 r znver1_fp_min_issue_delay
      856216 r znver1_fp_transitions
      
      After:
      
      30056 r znver1_fp_min_issue_delay
      120224 r znver1_fp_transitions
      
      gcc/ChangeLog:
      
      	PR target/87832
      	* config/i386/znver.md (znver1_fdiv): New automaton.
      	(znver1-fdiv): New unit.
      	(znver1_fp_op_div): Correct unit and cycles in the reservation.
      	(znver1_fp_op_div_load): Ditto.
      	(znver1_fp_op_idiv_load): Ditto.
      	(znver2_fp_op_idiv_load): Ditto.
      	(znver1_ssediv_ss_ps): Ditto.
      	(znver1_ssediv_ss_ps_load): Ditto.
      	(znver1_ssediv_sd_pd): Ditto.
      	(znver1_ssediv_sd_pd_load): Ditto.
      	(znver1_ssediv_avx256_ps): Ditto.
      	(znver1_ssediv_avx256_ps_load): Ditto.
      	(znver1_ssediv_avx256_pd): Ditto.
      	(znver1_ssediv_avx256_pd_load): Ditto.
      dd744f06
    • Jonathan Wakely's avatar
      libstdc++: Fix std::any pretty printer · 3c54805d
      Jonathan Wakely authored
      The recent changes to FilteringTypePrinter affect the result of
      gdb.lookup_type('std::string') in StdExpAnyPrinter, causing it to always
      return the std::__cxx11::basic_string specialization. This then causes a
      gdb.error exception when trying to lookup the std::any manager type for
      a specliaization using that string, but that manager was never
      instantiated in the program. This causes FAILs when running the tests
      with -D_GLIBCXX_USE_CXX11_ABI=0:
      
      FAIL: libstdc++-prettyprinters/libfundts.cc print as
      FAIL: libstdc++-prettyprinters/libfundts.cc print as
      
      The ugly solution used in this patch is to repeat the lookup for every
      type that std::string could be a typedef for, and hope it only works for
      one of them.
      
      libstdc++-v3/ChangeLog:
      
      	* python/libstdcxx/v6/printers.py (StdExpAnyPrinter): Make
      	expansion of std::string in manager name more robust.
      3c54805d
    • Jonathan Wakely's avatar
      libstdc++: Improve comments on pretty printer code · 92281622
      Jonathan Wakely authored
      libstdc++-v3/ChangeLog:
      
      	* python/libstdcxx/v6/printers.py (is_specialization_of): Fix
      	incorrect terminology in docstring and describe arguments.
      	(FilteringTypePrinter): Add default argument for new parameter,
      	enhance docstring.
      92281622
    • Tobias Burnus's avatar
      gcn: Add __builtin_gcn_kernarg_ptr · 6f83861c
      Tobias Burnus authored
      
      Add __builtin_gcn_kernarg_ptr to avoid using hard-coded register values
      and permit future ABI changes while keeping the API.
      
      gcc/ChangeLog:
      
      	* config/gcn/gcn-builtins.def (KERNARG_PTR): Add.
      	* config/gcn/gcn.cc (gcn_init_builtin_types): Change siptr_type_node,
      	sfptr_type_node and voidptr_type_node from FLAT to ADDR_SPACE_DEFAULT.
      	(gcn_expand_builtin_1): Handle GCN_BUILTIN_KERNARG_PTR.
      	(gcn_oacc_dim_size): Return in ADDR_SPACE_FLAT.
      
      libgomp/ChangeLog:
      
      	* config/gcn/team.c (gomp_gcn_enter_kernel): Use
      	__builtin_gcn_kernarg_ptr instead of asm ("s8").
      
      Co-Authored-By: default avatarAndrew Stubbs <ams@codesourcery.com>
      6f83861c
    • David Malcolm's avatar
      analyzer: use known_function to simplify region_model::on_call_{pre,post} · 21501ec7
      David Malcolm authored
      
      Replace lots of repeated checks against strings with a hash_map lookup.
      Add some missing type-checking for handling known functions (e.g. checks
      for pointer types).
      
      gcc/analyzer/ChangeLog:
      	* analyzer.h (known_function::matches_call_types_p): New vfunc.
      	(known_function::impl_call_pre): Provide base implementation.
      	(known_function::impl_call_post): New vfunc.
      	(register_known_functions): New.
      	* engine.cc (impl_run_checkers): Call register_known_functions.
      	* region-model-impl-calls.cc (region_model::impl_call_accept):
      	Convert to...
      	(class known_function_accept): ...this.
      	(region_model::impl_call_bind): Convert to...
      	(class known_function_bind): ...this.
      	(region_model::impl_call_connect): Convert to...
      	(class known_function_connect): ...this.
      	(region_model::impl_call_listen): Convert to...
      	(class known_function_listen): ...this.
      	(region_model::impl_call_socket): Convert to...
      	(class known_function_socket): ...this.
      	(register_known_functions): New.
      	* region-model.cc (region_model::on_call_pre): Remove special
      	case for "bind" in favor of the known_function-handling dispatch.
      	Add call to known_function::matches_call_types_p to latter.
      	(region_model::on_call_post): Remove special cases for "accept",
      	"bind", "connect", "listen", and "socket" in favor of dispatch
      	to known_function::impl_call_post.
      	* region-model.h (region_model::impl_call_accept): Delete decl.
      	(region_model::impl_call_bind): Delete decl.
      	(region_model::impl_call_connect): Delete decl.
      	(region_model::impl_call_listen): Delete decl.
      	(region_model::impl_call_socket): Delete decl.
      	* sm-fd.cc: Update comments.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/plugin/analyzer_kernel_plugin.c
      	(copy_across_boundary_fn::matches_call_types_p): New.
      	* gcc.dg/plugin/analyzer_known_fns_plugin.c
      	(known_function_returns_42::matches_call_types_p): New.
      	(known_function_attempt_to_copy::matches_call_types_p): New.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      21501ec7
    • David Malcolm's avatar
      analyzer: split out checker-path.cc into a new checker-event.cc · 3685aed8
      David Malcolm authored
      
      gcc/ChangeLog:
      	* Makefile.in (ANALYZER_OBJS): Add analyzer/checker-event.o.
      
      gcc/analyzer/ChangeLog:
      	* checker-event.cc: New file, split out from...
      	* checker-path.cc: ...this file.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      3685aed8
    • Max Filippov's avatar
      gcc: m68k: fix PR target/107645 · 99c9cbcc
      Max Filippov authored
      gcc/
      	PR target/107645
      	* config/m68k/predicates.md (symbolic_operand): Return false
      	when UNSPEC is under the CONST node.
      99c9cbcc
    • Christoph Müllner's avatar
      doc: invoke: pru/riscv: Fix option list formatting · f58e6d42
      Christoph Müllner authored
      This patch fixes a wrong placed closing bracket in the RISC-V option
      list and an unneeded @gol in the PRU option list in invoke.texi.
      
      gcc/ChangeLog:
      
      	* doc/invoke.texi: Fix PRU/RISC-V option list formatting.
      f58e6d42
    • Jakub Jelinek's avatar
      c++: Implement CWG 2654 - Un-deprecation of compound volatile assignments · 13602905
      Jakub Jelinek authored
      The following patch implements CWG 2654.
      
      2022-11-16  Jakub Jelinek  <jakub@redhat.com>
      
      	* typeck.cc (cp_build_modify_expr): Implement CWG 2654
      	- Un-deprecation of compound volatile assignments.  Remove
      	-Wvolatile warning about compound volatile assignments.
      
      	* g++.dg/cpp2a/volatile1.C (fn2, fn3, racoon): Adjust expected
      	diagnostics.
      	* g++.dg/cpp2a/volatile3.C (fn2, fn3, racoon): Likewise.
      	* g++.dg/cpp2a/volatile5.C (f): Likewise.
      	* g++.dg/ext/vector25.C (foo): Don't expect a warning.
      	* g++.dg/cpp1y/new1.C (test_unused): Likewise.
      13602905
    • Tobias Burnus's avatar
      nvptx/mkoffload.cc: Fix "$nohost" check · d59858f6
      Tobias Burnus authored
      If lhd_set_decl_assembler_name is invoked - in particular if
      !TREE_PUBLIC (decl) && !DECL_FILE_SCOPE_P (decl) - the '.nohost' suffix
      might change to '.nohost.2'. This happens for the existing reverse offload
      testcases via cgraph_node::analyze and is a side effect of
      r13-3455-g178ac530fe67e4f2fc439cc4ce89bc19d571ca31 for some reason.
      
      The solution is to not only check for a tailing '$nohost' but also for
      '$nohost$' in nvptx/mkoffload.cc.
      
      gcc/ChangeLog:
      
      	* config/nvptx/mkoffload.cc (process): Recognize '$nohost$...'
      	besides tailing '$nohost' as being for reverse offload.
      d59858f6
    • Jakub Jelinek's avatar
      c++: Allow attributes on concepts - DR 2428 · 7f014022
      Jakub Jelinek authored
      The following patch adds parsing of attributes to concept definition,
      allows deprecated attribute to be specified (as CONCEPT_DECL now needs
      to be checked in c-family/c-attribs.cc, I had to move its declaration
      from cp/*.def to c-family/*.def) and checks TREE_DEPRECATED in
      build_standard_check (not sure if that is the right spot, or whether
      it shouldn't be checked also for variable and function concepts and
      how to write testcase coverage for that).
      
      2022-11-16  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/c-family/
      	* c-common.def (CONCEPT_DECL): New tree, moved here from
      	cp-tree.def.
      	* c-common.cc (c_common_init_ts): Handle CONCEPT_DECL.
      	* c-attribs.cc (handle_deprecated_attribute): Allow deprecated
      	attribute on CONCEPT_DECL.
      gcc/cp/
      	* cp-tree.def (CONCEPT_DECL): Move to c-common.def.
      	* cp-objcp-common.cc (cp_common_init_ts): Don't handle CONCEPT_DECL
      	here.
      	* cp-tree.h (finish_concept_definition): Add ATTRS parameter.
      	* parser.cc (cp_parser_concept_definition): Parse attributes in
      	between identifier and =.  Adjust finish_concept_definition
      	caller.
      	* pt.cc (finish_concept_definition): Add ATTRS parameter.  Call
      	cplus_decl_attributes.
      	* constraint.cc (build_standard_check): If CONCEPT_DECL is
      	TREE_DEPRECATED, emit -Wdeprecated-declaration warnings.
      gcc/testsuite/
      	* g++.dg/cpp2a/concepts-dr2428.C: New test.
      7f014022
    • Jakub Jelinek's avatar
      ragen-op-float: Fix up float_binary_op_range_finish [PR107668] · 7c6cd9c0
      Jakub Jelinek authored
      The following testcase ICEs, because when !HONOR_NANS but
      HONOR_SIGNED_ZEROS, if we see
      lhs = op1 * op2;
      and know that lhs is [-0.0, 0.0] and op2 is [0.0, 0.0], the
      division of these two yields UNDEFINED and clear_nan () on it
      fails an assert.  With HONOR_NANS it would actually result in
      a known NAN, but when NANs aren't honored, we clear the NAN bits.
      Now, for the above case we actually don't know anything about
      the op1 range (except that it isn't a NAN/INF because of
      !HONOR_NANS !HONOR_INFINITIES), so I think the best is just
      to return VARYING for the case we get UNDEFINED as well.
      
      If we want, the op[12]_range methods perhaps can handle the
      corner cases earlier separately, say for
      lhs [0.0, 0.0] and op2 [0.0, 0.0] when HONOR_SIGNED_ZEROS this
      would be just [0.0, MAX].
      
      2022-11-16  Jakub Jelinek  <jakub@redhat.com>
      
      	PR tree-optimization/107668
      	* range-op-float.cc (float_binary_op_range_finish): Set VARYING
      	also when r is UNDEFINED.
      
      	* gcc.dg/ubsan/pr107668.c: New test.
      7c6cd9c0
    • François Dumont's avatar
      libstdc++: Fix gdb FilteringTypePrinter · 2b7f0378
      François Dumont authored
      Once we found a matching FilteringTypePrinter instance we look for the associated
      typedef and check that the returned Python Type is equal to the Type to recognize.
      But gdb Python Type includes properties to distinguish a typedef from the actual
      type. So use gdb.types.get_basic_type to check if we are indeed on the same type.
      
      Additionnaly enhance FilteringTypePrinter matching mecanism by introducing targ1 that,
      if not None, will be used as the 1st template parameter.
      
      libstdc++-v3/ChangeLog:
      
      	* python/libstdcxx/v6/printers.py (FilteringTypePrinter): Rename 'match' field
      	'template'. Add self.targ1 to specify the first template parameter of the instantiation
      	to match.
      	(add_one_type_printer): Add targ1 optional parameter, default to None.
      	Use gdb.types.get_basic_type to compare the type to recognize and the type
      	returned from the typedef lookup.
      	(register_type_printers): Adapt calls to add_one_type_printers.
      2b7f0378
    • Kewen Lin's avatar
      rtl: Try to remove EH edges after {pro,epi}logue generation [PR90259] · 63e1b2e7
      Kewen Lin authored
      After prologue and epilogue generation, the judgement on whether
      one memory access onto stack frame may trap or not could change,
      since we get more exact stack information by now.
      
      As PR90259 shows, some memory access becomes impossible to trap
      any more after prologue and epilogue generation, it can make
      subsequent optimization be able to remove it if safe, but it
      results in unexpected control flow status due to REG_EH_REGION
      note missing.
      
      This patch proposes to try to remove EH edges with function
      purge_all_dead_edges after prologue and epilogue generation,
      it simplifies CFG as early as we can and don't need any fixup
      in downstream passes.
      
      CFG simplification result with PR90259's case as example:
      
      *before*
      
         18: %1:TF=call [`__gcc_qdiv'] argc:0
            REG_EH_REGION 0x2
         77: NOTE_INSN_BASIC_BLOCK 3
         19: NOTE_INSN_DELETED
         20: NOTE_INSN_DELETED
        110: [%31:SI+0x20]=%1:DF
            REG_EH_REGION 0x2
        116: NOTE_INSN_BASIC_BLOCK 4
        111: [%31:SI+0x28]=%2:DF
            REG_EH_REGION 0x2
         22: NOTE_INSN_BASIC_BLOCK 5
        108: %0:DF=[%31:SI+0x20]
            REG_EH_REGION 0x2
        117: NOTE_INSN_BASIC_BLOCK 6
        109: %1:DF=[%31:SI+0x28]
            REG_EH_REGION 0x2
         79: NOTE_INSN_BASIC_BLOCK 7
         26: [%31:SI+0x18]=%0:DF
        104: pc=L69
        105: barrier
      
      *after*
      
         18: %1:TF=call [`__gcc_qdiv'] argc:0
            REG_EH_REGION 0x2
         77: NOTE_INSN_BASIC_BLOCK 3
         19: NOTE_INSN_DELETED
         20: NOTE_INSN_DELETED
        110: [%31:SI+0x20]=%1:DF
        111: [%31:SI+0x28]=%2:DF
        108: %0:DF=[%31:SI+0x20]
        109: %1:DF=[%31:SI+0x28]
         26: [%31:SI+0x18]=%0:DF
        104: pc=L69
        105: barrier
      
      	PR rtl-optimization/90259
      
      gcc/ChangeLog:
      
      	* function.cc (rest_of_handle_thread_prologue_and_epilogue): Add
      	parameter fun, and call function purge_all_dead_edges.
      	(pass_thread_prologue_and_epilogue::execute): Name unamed parameter
      	as fun, and use it for rest_of_handle_thread_prologue_and_epilogue.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.target/powerpc/pr90259.C: New.
      63e1b2e7
    • GCC Administrator's avatar
      Daily bump. · cdc34229
      GCC Administrator authored
      cdc34229
  2. Nov 15, 2022
    • Marek Polacek's avatar
      c++: Disable -Wignored-qualifiers for template args [PR107492] · ed1797dd
      Marek Polacek authored
      It seems wrong to issue a -Wignored-qualifiers warning for code like:
      
        static_assert(!is_same_v<void(*)(), const void(*)()>);
      
      because there the qualifier matters.  Likewise in template
      specialization:
      
        template<typename T> struct S { };
        template<> struct S<void(*)()> { };
        template<> struct S<const void(*)()> { }; // OK, not a redefinition
      
      And likewise in other type-id contexts such as trailing-return-type:
      
        auto g() -> const void (*)();
      
      This patch limits the warning to the function declaration context only.
      
      	PR c++/107492
      
      gcc/cp/ChangeLog:
      
      	* decl.cc (grokdeclarator): Only emit a -Wignored-qualifiers warning
      	when funcdecl_p.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/warn/Wignored-qualifiers3.C: New test.
      ed1797dd
    • Philipp Tomsich's avatar
      RISC-V: Zihintpause: add __builtin_riscv_pause · c717a92d
      Philipp Tomsich authored
      The Zihintpause extension uses an opcode from the 'fence' opcode range
      to add a true hint instruction (i.e. if it is not supported on any
      given platform, the 'fence' that is encoded will not enforce any
      specific ordering on memory accesses) for entering a low-power state
      (e.g. in an idle thread).  We expose this new instruction through a
      machine-dependent builtin to allow generating it without a requirement
      for any inline assembly.
      
      Given that the encoding of 'pause' is valid (as a 'fence' encoding)
      even for processors that do not (yet) support Zihintpause, we make
      this builtin available without any further TARGET_* constraints.
      
      gcc/ChangeLog:
      
      	* config/riscv/riscv-builtins.cc (struct riscv_builtin_description):
      	add the pause machine-dependent builtin with no result and no
      	arguments; mark it as always present (pause is a true hint
      	that encodes into a fence-insn, if not supported with the new
      	pause semantics).
      	* config/riscv/riscv-ftypes.def: Add type for void -> void.
      	* config/riscv/riscv.md (riscv_pause): Add risc_pause and
      	UNSPECV_PAUSE
      	* doc/extend.texi: Document __builtin_riscv_pause.
      	* optabs.cc (maybe_gen_insn): Allow nops == 0 (void -> void).
      
      gcc/testsuite/ChangeLog:
      
      	* gcc.target/riscv/builtin_pause.c: New test.
      c717a92d
    • David Faust's avatar
      bpf: avoid possible use of uninitialized variable · 6052482f
      David Faust authored
      Fix a maybe-uninitialized warning introduced in commit:
      068baae1 bpf: add preserve_field_info builtin
      
      gcc/
      
      	* config/bpf/bpf.cc (bpf_expand_builtin): Avoid use of uninitialized
      	variable in error case.
      6052482f
    • David Malcolm's avatar
      analyzer: add warnings relating to sockets [PR106140] · 86a90006
      David Malcolm authored
      
      This patch generalizes the analyzer's file descriptor state machine
      so that it tracks the states of sockets.
      
      It adds two new warnings relating to misuses of socket APIs:
      * -Wanalyzer-fd-phase-mismatch (e.g. calling 'accept' on a socket
      before calling 'listen' on it)
      * -Wanalyzer-fd-type-mismatch (e.g. using a stream socket operation
      on a datagram socket)
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/106140
      	* analyzer-language.cc (on_finish_translation_unit): Stash named
      	constants "SOCK_STREAM" and "SOCK_DGRAM".
      	* analyzer.opt (Wanalyzer-fd-phase-mismatch): New.
      	(Wanalyzer-fd-type-mismatch): New.
      	* engine.cc (impl_region_model_context::get_state_map_by_name):
      	Add "out_sm_context" param.  Allow out_sm_idx to be NULL.
      	* exploded-graph.h
      	(impl_region_model_context::get_state_map_by_name):
      	Add "out_sm_context" param.
      	* region-model-impl-calls.cc (region_model::impl_call_accept): New.
      	(region_model::impl_call_bind): New.
      	(region_model::impl_call_connect): New.
      	(region_model::impl_call_listen): New.
      	(region_model::impl_call_socket): New.
      	* region-model.cc (region_model::on_call_pre): Special-case
      	"bind".
      	(region_model::on_call_post): Special-case "accept", "bind",
      	"connect", "listen", and "socket".
      	* region-model.h (region_model::impl_call_accept): New decl.
      	(region_model::impl_call_bind): New decl.
      	(region_model::impl_call_connect): New decl.
      	(region_model::impl_call_listen): New decl.
      	(region_model::impl_call_socket): New decl.
      	(region_model::on_socket): New decl.
      	(region_model::on_bind): New decl.
      	(region_model::on_listen): New decl.
      	(region_model::on_accept): New decl.
      	(region_model::on_connect): New decl.
      	(region_model::add_constraint): Make public.
      	(region_model::check_for_poison): Make public.
      	(region_model_context::get_state_map_by_name): Add out_sm_context param.
      	(region_model_context::get_fd_map): Likewise.
      	(region_model_context::get_malloc_map): Likewise.
      	(region_model_context::get_taint_map): Likewise.
      	(noop_region_model_context::get_state_map_by_name): Likewise.
      	(region_model_context_decorator::get_state_map_by_name): Likewise.
      	* sm-fd.cc: Include "analyzer/supergraph.h" and
      	"analyzer/analyzer-language.h".
      	(enum expected_phase): New enum.
      	(fd_state_machine::m_new_datagram_socket): New.
      	(fd_state_machine::m_new_stream_socket): New.
      	(fd_state_machine::m_new_unknown_socket): New.
      	(fd_state_machine::m_bound_datagram_socket): New.
      	(fd_state_machine::m_bound_stream_socket): New.
      	(fd_state_machine::m_bound_unknown_socket): New.
      	(fd_state_machine::m_listening_stream_socket): New.
      	(fd_state_machine::m_m_connected_stream_socket): New.
      	(fd_state_machine::m_SOCK_STREAM): New.
      	(fd_state_machine::m_SOCK_DGRAM): New.
      	(fd_diagnostic::describe_state_change): Handle socket states.
      	(fd_diagnostic::get_meaning_for_state_change): Likewise.
      	(class fd_phase_mismatch): New.
      	(enum expected_type): New enum.
      	(class fd_type_mismatch): New.
      	(fd_state_machine::fd_state_machine): Initialize new states and
      	stashed named constants.
      	(fd_state_machine::is_socket_fd_p): New.
      	(fd_state_machine::is_datagram_socket_fd_p): New.
      	(fd_state_machine::is_stream_socket_fd_p): New.
      	(fd_state_machine::on_close): Handle the socket states.
      	(fd_state_machine::check_for_open_fd): Complain about fncalls on
      	sockets in the wrong phase.  Support socket FDs.
      	(add_constraint_ge_zero): New.
      	(fd_state_machine::get_state_for_socket_type): New.
      	(fd_state_machine::on_socket): New.
      	(fd_state_machine::check_for_socket_fd): New.
      	(fd_state_machine::check_for_new_socket_fd): New.
      	(fd_state_machine::on_bind): New.
      	(fd_state_machine::on_listen): New.
      	(fd_state_machine::on_accept): New.
      	(fd_state_machine::on_connect): New.
      	(fd_state_machine::can_purge_p): Don't purge socket values.
      	(get_fd_state): New.
      	(region_model::mark_as_valid_fd): Use get_fd_state.
      	(region_model::on_socket): New.
      	(region_model::on_bind): New.
      	(region_model::on_listen): New.
      	(region_model::on_accept): New.
      	(region_model::on_connect): New.
      	* sm-fd.dot: Update to reflect sm-fd.cc changes.
      
      gcc/ChangeLog:
      	PR analyzer/106140
      	* doc/invoke.texi (Static Analyzer Options): Add
      	-Wanalyzer-fd-phase-mismatch and -Wanalyzer-fd-type-mismatch.  Add
      	"socket", "bind", "listen", "accept", and "connect" to the list of
      	functions known to the analyzer.
      
      gcc/testsuite/ChangeLog:
      	PR analyzer/106140
      	* gcc.dg/analyzer/fd-accept.c: New test.
      	* gcc.dg/analyzer/fd-bind.c: New test.
      	* gcc.dg/analyzer/fd-connect.c: New test.
      	* gcc.dg/analyzer/fd-datagram-socket.c: New test.
      	* gcc.dg/analyzer/fd-glibc-byte-stream-connection-server.c: New test.
      	* gcc.dg/analyzer/fd-glibc-byte-stream-socket.c: New test.
      	* gcc.dg/analyzer/fd-glibc-datagram-client.c: New test.
      	* gcc.dg/analyzer/fd-glibc-datagram-socket.c: New test.
      	* gcc.dg/analyzer/fd-glibc-make_named_socket.h: New test.
      	* gcc.dg/analyzer/fd-listen.c: New test.
      	* gcc.dg/analyzer/fd-manpage-getaddrinfo-client.c: New test.
      	* gcc.dg/analyzer/fd-mappage-getaddrinfo-server.c: New test.
      	* gcc.dg/analyzer/fd-socket-meaning.c: New test.
      	* gcc.dg/analyzer/fd-socket-misuse.c: New test.
      	* gcc.dg/analyzer/fd-stream-socket-active-open.c: New test.
      	* gcc.dg/analyzer/fd-stream-socket-passive-open.c: New test.
      	* gcc.dg/analyzer/fd-stream-socket.c: New test.
      	* gcc.dg/analyzer/fd-symbolic-socket.c: New test.
      	* gcc.dg/analyzer/pr104369-1.c: Add -Wno-analyzer-too-complex and
      	-Wno-analyzer-fd-leak to options.
      	* gcc.dg/analyzer/pr104369-2.c: Add -Wno-analyzer-fd-leak to
      	options.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      86a90006
    • David Malcolm's avatar
      c, analyzer: support named constants in analyzer [PR106302] · d8aba860
      David Malcolm authored
      The analyzer's file-descriptor state machine tracks the access mode of
      opened files, so that it can emit -Wanalyzer-fd-access-mode-mismatch.
      
      To do this, its symbolic execution needs to "know" the values of the
      constants "O_RDONLY", "O_WRONLY", and "O_ACCMODE".  Currently
      analyzer/sm-fd.cc simply uses these values directly from the build-time
      header files, but these are the values on the host, not those from the
      target, which could be different (PR analyzer/106302).
      
      In an earlier discussion of this issue:
        https://gcc.gnu.org/pipermail/gcc/2022-June/238954.html
      
      
      we talked about adding a target hook for this.
      
      However, I've also been experimenting with extending the fd state
      machine to track sockets (PR analyzer/106140).  For this, it's useful to
      "know" the values of the constants "SOCK_STREAM" and "SOCK_DGRAM".
      Unfortunately, these seem to have many arbitrary differences from target
      to target.
      
      For example: Linux/glibc general has SOCK_STREAM == 1, SOCK_DGRAM == 2,
      as does AIX, but annoyingly, e.g. Linux on MIPS has them the other way
      around.
      
      It seems to me that as the analyzer grows more ambitious modeling of the
      behavior of APIs (perhaps via plugins) it's more likely that the
      analyzer will need to know the values of named constants, which might
      not even exist on the host.
      
      For example, at LPC it was suggested to me that -fanalyzer could check
      rules about memory management inside the Linux kernel (probably via a
      plugin), but doing so involves a bunch of GFP_* flags (see PR 107472).
      
      So rather than trying to capture all this knowledge in a target hook,
      this patch attempts to get at named constant values from the user's
      source code.
      
      The patch adds an interface for frontends to call into the analyzer as
      the translation unit finishes.  The analyzer can then call back into the
      frontend to ask about the values of the named constants it cares about
      whilst the frontend's data structures are still around.
      
      The patch implements this for the C frontend, which looks up the names
      by looking for named CONST_DECLs (which handles enum values).  Failing
      that, it attempts to look up the values of macros but only the simplest
      cases are supported (a non-traditional macro with a single CPP_NUMBER
      token).  It does this by building a buffer containing the macro
      definition and rerunning a lexer on it.
      
      The analyzer gracefully handles the cases where named values aren't
      found (such as anything more complicated than described above).
      
      The patch ports the analyzer to use this mechanism for "O_RDONLY",
      "O_WRONLY", and "O_ACCMODE".  I have successfully tested my socket patch
      to also use this for "SOCK_STREAM" and "SOCK_DGRAM", so the technique
      seems to work.
      
      gcc/ChangeLog:
      	PR analyzer/106302
      	* Makefile.in (ANALYZER_OBJS): Add analyzer/analyzer-language.o.
      	(GTFILES): Add analyzer/analyzer-language.cc.
      	* doc/analyzer.texi: Document __analyzer_dump_named_constant.
      
      gcc/analyzer/ChangeLog:
      	PR analyzer/106302
      	* analyzer-language.cc: New file.
      	* analyzer-language.h: New file.
      	* analyzer.h (get_stashed_constant_by_name): New decl.
      	(log_stashed_constants): New decl.
      	* engine.cc (impl_run_checkers): Call log_stashed_constants.
      	* region-model-impl-calls.cc
      	(region_model::impl_call_analyzer_dump_named_constant): New.
      	* region-model.cc (region_model::on_stmt_pre): Handle
      	__analyzer_dump_named_constant.
      	* region-model.h
      	(region_model::impl_call_analyzer_dump_named_constant): New decl.
      	* sm-fd.cc (fd_state_machine::m_O_ACCMODE): New.
      	(fd_state_machine::m_O_RDONLY): New.
      	(fd_state_machine::m_O_WRONLY): New.
      	(fd_state_machine::fd_state_machine): Initialize the new fields.
      	(fd_state_machine::get_access_mode_from_flag): Use the new fields,
      	rather than using the host values.
      
      gcc/c/ChangeLog:
      	PR analyzer/106302
      	* c-parser.cc: Include "analyzer/analyzer-language.h" and "toplev.h".
      	(class ana::c_translation_unit): New.
      	(c_parser_translation_unit): Call ana::on_finish_translation_unit.
      
      gcc/testsuite/ChangeLog:
      	* gcc.dg/analyzer/analyzer-decls.h
      	(__analyzer_dump_named_constant): New decl.
      	* gcc.dg/analyzer/fd-4.c (void): Likewise.
      	(O_ACCMODE): Define.
      	* gcc.dg/analyzer/fd-access-mode-enum.c: New test, based on .
      	* gcc.dg/analyzer/fd-5.c: ...this.  Rename to...
      	* gcc.dg/analyzer/fd-access-mode-macros.c: ...this.
      	(O_ACCMODE): Define.
      	* gcc.dg/analyzer/fd-access-mode-target-headers.c: New test, also
      	based on fd-5.c.
      	(test_sm_fd_constants): New.
      	* gcc.dg/analyzer/fd-dup-1.c (O_ACCMODE): Define.
      	* gcc.dg/analyzer/named-constants-via-enum.c: New test.
      	* gcc.dg/analyzer/named-constants-via-enum-and-macro.c: New test.
      	* gcc.dg/analyzer/named-constants-via-macros-2.c: New test.
      	* gcc.dg/analyzer/named-constants-via-macros.c: New test.
      
      Signed-off-by: default avatarDavid Malcolm <dmalcolm@redhat.com>
      d8aba860
    • Nathan Sidwell's avatar
      demangler: Templated lambda demangling · 46c3d9c8
      Nathan Sidwell authored
      Templated lambdas have a template-head, which is part of their
      signature.  GCC ABI 18 mangles that into the lambda name.  This adds
      support to the demangler.  We have to introduce artificial template
      parameter names, as we need to refer to them from later components of
      the lambda signature. We use $T:n, $N:n and $TT:n for type, non-type
      and template parameters.  Non-type parameter names are not shown in
      the strictly correct location -- for instance 'int (&NT) ()' would be
      shown as 'int (&) $N:n'.  That's unfortunate, but an orthogonal issue.
      The 'is_lambda_arg' field is now repurposed as indicating the number
      of explicit template parameters (1-based).
      
      	include/
      	* demangle.h (enum demangle_component_type): Add
      	DEMANGLE_COMPONENT_TEMPLATE_HEAD,
      	DEMANGLE_COMPONENT_TEMPLATE_TYPE_PARM,
      	DEMANGLE_COMPONENT_TEMPLATE_NON_TYPE_PARM,
      	DEMANGLE_COMPONENT_TEMPLATE_TEMPLATE_PARM,
      	DEMANGLE_COMPONENT_TEMPLATE_PACK_PARM.
      	libiberty/
      	* cp-demangle.c (struct d_print_info): Rename is_lambda_arg to
      	lambda_tpl_parms.  Augment semantics.
      	(d_make_comp): Add checks for new components.
      	(d_template_parm, d_template_head): New.
      	(d_lambda): Add templated lambda support.
      	(d_print_init): Adjust.
      	(d_print_lambda_parm_name): New.
      	(d_print_comp_inner): Support templated lambdas,
      	* testsuite/demangle-expected: Add testcases.
      46c3d9c8
Loading