Re: [PATCH v2] c++: Support target-specific nodes with streaming [PR98645,PR111224]

2024-03-12 Thread Jason Merrill
On 3/12/24 08:21, Nathaniel Shead wrote: On Tue, Mar 12, 2024 at 11:11:40PM +1100, Nathaniel Shead wrote: On Mon, Mar 11, 2024 at 10:36:06AM -0400, Patrick Palka wrote: On Sun, 10 Mar 2024, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu and aarch64-unknown-linux-gnu,

Re: [PATCH] c++: ICE with temporary of class type in array DMI [PR109966]

2024-03-12 Thread Jason Merrill
On 3/11/24 19:27, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13? -- >8 -- This ICE started with the fairly complicated r13-765. We crash in gimplify_var_or_parm_decl because a stray VAR_DECL leaked there. The problem is ultimately that potential_prvalue_res

Re: [PATCH] c++: recalculating local specs via build_extra_args [PR114303]

2024-03-12 Thread Jason Merrill
On 3/11/24 12:53, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk and release branches? -- >8 -- r13-6452-g341e6cd8d603a3 made build_extra_args walk evaluated contexts first so that we prefer processing a local specialization in an evaluated c

Re: [PATCH v2] c++: ICE with temporary of class type in array DMI [PR109966]

2024-03-12 Thread Jason Merrill
On 3/12/24 11:56, Marek Polacek wrote: On Tue, Mar 12, 2024 at 09:57:14AM -0400, Jason Merrill wrote: On 3/11/24 19:27, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13? -- >8 -- This ICE started with the fairly complicated r13-765. We crash

Re: [PATCH] c++: explicit inst of template method not generated [PR110323]

2024-03-14 Thread Jason Merrill
On 3/8/24 12:02, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Consider constexpr int VAL = 1; struct foo { template void bar(typename std::conditional::type arg) { } }; template void foo::bar<1>(int arg); where we since r

[PATCH RFA] tree-core: clarify clobber comments

2024-03-14 Thread Jason Merrill
OK for trunk? -- 8< -- It came up on the mailing list that OBJECT_BEGIN/END are described as marking object lifetime, but mark the beginning of the constructor and end of the destructor, whereas the C++ notion of lifetime is between the end of the constructor and beginning of the destructor. So

Re: [PATCH v3] c++: Fix handling of no-linkage decls for modules

2024-03-18 Thread Jason Merrill
On 3/16/24 07:23, Nathaniel Shead wrote: On Mon, Mar 11, 2024 at 02:13:34PM -0400, Jason Merrill wrote: On 3/8/24 18:18, Nathaniel Shead wrote: On Fri, Mar 08, 2024 at 10:19:52AM -0500, Jason Merrill wrote: On 3/7/24 21:55, Nathaniel Shead wrote: On Mon, Nov 27, 2023 at 03:59:39PM +1100

Re: [PATCH] c++: explicit inst of template method not generated [PR110323]

2024-03-18 Thread Jason Merrill
On 3/15/24 13:48, Marek Polacek wrote: On Thu, Mar 14, 2024 at 03:39:04PM -0400, Jason Merrill wrote: On 3/8/24 12:02, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Consider constexpr int VAL = 1; struct foo { templ

Re: [PATCH] c++: direct-init of an array of class type [PR59465]

2024-03-20 Thread Jason Merrill
On 3/1/24 19:58, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? I don't claim that this has to go to 14 though. -- >8 -- ...from another array in a mem-initializer should not be accepted. We already reject struct string {} a[1]; string x[1](a); but

Re: [PATCH v2] c++: explicit inst of template method not generated [PR110323]

2024-03-20 Thread Jason Merrill
On 3/19/24 15:30, Marek Polacek wrote: On Mon, Mar 18, 2024 at 09:10:27PM -0400, Jason Merrill wrote: On 3/15/24 13:48, Marek Polacek wrote: On Thu, Mar 14, 2024 at 03:39:04PM -0400, Jason Merrill wrote: On 3/8/24 12:02, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok

Re: [PATCH] c++: ICE with noexcept and local specialization, again [PR114349]

2024-03-21 Thread Jason Merrill
On 3/21/24 17:01, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Patrick noticed that my r14-9339-gdc6c3bfb59baab patch is wrong; we're dealing with a noexcept-spec there, not a noexcept-expr, so setting cp_noexcept_operand et al is incorrect. Back to

Re: [PATCH v2] c++: direct-init of an array of class type [PR59465]

2024-03-21 Thread Jason Merrill
On 3/21/24 16:48, Marek Polacek wrote: On Wed, Mar 20, 2024 at 09:21:02PM -0400, Jason Merrill wrote: On 3/1/24 19:58, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? I don't claim that this has to go to 14 though. -- >8 -- ...from another array

Re: [PATCH v2] c++: ICE with noexcept and local specialization, again [PR114349]

2024-03-25 Thread Jason Merrill
On 3/22/24 17:30, Marek Polacek wrote: On Thu, Mar 21, 2024 at 05:27:37PM -0400, Jason Merrill wrote: On 3/21/24 17:01, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Patrick noticed that my r14-9339-gdc6c3bfb59baab patch is wrong; we're

Re: [PATCH] c-family, c++: Handle EXCESS_PRECISION_EXPR in pretty printers

2024-03-25 Thread Jason Merrill
On 3/22/24 05:11, Jakub Jelinek wrote: Hi! I've noticed that the c-c++-common/gomp/depobj-3.c test FAILs on i686-linux: PASS: c-c++-common/gomp/depobj-3.c -std=c++17 at line 17 (test for warnings, line 15) FAIL: c-c++-common/gomp/depobj-3.c -std=c++17 at line 39 (test for warnings, line 37

Re: [PATCH] c++: broken direct-init with trailing array member [PR114439]

2024-03-25 Thread Jason Merrill
On 3/25/24 17:59, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? OK. -- >8 -- can_init_array_with_p is wrongly saying that the init for 's' here: struct S { int *list = arr; int arr[]; }; struct A { A() {} S s[2]{}; }; is i

[PATCH] c++: __is_constructible ref binding [PR100667]

2024-03-28 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- The requirement that a type argument be complete is excessive in the case of direct reference binding to the same type, which does not rely on any properties of the type. This is LWG 2939. PR c++/100667 gcc/cp/ChangeLog:

[pushed] c++: C++26 returning reference to temporary

2024-04-01 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- P2748R5 makes it ill-formed to return a reference to temporary in C++26; implementing this is a simple matter of changing the existing warning to a permerror. For most of the tests I just changed dg-warning to dg-message to accept both; I t

Re: [PATCH] c++: make __is_array return false for T[0] [PR114479]

2024-04-02 Thread Jason Merrill
On 4/1/24 13:50, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- When we switched to using the __is_array built-in trait to implement std::is_array in r14-6623-g7fd9c349e45534, we started saying that T[0] is an array. There are various opinions as to w

Re: [PATCH] c++: ICE with scoped enum in switch condition [PR114451]

2024-04-02 Thread Jason Merrill
On 3/29/24 18:31, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13? OK. -- >8 -- Here we ICE when gimplifying enum class Type { Pawn }; struct Piece { Type type : 4; }; void foo() { switch (Piece().type) case Type::Pawn:; }

Re: [PATCH] c++: Keep DECL_SAVED_TREE of destructor instantiations in modules [PR104040]

2024-04-02 Thread Jason Merrill
On 3/28/24 23:21, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- A template instantiation still needs to have its DECL_SAVED_TREE so that its definition is emitted into the CMI. This way it can be emitted in the object file of any importers that

[pushed] c++: binding reference to comma expr [PR114561]

2024-04-02 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- We represent a reference binding where the referent type is more qualified by a ck_ref_bind around a ck_qual. We performed the ck_qual and then tried to undo it with STRIP_NOPS, but that doesn't work if the conversion is buried in COMPOUND_

Re: [PATCH] c++: Keep DECL_SAVED_TREE of destructor instantiations in modules [PR104040]

2024-04-03 Thread Jason Merrill
On 4/2/24 20:57, Nathaniel Shead wrote: On Tue, Apr 02, 2024 at 01:18:17PM -0400, Jason Merrill wrote: On 3/28/24 23:21, Nathaniel Shead wrote: - && !(modules_p () && DECL_DECLARED_INLINE_P (fn))) + && !(modules_p () + &&

Re: [PATCH] c++: Implement C++26 P2809R3 - Trivial infinite loops are not Undefined Behavior

2024-04-03 Thread Jason Merrill
On 4/3/24 03:25, Jakub Jelinek wrote: Hi! The following patch attempts to implement P2809R3, which has been voted in as a DR. The middle-end has its behavior documented: '-ffinite-loops' Assume that a loop with an exit will eventually take the exit and not loop indefinitely. This a

Re: [PATCH] c++: Implement C++26 P2809R3 - Trivial infinite loops are not Undefined Behavior

2024-04-03 Thread Jason Merrill
On 4/3/24 12:42, Jakub Jelinek wrote: On Wed, Apr 03, 2024 at 12:07:48PM -0400, Jason Merrill wrote: Using std::is_constant_evaluated directly in a loop condition is, as the paper says, unlikely and "horrendous code", so I'm not concerned about surprising effects, though I guess

Re: [PATCH] c++: constexpr error with fn redecl in local scope [PR111132]

2024-04-03 Thread Jason Merrill
On 4/2/24 13:52, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13? -- >8 -- We evaluate constexpr functions on the original, pre-genericization bodies. That means that the function body we're evaluating will not have gone through cp_genericize_r's "Map block sc

Re: [PATCH] c++/modules: Prefer partition indexes when installing imported entities [PR99377]

2024-04-03 Thread Jason Merrill
On 3/28/24 08:22, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- The testcase in comment 15 of the linked PR is caused because the following assumption in depset::hash::make_dependency doesn't hold: if (DECL_LANG_SPECIFIC (not_tmpl) &

Re: [PATCH] c++: Implement C++26 P2809R3 - Trivial infinite loops are not Undefined Behavior

2024-04-03 Thread Jason Merrill
On 4/3/24 15:16, Jakub Jelinek wrote: On Wed, Apr 03, 2024 at 12:58:12PM -0400, Jason Merrill wrote: On 4/3/24 12:42, Jakub Jelinek wrote: On Wed, Apr 03, 2024 at 12:07:48PM -0400, Jason Merrill wrote: Using std::is_constant_evaluated directly in a loop condition is, as the paper says

Re: [PATCH] c++: fix alias CTAD [PR114377]

2024-04-04 Thread Jason Merrill
Applied, thanks! BTW, in future please see https://gcc.gnu.org/contribute.html#legal This patch is small enough to not need to worry about copyright, but for larger patches we would. On 3/27/24 14:36, centurion wrote: PR c++/114377 gcc/cp/ChangeLog: PR c++/114377

Re: [PATCH] c++: constexpr error with fn redecl in local scope [PR111132]

2024-04-04 Thread Jason Merrill
On 4/4/24 14:43, Marek Polacek wrote: On Wed, Apr 03, 2024 at 01:14:46PM -0400, Jason Merrill wrote: On 4/2/24 13:52, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13? -- >8 -- We evaluate constexpr functions on the original, pre-genericization bodies. T

Re: [PATCH v2] c++: constexpr error with fn redecl in local scope [PR111132]

2024-04-04 Thread Jason Merrill
On 4/4/24 19:15, Marek Polacek wrote: On Thu, Apr 04, 2024 at 05:28:22PM -0400, Jason Merrill wrote: On 4/4/24 14:43, Marek Polacek wrote: On Wed, Apr 03, 2024 at 01:14:46PM -0400, Jason Merrill wrote: On 4/2/24 13:52, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok

Re: [committed] c++: Fix ICE with weird copy assignment operator [PR114572]

2024-04-08 Thread Jason Merrill
On 4/5/24 03:35, Jakub Jelinek wrote: Hi! While ctors/dtors don't return anything (undeclared void or this pointer on arm) and copy assignment operators normally return a reference to *this, it isn't invalid to return uselessly some class object which might need destructing, but the OpenMP claus

Re: [PATCH] c++, v2: Implement C++26 P2809R3 - Trivial infinite loops are not Undefined Behavior

2024-04-08 Thread Jason Merrill
On 4/5/24 03:57, Jakub Jelinek wrote: Hi! Here is a new version of the PR114462 P2809R3 patch. As clarified on core, for trivially empty iteration statements (where the condition isn't empty or INTEGER_CST, because those loops can't contain std::is_constant_evaluated() in the condition and the m

Re: [PATCH] c++: Fix up maybe_warn_for_constant_evaluated calls [PR114580]

2024-04-08 Thread Jason Merrill
On 4/5/24 14:47, Marek Polacek wrote: On Fri, Apr 05, 2024 at 09:40:48AM +0200, Jakub Jelinek wrote: Hi! When looking at maybe_warn_for_constant_evaluated for the trivial infinite loops patch, I've noticed that it can emit weird diagnostics for if constexpr in templates, first warn that std::is

Re: [PATCH v2] c++/modules: Track declarations imported from partitions [PR99377]

2024-04-08 Thread Jason Merrill
On 4/4/24 08:27, Nathaniel Shead wrote: On Wed, Apr 03, 2024 at 02:16:25PM -0400, Jason Merrill wrote: On 3/28/24 08:22, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- The testcase in comment 15 of the linked PR is caused because

Re: [PATCH] c++: Keep DECL_SAVED_TREE of destructor instantiations in modules [PR104040]

2024-04-08 Thread Jason Merrill
On 4/4/24 07:27, Nathaniel Shead wrote: On Wed, Apr 03, 2024 at 11:18:01AM -0400, Jason Merrill wrote: On 4/2/24 20:57, Nathaniel Shead wrote: On Tue, Apr 02, 2024 at 01:18:17PM -0400, Jason Merrill wrote: On 3/28/24 23:21, Nathaniel Shead wrote: - && !(m

Re: [PATCH] c++: Keep DECL_SAVED_TREE of destructor instantiations in modules [PR104040]

2024-04-09 Thread Jason Merrill
On 4/9/24 09:36, Nathaniel Shead wrote: On Mon, Apr 08, 2024 at 11:17:27PM -0400, Jason Merrill wrote: On 4/4/24 07:27, Nathaniel Shead wrote: On Wed, Apr 03, 2024 at 11:18:01AM -0400, Jason Merrill wrote: On 4/2/24 20:57, Nathaniel Shead wrote: On Tue, Apr 02, 2024 at 01:18:17PM -0400

Re: [PATCH] c++, v3: Implement C++26 P2809R3 - Trivial infinite loops are not Undefined Behavior

2024-04-09 Thread Jason Merrill
On 4/9/24 05:57, Jakub Jelinek wrote: On Mon, Apr 08, 2024 at 06:53:29PM -0400, Jason Merrill wrote: + if (warn_tautological_compare) +{ + tree cond = *condp; + while (TREE_CODE (cond) == ANNOTATE_EXPR) + cond = TREE_OPERAND (cond, 0); + if (trivial_infinite

Re: [PATCH] c++/modules: local class merging [PR99426]

2024-04-09 Thread Jason Merrill
On 3/5/24 10:31, Patrick Palka wrote: On Tue, 27 Feb 2024, Patrick Palka wrote: Subject: [PATCH] c++/modules: local type merging [PR99426] One known missing piece in the modules implementation is merging of a streamed-in local type (class or enum) with the corresponding in-TU version of the loc

Re: [PATCH] c++/modules: optimize tree flag streaming

2024-04-09 Thread Jason Merrill
On 2/16/24 10:06, Patrick Palka wrote: On Thu, 15 Feb 2024, Patrick Palka wrote: One would expect consecutive calls to bytes_in/out::b for streaming adjacent bits, as we do for tree flag streaming, to at least be optimized by the compiler into individual bit operations using statically known bi

Re: [PATCH] c++: recalculating local specs via build_extra_args [PR114303]

2024-04-09 Thread Jason Merrill
On 3/12/24 10:51, Patrick Palka wrote: On Tue, 12 Mar 2024, Patrick Palka wrote: On Tue, 12 Mar 2024, Jason Merrill wrote: On 3/11/24 12:53, Patrick Palka wrote: r13-6452-g341e6cd8d603a3 made build_extra_args walk evaluated contexts first so that we prefer processing a local specialization

Re: [PATCH] c++: templated substitution into lambda-expr [PR114393]

2024-04-10 Thread Jason Merrill
On 3/27/24 10:01, Patrick Palka wrote: On Mon, 25 Mar 2024, Patrick Palka wrote: On Mon, 25 Mar 2024, Patrick Palka wrote: The below testcases use a lambda-expr as a template argument and they all trip over the below added tsubst_lambda_expr sanity check ultimately because current_template_par

Re: [PATCH] c++/modules: optimize tree flag streaming

2024-04-10 Thread Jason Merrill
On 4/10/24 11:26, Patrick Palka wrote: On Wed, 10 Apr 2024, Patrick Palka wrote: On Tue, 9 Apr 2024, Jason Merrill wrote: On 2/16/24 10:06, Patrick Palka wrote: On Thu, 15 Feb 2024, Patrick Palka wrote: One would expect consecutive calls to bytes_in/out::b for streaming adjacent bits, as

Re: [PATCH] c++: Fix ANNOTATE_EXPR instantiation [PR114409]

2024-04-10 Thread Jason Merrill
On 4/10/24 09:06, Jakub Jelinek wrote: Hi! The following testcase ICEs starting with the r14-4229 PR111529 change which moved ANNOTATE_EXPR handling from tsubst_expr to tsubst_copy_and_build. ANNOTATE_EXPR is only allowed in the IL to wrap a loop condition, and the loop condition of while/for lo

Re: [PATCH] c++/114409 - ANNOTATE_EXPR and templates

2024-04-10 Thread Jason Merrill
On 4/10/24 13:10, Richard Biener wrote: On Wed, 10 Apr 2024, Jakub Jelinek wrote: On Wed, Apr 10, 2024 at 06:43:02PM +0200, Richard Biener wrote: The following fixes a mismatch in COMPOUND_EXPR handling in tsubst_expr vs tsubst_stmt where the latter allows a stmt in operand zero but the former

Re: [PATCH] c++: recalculating local specs via build_extra_args [PR114303]

2024-04-10 Thread Jason Merrill
On 4/10/24 17:39, Patrick Palka wrote: On Wed, 10 Apr 2024, Jason Merrill wrote: On 3/12/24 10:51, Patrick Palka wrote: On Tue, 12 Mar 2024, Patrick Palka wrote: On Tue, 12 Mar 2024, Jason Merrill wrote: On 3/11/24 12:53, Patrick Palka wrote: r13-6452-g341e6cd8d603a3 made build_extra_args

Re: [PATCH] c++/modules: local class merging [PR99426]

2024-04-10 Thread Jason Merrill
On 4/10/24 14:48, Patrick Palka wrote: On Tue, 9 Apr 2024, Jason Merrill wrote: On 3/5/24 10:31, Patrick Palka wrote: On Tue, 27 Feb 2024, Patrick Palka wrote: Subject: [PATCH] c++/modules: local type merging [PR99426] One known missing piece in the modules implementation is merging of a

Re: [PATCH] c++: recalculating local specs via build_extra_args [PR114303]

2024-04-10 Thread Jason Merrill
On 4/10/24 20:00, Patrick Palka wrote: On Wed, 10 Apr 2024, Jason Merrill wrote: On 4/10/24 17:39, Patrick Palka wrote: On Wed, 10 Apr 2024, Jason Merrill wrote: On 3/12/24 10:51, Patrick Palka wrote: On Tue, 12 Mar 2024, Patrick Palka wrote: On Tue, 12 Mar 2024, Jason Merrill wrote: On

Re: [PATCH v2] c++: avoid -Wdangling-reference for std::span-like classes [PR110358]

2024-01-31 Thread Jason Merrill
On 1/31/24 14:44, Alex Coplan wrote: Hi Marek, On 30/01/2024 13:15, Marek Polacek wrote: On Thu, Jan 25, 2024 at 10:13:10PM -0500, Jason Merrill wrote: On 1/25/24 20:36, Marek Polacek wrote: Better version: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Real-wo

Re: [PATCH] c-family: Fix ICE with large column number after restoring a PCH [PR105608]

2024-01-31 Thread Jason Merrill
On 1/30/24 21:49, Lewis Hyatt wrote: On Fri, Jan 26, 2024 at 04:16:54PM -0500, Jason Merrill wrote: On 12/5/23 20:52, Lewis Hyatt wrote: Hello- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105608 There are two related issues here really, a regression since GCC 11 where we can ICE after

Re: [PATCH] c-family: Fix ICE with large column number after restoring a PCH [PR105608]

2024-01-31 Thread Jason Merrill
On 1/31/24 21:09, Lewis Hyatt wrote: On Wed, Jan 31, 2024 at 03:18:01PM -0500, Jason Merrill wrote: On 1/30/24 21:49, Lewis Hyatt wrote: On Fri, Jan 26, 2024 at 04:16:54PM -0500, Jason Merrill wrote: On 12/5/23 20:52, Lewis Hyatt wrote: Hello- https://gcc.gnu.org/bugzilla/show_bug.cgi?id

Re: [PATCH] c++: ICE with throw inside concept [PR112437]

2024-01-31 Thread Jason Merrill
On 1/31/24 18:41, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13/12? OK. -- >8 -- We crash in the loop at the end of treat_lvalue_as_rvalue_p for code like template concept Throwable = requires(T x) { throw x; }; because the code assumes that we e

Re: [PATCH] c++: ttp CTAD equivalence [PR112737]

2024-01-31 Thread Jason Merrill
On 1/31/24 16:03, Patrick Palka wrote: On Wed, 31 Jan 2024, Jason Merrill wrote: On 1/31/24 12:12, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Here during declaration matching we undesirably consider the two TT{42} C

Re: [PATCH v2] c++: avoid -Wdangling-reference for std::span-like classes [PR110358]

2024-01-31 Thread Jason Merrill
On 1/31/24 15:56, Marek Polacek wrote: On Wed, Jan 31, 2024 at 02:57:09PM -0500, Jason Merrill wrote: On 1/31/24 14:44, Alex Coplan wrote: Hi Marek, On 30/01/2024 13:15, Marek Polacek wrote: On Thu, Jan 25, 2024 at 10:13:10PM -0500, Jason Merrill wrote: On 1/25/24 20:36, Marek Polacek wrote

Re: [PATCH] c++: -Wdangling-reference tweak to unbreak aarch64

2024-02-01 Thread Jason Merrill
On 2/1/24 16:23, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? OK. aarch64-unknown-linux-gnu now bootstraps. -- >8 -- My recent -Wdangling-reference change to not warn on std::span-like classes unfortunately caused a new warning: extending reference_like_c

[pushed] c++: variable template array of unknown bound [PR113638]

2024-02-01 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- When we added variable templates, we didn't extend the VAR_HAD_UNKNOWN_BOUND handling for class template static data members to handle them as well. PR c++/113638 gcc/cp/ChangeLog: * cp-tree.h: Adjust comment. * pt

[pushed] c++: no_unique_address and constexpr [PR112439]

2024-02-01 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- Here, because we don't build a CONSTRUCTOR for an empty base, we were wrongly marking the Foo CONSTRUCTOR as complete after initializing the Empty member. Fixed by checking empty_base here as well. PR c++/112439 gcc/cp/ChangeLog:

[pushed] c++: op== defaulted outside class [PR110084]

2024-02-02 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- defaulted_late_check is for checks that need to happen after the class is complete; we shouldn't call it sooner. PR c++/110084 gcc/cp/ChangeLog: * pt.cc (tsubst_function_decl): Only check a function defaulted outsi

Re: [PATCH 1/2] c++: requires-exprs and partial constraint subst [PR112769]

2024-02-02 Thread Jason Merrill
On 2/2/24 14:41, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? OK. -- >8 -- In r11-3261-gb28b621ac67bee we made tsubst_requires_expr never partially substitute into a requires-expression so as to avoid checking its requirements out of or

Re: [PATCH 1/2] c++: requires-exprs and partial constraint subst [PR112769]

2024-02-02 Thread Jason Merrill
On 2/2/24 14:41, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- In r11-3261-gb28b621ac67bee we made tsubst_requires_expr never partially substitute into a requires-expression so as to avoid checking its requirements out of order dur

Re: [PATCH 1/2] c++: requires-exprs and partial constraint subst [PR112769]

2024-02-02 Thread Jason Merrill
On 2/2/24 15:57, Patrick Palka wrote: On Fri, 2 Feb 2024, Patrick Palka wrote: On Fri, 2 Feb 2024, Jason Merrill wrote: On 2/2/24 14:41, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- In r11-3261-gb28b621ac67bee we m

Re: [PATCH] c++: DR2237, cdtor and template-id tweaks [PR107126]

2024-02-05 Thread Jason Merrill
On 2/3/24 10:24, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? I'm not certain OPT_Wc__20_extensions is the best thing for something from [diff.cpp17]; would you prefer something else? I think it wants its own flag, that is enabled in C++20 or by -Wc++20-co

Re: [PATCH] libitm: small update for C++20

2024-02-05 Thread Jason Merrill
On 2/3/24 10:14, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? OK. -- >8 -- C++20 DR 2237 disallows simple-template-id in cdtors, so you can't write template struct S { S(); // should be S(); }; This hasn't been a problem until now b

[pushed] c++: prvalue of array type [PR111286]

2024-02-05 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- Here we want to build a prvalue array to bind to the T reference, but we were wrongly trying to strip cv-quals from the array prvalue, which should be treated the same as a class prvalue. PR c++/111286 gcc/cp/ChangeLog: *

[pushed] c++: -frounding-math test [PR109359]

2024-02-05 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- This test was fixed by the patch for PR95226, but that patch had no testcase so let's add this one. PR c++/109359 gcc/testsuite/ChangeLog: * g++.dg/ext/frounding-math1.C: New test. --- gcc/testsuite/g++.dg/ext/frounding-m

[pushed] c++: defaulted op== for incomplete class [PR107291]

2024-02-05 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- After complaining about lack of friendship, we should not try to go on and define the defaulted comparison operator anyway. PR c++/107291 gcc/cp/ChangeLog: * method.cc (early_check_defaulted_comparison): Fail if not friend

Re: [pushed] c++: defaulted op== for incomplete class [PR107291]

2024-02-05 Thread Jason Merrill
On 2/5/24 21:55, Marek Polacek wrote: On Mon, Feb 05, 2024 at 09:29:08PM -0500, Jason Merrill wrote: Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- After complaining about lack of friendship, we should not try to go on and define the defaulted comparison operator anyway.

Re: [PATCH] c++: Disallow this specifier except for parameter declarations [PR113788]

2024-02-06 Thread Jason Merrill
On 2/6/24 15:45, Marek Polacek wrote: On Tue, Feb 06, 2024 at 09:37:44PM +0100, Jakub Jelinek wrote: Hi! The deducing this patchset added parsing of this specifier to cp_parser_decl_specifier_seq unconditionally, but in the C++ grammar this[opt] only appears in the parameter-declaration non-ter

[PATCH RFA] gdbhooks: regex syntax error

2024-02-06 Thread Jason Merrill
Briefly tested that break-on-pass completion works. Oddly, it also works without the patch, but the fix still seems worthwhile. OK for trunk? -- 8< -- Recent python complains about this pattern with SyntaxWarning: invalid escape sequence '\s' because \s in a regular string just means 's'; for

[PATCH RFA] build: drop target libs from LD_LIBRARY_PATH [PR105688]

2024-02-06 Thread Jason Merrill
Tested x86_64-pc-linux-gnu. Any thoughts? -- 8< -- The patch for PR22340 (r104978) moved the adding of TARGET_LIB_PATH to RPATH_ENVVAR from POSTSTAGE1_HOST_EXPORTS to HOST_EXPORTS, but didn't mention that in the ChangeLog; it also wasn't part of the patch that was sent to gcc-patches. I suspect

Re: [PATCH] c++: for contracts, cdtors never return this

2024-02-07 Thread Jason Merrill
/contracts/contracts-ctor-dtor2.C    (test for errors, line 27 Kind regards, Torbjörn On 2023-11-20 16:40, Jason Merrill wrote: On 11/19/23 02:28, Alexandre Oliva wrote: When targetm.cxx.cdtor_return_this() holds, cdtors have a non-VOID_TYPE_P result, but IMHO this ABI implementation detail

Re: [PATCH] c++: Don't ICE for unknown parameter to constexpr'd switch-statement, PR113545

2024-02-07 Thread Jason Merrill
On 2/6/24 19:23, Hans-Peter Nilsson wrote: Date: Mon, 22 Jan 2024 14:33:59 -0500 From: Marek Polacek On Mon, Jan 22, 2024 at 06:02:32PM +0100, Hans-Peter Nilsson wrote: I don't really know whether this is the right way to treat CONVERT_EXPR as below, but... Regtested native x86_64-linux-gnu

Re: [PATCH] c++: NTTP type CTAD w/ tmpl from current inst [PR113649]

2024-02-07 Thread Jason Merrill
On 2/6/24 16:59, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Since template argument coercion happens relative to the most general template (for a class template at least), during NTTP type CTAD we might need to consider outer ar

Re: [PATCH v2] c++: DR2237, cdtor and template-id tweaks [PR107126]

2024-02-07 Thread Jason Merrill
On 2/5/24 22:11, Marek Polacek wrote: On Mon, Feb 05, 2024 at 10:14:34AM -0500, Jason Merrill wrote: On 2/3/24 10:24, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? I'm not certain OPT_Wc__20_extensions is the best thing for something from [diff.

[pushed] c++: class nttp ICE

2024-02-07 Thread Jason Merrill
Tested x86_64-pc-linux-gnu, applying to trunk. Marek, I'll leave it to you to judge if there is anything else needed for P2308. -- 8< -- The new testcase from P2308 crashed trying to expand 'this' without an object to refer to, because we stripped the TARGET_EXPR in create_template_parm_object.

Re: [PATCH RFA] build: drop target libs from LD_LIBRARY_PATH [PR105688]

2024-02-08 Thread Jason Merrill
beahviour). Thank you! - For modern Darwin [ > macOS 10.11] , there’s no issue seen so far, but for older Darwin…. On 8 Feb 2024, at 05:36, Alexandre Oliva wrote: On Feb 6, 2024, Jason Merrill wrote: Reverting that hunk of the change fixed my problem with bubblestrapping GCC 12 w

Re: [PATCH RFA] build: drop target libs from LD_LIBRARY_PATH [PR105688]

2024-02-08 Thread Jason Merrill
On 2/8/24 12:12, Jason Merrill wrote: On 2/8/24 10:04, Iain Sandoe wrote: Hi Jason, I have tested this on modern Darwin (with libc++ as the system library) and on older Darwin, where we do see the issue - because the system linker is written in C++ and links with libstdc++ (so sometimes we

Re: [PATCH RFA] build: drop target libs from LD_LIBRARY_PATH [PR105688]

2024-02-08 Thread Jason Merrill
On 2/8/24 12:51, Iain Sandoe wrote: On 8 Feb 2024, at 17:16, Jason Merrill wrote: On 2/8/24 12:12, Jason Merrill wrote: On 2/8/24 10:04, Iain Sandoe wrote: Hi Jason, I have tested this on modern Darwin (with libc++ as the system library) and on older Darwin, where we do see the issue

Re: [PATCH RFA] build: drop target libs from LD_LIBRARY_PATH [PR105688]

2024-02-08 Thread Jason Merrill
On 2/8/24 12:55, Paolo Bonzini wrote: On 2/8/24 18:16, Jason Merrill wrote: Hmm.  In stage 1, when we build with the system gcc, I'd think we want the just-built gnat1 to find the system libgcc. In stage 2, when we build with the stage 1 gcc, we want the just-built gnat1 to fin

Re: [PATCH v2] c++: make build_throw SFINAE-friendly [PR98388]

2024-02-08 Thread Jason Merrill
On 2/8/24 11:51, Marek Polacek wrote: On Thu, Feb 08, 2024 at 08:49:28AM -0500, Patrick Palka wrote: On Wed, 7 Feb 2024, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Here the problem is that we give hard errors while substituting template paramete

Re: [PATCH v2] c++: make build_throw SFINAE-friendly [PR98388]

2024-02-09 Thread Jason Merrill
On 2/8/24 17:20, Marek Polacek wrote: On Thu, Feb 08, 2024 at 04:53:45PM -0500, Jason Merrill wrote: On 2/8/24 11:51, Marek Polacek wrote: On Thu, Feb 08, 2024 at 08:49:28AM -0500, Patrick Palka wrote: On Wed, 7 Feb 2024, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu

Re: [PATCH v3] c++: DR2237, cdtor and template-id tweaks [PR107126]

2024-02-09 Thread Jason Merrill
On 2/8/24 16:26, Marek Polacek wrote: This patch does *not* fix where the C++20 diagnostic is missing altogether. What would it take to fix that as well? * doc/invoke.texi: Document -Wdeprecated-template-id-cdtor. Was it ever d

Re: [PATCH] c++: avoid name lookup during mangling

2024-02-09 Thread Jason Merrill
On 2/9/24 10:51, Patrick Palka wrote: It turns out that with modules we can call mangle_decl recursively, which is a problem because the global mangling state isn't recursion aware. The recursion happens from write_closure_type_name, which calls lambda function, which performs name lookup, which

Re: [PATCH] c++/modules: anon union member of as-base class [PR112580]

2024-02-09 Thread Jason Merrill
On 2/1/24 12:18, Patrick Palka wrote: Tested on x86_64-pc-linux-gnu, does this look OK for trunk? OK. -- >8 -- Here when streaming in the fields of the as-base version of _Formatting_scanner we end up clobbering ANON_AGGR_TYPE_FIELD of the anonymous union type, since it turns out this type i

Re: [PATCH] c++: Don't advertise cxx_constexpr_string_builtins [PR113658]

2024-02-09 Thread Jason Merrill
On 2/2/24 10:45, Alex Coplan wrote: On 02/02/2024 09:34, Marek Polacek wrote: On Fri, Feb 02, 2024 at 10:27:23AM +, Alex Coplan wrote: Bootstrapped/regtested on x86_64-apple-darwin, OK for trunk? Thanks, Alex -- >8 -- When __has_feature was introduced for GCC 14, I included the feature c

Re: [PATCH] c++: avoid name lookup during mangling

2024-02-09 Thread Jason Merrill
On 2/9/24 11:55, Patrick Palka wrote: On Fri, 9 Feb 2024, Jason Merrill wrote: On 2/9/24 10:51, Patrick Palka wrote: It turns out that with modules we can call mangle_decl recursively, which is a problem because the global mangling state isn't recursion aware. The recursion happens

Re: [PATCH v4]: testcases for "ICE for unknown parameter to constexpr'd switch-statement, PR113545"

2024-02-09 Thread Jason Merrill
On 2/9/24 11:02, Hans-Peter Nilsson wrote: Oops, I managed to send a version that only added a comment, but still had a dg-do run. Anyway, here's v4: actually change the "dg-do run", not just adding a comment. Sending as a self-contained fresh patch for the benefit of aforementioned CI. See v2

Re: [PATCH v3] c++: make build_throw SFINAE-friendly [PR98388]

2024-02-09 Thread Jason Merrill
On 2/9/24 13:31, Marek Polacek wrote: On Fri, Feb 09, 2024 at 10:07:33AM -0500, Jason Merrill wrote: On 2/8/24 17:20, Marek Polacek wrote: On Thu, Feb 08, 2024 at 04:53:45PM -0500, Jason Merrill wrote: On 2/8/24 11:51, Marek Polacek wrote: On Thu, Feb 08, 2024 at 08:49:28AM -0500, Patrick

Re: [PATCH] c++: fix ICE with __type_pack_element [PR113834]

2024-02-09 Thread Jason Merrill
On 2/9/24 13:32, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? OK. -- >8 -- Here we crash on this invalid code because we seem to infinitely recurse and end up with __type_pack_element with index that doesn't tree_fits_shwi_p which then crashes on tree_to_s

Re: [PATCH] call maybe_return_this in build_clone

2024-02-09 Thread Jason Merrill
/Wuse-after-free3.C  -std=gnu++17 (test for excess errors) FAIL: g++.dg/warn/Wuse-after-free3.C  -std=gnu++20 (test for excess errors) Kind regards, Torbjörn On 2023-11-22 09:26, Alexandre Oliva wrote: On Nov 20, 2023, Jason Merrill wrote: So it only passed on that platform before because of

Re: [PATCH v4] c++: DR2237, cdtor and template-id tweaks [PR107126]

2024-02-09 Thread Jason Merrill
On 2/9/24 18:46, Marek Polacek wrote: On Fri, Feb 09, 2024 at 10:20:04AM -0500, Jason Merrill wrote: On 2/8/24 16:26, Marek Polacek wrote: This patch does *not* fix <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97202#c8> where the C++20 diagnostic is missing altogether. What would it t

Re: [PATCH RFA] build: drop target libs from LD_LIBRARY_PATH [PR105688]

2024-02-10 Thread Jason Merrill
On 2/10/24 05:46, Iain Sandoe wrote: On 9 Feb 2024, at 23:21, Iain Sandoe wrote: On 9 Feb 2024, at 10:56, Iain Sandoe wrote: On 8 Feb 2024, at 21:44, Jason Merrill wrote: On 2/8/24 12:55, Paolo Bonzini wrote: On 2/8/24 18:16, Jason Merrill wrote: Hmm. In stage 1, when we build

Re: [PATCH 1/2] c++/modules: reduce lazy loading recursion

2024-02-10 Thread Jason Merrill
On 2/9/24 16:50, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk -- >8 -- It turns out that with modules we can call mangle_decl recursively, which is a problem because the global mangling state isn't recursion aware. The recursion happens fr

Re: [PATCH 2/2] c++/modules: ICE with modular fmtlib

2024-02-10 Thread Jason Merrill
On 2/9/24 17:11, Patrick Palka wrote: On Fri, 9 Feb 2024, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? I'll try to reduce and add testcases overnight for these separate bugs before pushing. -- >8 -- Building modular fmtlib triggered two

Re: [PATCH] c++: ICE with reinterpret_cast and switch [PR113545]

2024-02-12 Thread Jason Merrill
On 2/10/24 17:42, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? OK, thanks. -- >8 -- Jason, this is the patch you proposed for PR113545. It looks very safe so I'm posting it here so that it's not forgotten. PR c++/113545 gcc/cp/ChangeLog:

Re: [PATCH] attribs: Don't canonicalize lookup_scoped_attribute_spec argument [PR113674]

2024-02-12 Thread Jason Merrill
On 2/12/24 12:30, Jakub Jelinek wrote: Hi! The C and C++ FEs when parsing attributes already canonicalize them (i.e. if they start with __ and end with __ substrings, we remove those). lookup_attribute already verifies in gcc_assert that the first character of name is not an underscore, and even

Re: [PATCH RFA] build: drop target libs from LD_LIBRARY_PATH [PR105688]

2024-02-12 Thread Jason Merrill
On 2/10/24 07:30, Iain Sandoe wrote: On 10 Feb 2024, at 12:07, Jason Merrill wrote: On 2/10/24 05:46, Iain Sandoe wrote: On 9 Feb 2024, at 23:21, Iain Sandoe wrote: On 9 Feb 2024, at 10:56, Iain Sandoe wrote: On 8 Feb 2024, at 21:44, Jason Merrill wrote: On 2/8/24 12:55, Paolo

Re: [PATCH] testsuite: Fix c-c++-common/pr103798-2.c on Solaris [PR113706]

2024-02-12 Thread Jason Merrill
On 2/2/24 10:23, Rainer Orth wrote: c-c++-common/pr103798-2.c FAILs on Solaris when compiled as C++: FAIL: c-c++-common/pr103798-2.c -std=gnu++14 scan-assembler-not memchr FAIL: c-c++-common/pr103798-2.c -std=gnu++17 scan-assembler-not memchr FAIL: c-c++-common/pr103798-2.c -std=gnu++20 sc

PING Re: [PATCH RFA] gdbhooks: regex syntax error

2024-02-12 Thread Jason Merrill
Ping On 2/6/24 17:07, Jason Merrill wrote: Briefly tested that break-on-pass completion works. Oddly, it also works without the patch, but the fix still seems worthwhile. OK for trunk? -- 8< -- Recent python complains about this pattern with SyntaxWarning: invalid escape sequence

Re: [PATCH 2/2] c++/modules: ICE with modular fmtlib

2024-02-12 Thread Jason Merrill
On 2/10/24 13:37, Patrick Palka wrote: On Sat, 10 Feb 2024, Jason Merrill wrote: On 2/9/24 17:11, Patrick Palka wrote: On Fri, 9 Feb 2024, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? I'll try to reduce and add testcases overnigh

Re: [PATCH] c++/modules: use optimized crc32 from zlib

2024-02-12 Thread Jason Merrill
On 2/12/24 16:49, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? OK. -- >8 -- The current implementation of bytes::calc_crc computes the checksum one byte at a time, and turns out to be quite slow, taking 5% and 15% of time compiling and

<    1   2   3   4   5   6   7   8   9   10   >