Re: [PATCH v3 09/11] c: Turn -Wreturn-mismatch into a permerror

2023-11-23 Thread Marek Polacek
On Mon, Nov 20, 2023 at 10:56:30AM +0100, Florian Weimer wrote: > gcc/ > > * doc/invoke.texi (Warning Options): Document changes. That's pretty vague :). How about "Document that -Wreturn-mismatch is a permerror in C99."? > gcc/c/ > > PR c/96284 > * c-typeck.cc (c_finish_ret

Re: [PATCH v5] gcc: Introduce -fhardened

2023-11-23 Thread Marek Polacek
On Tue, Nov 21, 2023 at 10:41:10AM -0500, Marek Polacek wrote: > On Mon, Nov 20, 2023 at 05:32:47PM +0100, Jakub Jelinek wrote: > > LGTM. > > Thanks a lot. Since Richi seems to be fine with the patch as well, > I'll push it tomorrow AM if no comments. Pushed. I

[PATCH v5] c++: implement P2564, consteval needs to propagate up [PR107687]

2023-11-23 Thread Marek Polacek
On Mon, Nov 13, 2023 at 09:06:09PM -0500, Jason Merrill wrote: > On 11/6/23 17:34, Marek Polacek wrote: > > On Fri, Nov 03, 2023 at 01:51:07PM -0400, Jason Merrill wrote: > > > On 11/2/23 11:28, Marek Polacek wrote: > > > > On Sat, Oct 14, 2023 at 12:56:1

Re: [PATCH v5] gcc: Introduce -fhardened

2023-11-21 Thread Marek Polacek
On Mon, Nov 20, 2023 at 05:32:47PM +0100, Jakub Jelinek wrote: > LGTM. Thanks a lot. Since Richi seems to be fine with the patch as well, I'll push it tomorrow AM if no comments. Marek

[PATCH] c++: P2280R4, Using unknown refs in constant expr [PR106650]

2023-11-17 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- This patch is an attempt to implement (part of?) P2280, Using unknown pointers and references in constant expressions. (Note that R4 seems to only allow References to unknown/Accesses via this, but not Pointers to unknown.) Th

[PATCH v5] gcc: Introduce -fhardened

2023-11-16 Thread Marek Polacek
On Wed, Nov 15, 2023 at 01:25:27PM +0100, Jakub Jelinek wrote: > On Fri, Nov 03, 2023 at 06:51:16PM -0400, Marek Polacek wrote: > > + if (flag_hardened) > > + { > > + if (!fortify_seen_p && optimize > 0) > > + { > > + if (TARGET_

[PATCH v3] c++: fix parsing with auto(x) [PR112410]

2023-11-15 Thread Marek Polacek
On Tue, Nov 14, 2023 at 05:27:03PM -0500, Jason Merrill wrote: > On 11/14/23 10:58, Marek Polacek wrote: > > On Mon, Nov 13, 2023 at 09:26:41PM -0500, Jason Merrill wrote: > > > On 11/10/23 20:13, Marek Polacek wrote: > > > > On Thu, Nov 09, 2023 at 07:07:0

Re: [PATCH 3/4] c-family, C++: Handle clang attributes [PR109877].

2023-11-14 Thread Marek Polacek
On Sun, Nov 12, 2023 at 08:02:43PM -1000, Iain Sandoe wrote: > This adds the ability to defer the validation of numeric attribute > arguments until the sequence is parsed if the attribute being > handled is one known to be 'clang form'. > > We do this by considering the arguments to be strings reg

Re: [PATCH v2 8/8] c: Add new -Wdeclaration-missing-parameter-type permerror

2023-11-14 Thread Marek Polacek
On Tue, Nov 14, 2023 at 06:50:58PM +0100, Florian Weimer wrote: > --- a/gcc/c-family/c.opt > +++ b/gcc/c-family/c.opt > @@ -591,6 +591,10 @@ Wdeclaration-after-statement > C ObjC Var(warn_declaration_after_statement) Init(-1) Warning > Warn when a declaration is found after a statement. > > +Wd

Re: [PATCH v4] gcc: Introduce -fhardened

2023-11-14 Thread Marek Polacek
On Tue, Nov 14, 2023 at 08:46:16AM +0100, Richard Biener wrote: > On Fri, Nov 3, 2023 at 11:51 PM Marek Polacek wrote: > > > > On Thu, Oct 26, 2023 at 05:55:56PM +0200, Richard Biener wrote: > > > > > > > > > > Am 24.10.2023 um 21:09 schrieb Marek Po

Re: [PATCH v2] c++: fix parsing with auto(x) [PR112410]

2023-11-14 Thread Marek Polacek
On Mon, Nov 13, 2023 at 09:26:41PM -0500, Jason Merrill wrote: > On 11/10/23 20:13, Marek Polacek wrote: > > On Thu, Nov 09, 2023 at 07:07:03PM -0500, Jason Merrill wrote: > > > On 11/9/23 14:58, Marek Polacek wrote: > > > > Bootstrapped/regtested on x86

Re: [PATCH 2/4] c-family, C: handle clang attributes [PR109877].

2023-11-13 Thread Marek Polacek
On Sun, Nov 12, 2023 at 08:02:42PM -1000, Iain Sandoe wrote: > This adds the ability to defer the validation of numeric attribute > arguments until the sequence is parsed if the attribute being > handled is one known to be 'clang form'. > > We do this by considering the arguments to be strings reg

Re: [PATCH v4] gcc: Introduce -fhardened

2023-11-13 Thread Marek Polacek
Ping. On Fri, Nov 03, 2023 at 06:51:16PM -0400, Marek Polacek wrote: > On Thu, Oct 26, 2023 at 05:55:56PM +0200, Richard Biener wrote: > > > > > > > Am 24.10.2023 um 21:09 schrieb Marek Polacek : > > > > > > On Tue, Oct 24, 2023 at 09:22:25AM +0200,

[PATCH v2] c++: fix parsing with auto(x) [PR112410]

2023-11-10 Thread Marek Polacek
On Thu, Nov 09, 2023 at 07:07:03PM -0500, Jason Merrill wrote: > On 11/9/23 14:58, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > -- >8 -- > > Here we are wrongly parsing > > > >int y(auto(42)); >

[pushed] testsuite: fix lambda-decltype3.C in C++11

2023-11-10 Thread Marek Polacek
Tested x86_64-pc-linux-gnu, applying to trunk. -- >8 -- This fixes FAIL: g++.dg/cpp0x/lambda/lambda-decltype3.C -std=c++11 (test for excess errors) due to lambda-decltype3.C:25:6: error: lambda capture initializers only available with '-std=c++14' or '-std=gnu++14' [-Wc++14-extensions] gcc/tes

[PATCH] c++: fix parsing with auto(x) [PR112410]

2023-11-09 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Here we are wrongly parsing int y(auto(42)); which uses the C++23 cast-to-prvalue feature, and initializes y to 42. However, we were treating the auto as an implicit template parameter. Fixing the auto{42} case is easy, but

Re: [PATCH] attribs: Fix ICE with -Wno-attributes= [PR112339]

2023-11-07 Thread Marek Polacek
On Fri, Nov 03, 2023 at 06:43:49PM -0400, Jason Merrill wrote: > LGTM but I'd like Marek to approve it. Both hunks look correct to me. Patch is OK, thanks! > On Fri, Nov 3, 2023, 3:12 PM Jakub Jelinek wrote: > > > Hi! > > > > The following testcase ICEs, because with -Wno-attributes=foo::no_s

[PATCH] testsuite: nodiscard-reason-nonstring.C FAIL in C++26

2023-11-07 Thread Marek Polacek
Tested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Since r14-5071, we emit an extra error for this test (the first one): nodiscard-reason-nonstring.C:5:13: error: expected string-literal before numeric constant nodiscard-reason-nonstring.C:5:36: error: 'nodiscard' attribute argument must be

[PATCH v4] c++: implement P2564, consteval needs to propagate up [PR107687]

2023-11-06 Thread Marek Polacek
On Fri, Nov 03, 2023 at 01:51:07PM -0400, Jason Merrill wrote: > On 11/2/23 11:28, Marek Polacek wrote: > > On Sat, Oct 14, 2023 at 12:56:11AM -0400, Jason Merrill wrote: > > > On 10/10/23 13:20, Marek Polacek wrote: > > > > On Tue, Aug 29, 2023 at 03:26:4

[PATCH v4] gcc: Introduce -fhardened

2023-11-03 Thread Marek Polacek
On Thu, Oct 26, 2023 at 05:55:56PM +0200, Richard Biener wrote: > > > > Am 24.10.2023 um 21:09 schrieb Marek Polacek : > > > > On Tue, Oct 24, 2023 at 09:22:25AM +0200, Richard Biener wrote: > >>> On Mon, Oct 23, 2023 at 9:26 PM Marek Polacek wrote: > &

Re: [PATCH v4] c-family: Implement __has_feature and __has_extension [PR60512]

2023-11-03 Thread Marek Polacek
On Wed, Sep 27, 2023 at 03:27:30PM +0100, Alex Coplan wrote: > Hi, > > This is a v4 patch to address Jason's feedback here: > https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630911.html > > w.r.t. v3 it just removes a comment now that some uncertainty around > cxx_binary_literals has bee

[PATCH v3] c++: implement P2564, consteval needs to propagate up [PR107687]

2023-11-02 Thread Marek Polacek
On Sat, Oct 14, 2023 at 12:56:11AM -0400, Jason Merrill wrote: > On 10/10/23 13:20, Marek Polacek wrote: > > Thanks for looking into this. It's kept me occupied for quite a while. > > Thanks, nice work. > > > On Tue, Aug 29, 2023 at 03:26:46PM -0400, Jason Merrill

Re: [PATCH v3] c++: implement P2564, consteval needs to propagate up [PR107687]

2023-11-02 Thread Marek Polacek
On Thu, Nov 02, 2023 at 11:28:43AM -0400, Marek Polacek wrote: > On Sat, Oct 14, 2023 at 12:56:11AM -0400, Jason Merrill wrote: > > As discussed above, we probably don't want to exclude implicitly-declared > > special member functions. > > Done (but removing the DECL_ARTIFICIAL check). s/but/by/

Re: [PATCH] c++: error with bit-fields and scoped enums [PR111895]

2023-10-24 Thread Marek Polacek
On Tue, Oct 24, 2023 at 04:46:02PM -0400, Jason Merrill wrote: > On 10/24/23 12:18, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > -- >8 -- > > Here we issue a bogus error: invalid operands of types 'unsigned char:2

Re: [PATCH v3] gcc: Introduce -fhardened

2023-10-24 Thread Marek Polacek
On Tue, Oct 24, 2023 at 09:22:25AM +0200, Richard Biener wrote: > On Mon, Oct 23, 2023 at 9:26 PM Marek Polacek wrote: > > > > On Thu, Oct 19, 2023 at 02:24:11PM +0200, Richard Biener wrote: > > > On Wed, Oct 11, 2023 at 10:48 PM Marek Polacek wrote: > > > > &

Re: [PATCH v3] gcc: Introduce -fhardened

2023-10-24 Thread Marek Polacek
On Tue, Oct 24, 2023 at 10:34:22AM +0100, Iain Sandoe wrote: > hi Marek, > > > On 24 Oct 2023, at 08:44, Iain Sandoe wrote: > > On 23 Oct 2023, at 20:25, Marek Polacek wrote: > >> > >> On Thu, Oct 19, 2023 at 02:24:11PM +0200, Richard Biener wrote: > >

[PATCH] c++: error with bit-fields and scoped enums [PR111895]

2023-10-24 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Here we issue a bogus error: invalid operands of types 'unsigned char:2' and 'int' to binary 'operator!=' when casting a bit-field of scoped enum type to bool. In build_static_cast_1, perform_direct_initialization_if_possible r

[PATCH v3] gcc: Introduce -fhardened

2023-10-23 Thread Marek Polacek
On Thu, Oct 19, 2023 at 02:24:11PM +0200, Richard Biener wrote: > On Wed, Oct 11, 2023 at 10:48 PM Marek Polacek wrote: > > > > On Tue, Sep 19, 2023 at 10:58:19AM -0400, Marek Polacek wrote: > > > On Mon, Sep 18, 2023 at 08:57:39AM +0200, Richard Biener wrote: > >

[pushed] libstdc++: add casts to from_chars in [PR111883]

2023-10-20 Thread Marek Polacek
Tested x86_64-pc-linux-gnu, applying to trunk. -- >8 -- This fixes .../charconv: In function 'std::from_chars_result std::from_chars(const char*, const char*, _Float16&, chars_format)': .../charconv:687:17: warning: converting to '_Float16' from 'float' with greater conversion rank 687 |

[PATCH] c-family: char8_t and aliasing in C vs C++ [PR111884]

2023-10-20 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- In the PR, Joseph says that in C char8_t is not a distinct type. So we should behave as if it can alias anything, like ordinary char. In C, unsigned_char_type_node == char8_type_node, so with this patch we return 0 instead of -

[pushed] doc: Update contrib.texi

2023-10-19 Thread Marek Polacek
I noticed that Patrick is missing here. gcc/ChangeLog: * doc/contrib.texi: Add entry for Patrick Palka. --- gcc/doc/contrib.texi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/doc/contrib.texi b/gcc/doc/contrib.texi index 031c4ec44ce..0fe4a874616 100644 --- a/gcc/doc/contrib.

Re: [PATCH v3] c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

2023-10-19 Thread Marek Polacek
On Thu, Oct 19, 2023 at 01:02:33PM -0400, Jason Merrill wrote: > On 10/19/23 12:55, Marek Polacek wrote: > > On Thu, Oct 19, 2023 at 12:32:49PM -0400, Jason Merrill wrote: > > > On 10/19/23 10:14, Marek Polacek wrote: > > > > On Thu, Oct 19, 2023 at 10:06:0

Re: [PATCH v2] gcc: Introduce -fhardened

2023-10-19 Thread Marek Polacek
On Thu, Oct 19, 2023 at 01:33:51PM +0100, Sam James wrote: > > Richard Biener writes: > > > On Wed, Oct 11, 2023 at 10:48 PM Marek Polacek wrote: > >> > >> On Tue, Sep 19, 2023 at 10:58:19AM -0400, Marek Polacek wrote: > >> > On Mon, Sep 18, 2

Re: [PATCH v2] gcc: Introduce -fhardened

2023-10-19 Thread Marek Polacek
On Wed, Oct 18, 2023 at 08:12:37PM +, Qing Zhao wrote: > Marek, > > Sorry for the late comment (I was just back from a long vacation immediate > after Cauldron). No worries. > One question: > > Is the option “-fhandened” for production build or for development build? I intend -fhardene

Re: [PATCH v3] c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

2023-10-19 Thread Marek Polacek
On Thu, Oct 19, 2023 at 12:32:49PM -0400, Jason Merrill wrote: > On 10/19/23 10:14, Marek Polacek wrote: > > On Thu, Oct 19, 2023 at 10:06:01AM -0400, Jason Merrill wrote: > > > On 10/19/23 09:39, Patrick Palka wrote: > > > > On Tue, 17 Oct 2023, Marek Polacek wrote:

Re: [PATCH] c: [PR100532] Fix ICE when an agrgument was an error mark

2023-10-19 Thread Marek Polacek
On Thu, Oct 19, 2023 at 03:38:57PM +, Andrew Pinski wrote: > In the case of convert_argument, we would return the same expression > back rather than error_mark_node after the error message about > trying to convert to an incomplete type. This causes issues in > the gimplfier trying to see if an

Re: [PATCH] c: [PR104822] Don't warn about converting NULL to different sso endian

2023-10-19 Thread Marek Polacek
On Thu, Oct 19, 2023 at 08:37:31AM -0700, Andrew Pinski wrote: > In a similar way we don't warn about NULL pointer constant conversion to > a different named address we should not warn to a different sso endian > either. > This adds the simple check. > > Bootstrapped and tested on x86_64-linux-gnu

Re: [PATCH v3] c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

2023-10-19 Thread Marek Polacek
On Thu, Oct 19, 2023 at 10:06:01AM -0400, Jason Merrill wrote: > On 10/19/23 09:39, Patrick Palka wrote: > > On Tue, 17 Oct 2023, Marek Polacek wrote: > > > > > On Tue, Oct 17, 2023 at 04:49:52PM -0400, Jason Merrill wrote: > > > > On 10/16/23 20:39, Marek Pol

Re: [PATCH v3] c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

2023-10-19 Thread Marek Polacek
On Thu, Oct 19, 2023 at 09:39:27AM -0400, Patrick Palka wrote: > On Tue, 17 Oct 2023, Marek Polacek wrote: > > > On Tue, Oct 17, 2023 at 04:49:52PM -0400, Jason Merrill wrote: > > > On 10/16/23 20:39, Marek Polacek wrote: > > > > - if (cxx_dialect > cxx

Re: [PATCH] c++: Make -Wunknown-pragmas controllable by #pragma GCC diagnostic [PR89038]

2023-10-19 Thread Marek Polacek
On Thu, Oct 19, 2023 at 09:07:36AM -0400, Lewis Hyatt wrote: > On Thu, Oct 19, 2023 at 8:43 AM Marek Polacek wrote: > > > > On Wed, Oct 18, 2023 at 05:15:42PM -0400, Lewis Hyatt wrote: > > > Hello- > > > > > > The PR points out that my fix for PR5343

Re: [PATCH] c++: Make -Wunknown-pragmas controllable by #pragma GCC diagnostic [PR89038]

2023-10-19 Thread Marek Polacek
On Wed, Oct 18, 2023 at 05:15:42PM -0400, Lewis Hyatt wrote: > Hello- > > The PR points out that my fix for PR53431 was incomplete and did not handle > -Wunknown-pragmas. This is a one-line fix to correct that, is it OK for > trunk and for GCC 13 backport please? bootstrap + regtest all languages

Re: [PATCH] libcpp: testsuite: Add test for fixed _Pragma bug [PR82335]

2023-10-19 Thread Marek Polacek
On Wed, Oct 18, 2023 at 05:03:57PM -0400, Lewis Hyatt wrote: > May I please ping this one, and/or, is it something straightforward > enough I can just commit it as obvious? Thanks! > https://gcc.gnu.org/pipermail/gcc-patches/2023-October/631814.html Please go ahead and apply the patch, thanks. So

[PATCH] c++: accepts-invalid with =delete("") [PR111840]

2023-10-17 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- r6-2367 added a DECL_INITIAL check to cp_parser_simple_declaration so that we don't emit multiple errors in g++.dg/parse/error57.C. But that means we don't diagnose int f1() = delete("george_crumb"); anymore, because fn decl

Re: [PATCH v3] c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

2023-10-17 Thread Marek Polacek
On Tue, Oct 17, 2023 at 04:49:52PM -0400, Jason Merrill wrote: > On 10/16/23 20:39, Marek Polacek wrote: > > On Sat, Oct 14, 2023 at 01:13:22AM -0400, Jason Merrill wrote: > > > On 10/13/23 14:53, Marek Polacek wrote: > > > > On Thu, Oct 12, 2023 at 09:41:4

Re: [PATCH] c++: Add missing auto_diagnostic_groups to constexpr.cc

2023-10-17 Thread Marek Polacek
On Tue, Oct 17, 2023 at 09:35:21PM +1100, Nathaniel Shead wrote: > Marek pointed out in another patch of mine [1] that I was missing an > auto_diagnostic_group to correctly associate informative notes with > their errors in structured error outputs. This patch goes through > constexpr.cc to correct

[PATCH v3] c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

2023-10-16 Thread Marek Polacek
On Sat, Oct 14, 2023 at 01:13:22AM -0400, Jason Merrill wrote: > On 10/13/23 14:53, Marek Polacek wrote: > > On Thu, Oct 12, 2023 at 09:41:43PM -0400, Jason Merrill wrote: > > > On 10/12/23 17:04, Marek Polacek wrote: > > > > Bootstrapped/regtested on x86

Re: [PATCH 1/2] Fix ICE due to c_safe_arg_type_equiv_p not checking for error_mark node

2023-10-16 Thread Marek Polacek
On Sat, Oct 14, 2023 at 06:16:47PM -0700, Andrew Pinski wrote: > This is a simple error recovery issue when c_safe_arg_type_equiv_p > was added in r8-5312-gc65e18d3331aa999. The issue is that after > an error, an argument type (of a function type) might turn > into an error mark node and c_safe_arg

[PATCH] c++: fix truncated diagnostic in C++23 [PR111272]

2023-10-13 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- In C++23, since P2448, a constexpr function F that calls a non-constexpr function N is OK as long as we don't actually call F in a constexpr context. So instead of giving an error in maybe_save_constexpr_fundef, we only give an

[PATCH v2] c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

2023-10-13 Thread Marek Polacek
On Thu, Oct 12, 2023 at 09:41:43PM -0400, Jason Merrill wrote: > On 10/12/23 17:04, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > -- >8 -- > > My recent patch introducing cp_fold_immediate_r caused exponential > >

[PATCH] c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]

2023-10-12 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- My recent patch introducing cp_fold_immediate_r caused exponential compile time with nested COND_EXPRs. The problem is that the COND_EXPR case recursively walks the arms of a COND_EXPR, but after processing both arms it doesn't

[PATCH v2] gcc: Introduce -fhardened

2023-10-11 Thread Marek Polacek
On Tue, Sep 19, 2023 at 10:58:19AM -0400, Marek Polacek wrote: > On Mon, Sep 18, 2023 at 08:57:39AM +0200, Richard Biener wrote: > > On Fri, Sep 15, 2023 at 5:09 PM Marek Polacek via Gcc-patches > > wrote: > > > > > > Bootstrapped/regtested on x86_64-pc-linux-gnu,

Re: [PATCH v2] c++: implement P2564, consteval needs to propagate up [PR107687]

2023-10-11 Thread Marek Polacek
On Tue, Oct 10, 2023 at 01:20:09PM -0400, Marek Polacek wrote: > @@ -3364,6 +3365,13 @@ word as an identifier. You can use the keyword > @code{__typeof__} instead. > This option is implied by the strict ISO C++ dialects: @option{-ansi}, > @option{-std=c++98}, @option{-std

Re: [PATCH v2] c++: Improve diagnostics for constexpr cast from void*

2023-10-11 Thread Marek Polacek
On Wed, Oct 11, 2023 at 10:57:06AM +1100, Nathaniel Shead wrote: > On Mon, Oct 09, 2023 at 04:10:20PM -0400, Jason Merrill wrote: > > On 10/9/23 06:03, Nathaniel Shead wrote: > > > Bootstrapped and regtested on x86_64-pc-linux-gnu with > > > GXX_TESTSUITE_STDS=98,11,14,17,20,23,26,impcx. > > > > >

[PATCH v2] c++: implement P2564, consteval needs to propagate up [PR107687]

2023-10-10 Thread Marek Polacek
On Tue, Aug 29, 2023 at 03:26:46PM -0400, Jason Merrill wrote: > On 8/23/23 15:49, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > -- >8 -- > > > > This patch implements P2564, described at , whereby > > c

Re: [PATCH] libcpp: Fix ICE on #include after a line marker directive [PR61474]

2023-09-19 Thread Marek Polacek
On Tue, Sep 19, 2023 at 06:08:50PM +0100, Richard Sandiford wrote: > Lewis Hyatt via Gcc-patches writes: > > Hello- > > > > This fixes an old PR, bootstrap + regtest on x86-64 Linux. Please let me > > know if it's ok? Thanks! > > > > -Lewis > > > > -- >8 -- > > > > As noted in the PR, GCC will se

Re: [PATCH] gcc: Introduce -fhardened

2023-09-19 Thread Marek Polacek
On Mon, Sep 18, 2023 at 08:57:39AM +0200, Richard Biener wrote: > On Fri, Sep 15, 2023 at 5:09 PM Marek Polacek via Gcc-patches > wrote: > > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, > > powerpc64le-unknown-linux-gnu, > > and aarch64-unknown-linux-gn

Re: [PATCH v7] c++: Move consteval folding to cp_fold_r

2023-09-19 Thread Marek Polacek
On Mon, Sep 18, 2023 at 09:36:31PM -0400, Jason Merrill wrote: > On 9/18/23 17:42, Marek Polacek wrote: > > + /* The purpose of this is not to emit errors for mce_unknown. */ > > + const tsubst_flags_t complain = (data->flags == ff_fold_immediate > > +

[PATCH v7] c++: Move consteval folding to cp_fold_r

2023-09-18 Thread Marek Polacek via Gcc-patches
On Sat, Sep 16, 2023 at 04:22:44PM -0400, Jason Merrill wrote: > On 9/15/23 16:32, Marek Polacek wrote: > > On Fri, Sep 15, 2023 at 02:08:46PM -0400, Jason Merrill wrote: > > > On 9/13/23 20:02, Marek Polacek wrote: > > > > On Wed, Sep 13, 2023 at 05:57:4

[PATCH v6] c++: Move consteval folding to cp_fold_r

2023-09-15 Thread Marek Polacek via Gcc-patches
On Fri, Sep 15, 2023 at 02:08:46PM -0400, Jason Merrill wrote: > On 9/13/23 20:02, Marek Polacek wrote: > > On Wed, Sep 13, 2023 at 05:57:47PM -0400, Jason Merrill wrote: > > > On 9/13/23 16:56, Marek Polacek wrote: > > > > On Tue, Sep 12, 2023 at 05:26:2

Re: RFC: Introduce -fhardened to enable security-related flags

2023-09-15 Thread Marek Polacek via Gcc-patches
On Fri, Sep 01, 2023 at 10:09:28PM +, Qing Zhao via Gcc-patches wrote: > > > > On Aug 29, 2023, at 3:42 PM, Marek Polacek via Gcc-patches > > wrote: > > > > Improving the security of software has been a major trend in the recent > > years. Fortunately

Re: RFC: Introduce -fhardened to enable security-related flags

2023-09-15 Thread Marek Polacek via Gcc-patches
On Mon, Sep 04, 2023 at 11:40:34PM +0100, Richard Sandiford wrote: > Qing Zhao via Gcc-patches writes: > >> On Aug 29, 2023, at 3:42 PM, Marek Polacek via Gcc-patches > >> wrote: > >> > >> Improving the security of software has been a major trend in t

Re: RFC: Introduce -fhardened to enable security-related flags

2023-09-15 Thread Marek Polacek via Gcc-patches
On Wed, Aug 30, 2023 at 03:08:46PM +0200, Richard Biener wrote: > On Wed, Aug 30, 2023 at 12:51 PM Jakub Jelinek via Gcc-patches > wrote: > > > > On Tue, Aug 29, 2023 at 03:42:27PM -0400, Marek Polacek via Gcc-patches > > wrote: > > > +

Re: RFC: Introduce -fhardened to enable security-related flags

2023-09-15 Thread Marek Polacek via Gcc-patches
On Wed, Aug 30, 2023 at 12:50:40PM +0200, Jakub Jelinek wrote: > On Tue, Aug 29, 2023 at 03:42:27PM -0400, Marek Polacek via Gcc-patches wrote: > > + if (UNLIKELY (flag_hardened) > > + && (opt->code == OPT_D || opt->code == OPT_U)) > > +

Re: RFC: Introduce -fhardened to enable security-related flags

2023-09-15 Thread Marek Polacek via Gcc-patches
On Wed, Aug 30, 2023 at 05:06:57PM +0800, Xi Ruoyao via Gcc-patches wrote: > On Tue, 2023-08-29 at 15:42 -0400, Marek Polacek via Gcc-patches wrote: > > + if (UNLIKELY (flag_hardened) > > + && (opt->code == OPT_D || opt->code == OPT_U)) > >

Re: RFC: Introduce -fhardened to enable security-related flags

2023-09-15 Thread Marek Polacek via Gcc-patches
On Wed, Aug 30, 2023 at 10:46:14AM +0200, Martin Uecker wrote: > > Improving the security of software has been a major trend in the recent > > years. Fortunately, GCC offers a wide variety of flags that enable extra > > hardening. These flags aren't enabled by default, though. And since > > ther

[PATCH] gcc: Introduce -fhardened

2023-09-15 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, powerpc64le-unknown-linux-gnu, and aarch64-unknown-linux-gnu; ok for trunk? -- >8 -- In I proposed -fhardened, a new umbrella option that enables a reasonable set of hardening flags.

[PATCH v5] c++: Move consteval folding to cp_fold_r

2023-09-13 Thread Marek Polacek via Gcc-patches
On Wed, Sep 13, 2023 at 05:57:47PM -0400, Jason Merrill wrote: > On 9/13/23 16:56, Marek Polacek wrote: > > On Tue, Sep 12, 2023 at 05:26:25PM -0400, Jason Merrill wrote: > > > On 9/8/23 14:24, Marek Polacek wrote: > > > > + switch (TREE_CODE (stmt)) > > >

[PATCH v4] c++: Move consteval folding to cp_fold_r

2023-09-13 Thread Marek Polacek via Gcc-patches
On Tue, Sep 12, 2023 at 05:26:25PM -0400, Jason Merrill wrote: > On 9/8/23 14:24, Marek Polacek wrote: > > + if (!in_immediate_context () > > + /* P2564: a subexpression of a manifestly constant-evaluated > > expression > > +or conversion is an

Re: [pushed] c++: __integer_pack with class argument [PR111357]

2023-09-12 Thread Marek Polacek via Gcc-patches
On Tue, Sep 12, 2023 at 01:27:44PM -0400, Jason Merrill via Gcc-patches wrote: > Tested x86_64-pc-linux-gnu, applying to trunk. > > -- 8< -- > > The argument might not already be an integer. > > PR c++/111357 > > gcc/cp/ChangeLog: > > * pt.cc (expand_integer_pack): Convert argument

[PATCH v3] c++: Move consteval folding to cp_fold_r

2023-09-08 Thread Marek Polacek via Gcc-patches
On Thu, Sep 07, 2023 at 02:32:51PM -0400, Jason Merrill wrote: > On 9/7/23 11:23, Marek Polacek wrote: > > On Tue, Sep 05, 2023 at 04:36:34PM -0400, Jason Merrill wrote: > > > On 9/5/23 15:59, Marek Polacek wrote: > > > > On Tue, Sep 05, 2023 at 10:52:04AM -0400, Jas

[PATCH v2] c++: Move consteval folding to cp_fold_r

2023-09-07 Thread Marek Polacek via Gcc-patches
On Tue, Sep 05, 2023 at 04:36:34PM -0400, Jason Merrill wrote: > On 9/5/23 15:59, Marek Polacek wrote: > > On Tue, Sep 05, 2023 at 10:52:04AM -0400, Jason Merrill wrote: > > > On 9/1/23 13:23, Marek Polacek wrote: > > > > Bootstrapped/regtested on x86

Re: [PATCH] c++: Move consteval folding to cp_fold_r

2023-09-05 Thread Marek Polacek via Gcc-patches
On Tue, Sep 05, 2023 at 10:52:04AM -0400, Jason Merrill wrote: > On 9/1/23 13:23, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > -- >8 -- > > > > In the review of P2564: > > <https://gcc.gnu.org/pipermai

Re: [PATCH] c++: improve verify_constant diagnostic [PR91483]

2023-09-01 Thread Marek Polacek via Gcc-patches
On Fri, Sep 01, 2023 at 08:00:01PM -0400, Marek Polacek via Gcc-patches wrote: >if (TREE_OVERFLOW_P (t)) > diff --git a/gcc/testsuite/g++.dg/diagnostic/constexpr3.C > b/gcc/testsuite/g++.dg/diagnostic/constexpr3.C > new file mode 100644 > index 000..b6e43a93664 > ---

[PATCH] c++: improve verify_constant diagnostic [PR91483]

2023-09-01 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- When verify_constant complains, it's pretty terse. Consider void test () { constexpr int i = 42; constexpr const int *p = &i; } where it says "'& i' is not a constant expression". OK, but why? With this patch

Re: [PATCH] c++: Move consteval folding to cp_fold_r

2023-09-01 Thread Marek Polacek via Gcc-patches
On Fri, Sep 01, 2023 at 01:23:48PM -0400, Marek Polacek via Gcc-patches wrote: > --- a/gcc/cp/cp-gimplify.cc > +++ b/gcc/cp/cp-gimplify.cc [...] > case ADDR_EXPR: >if (TREE_CODE (TREE_OPERAND (stmt, 0)) == FUNCTION_DECL > - && DECL_IMMEDIATE_FUNCTION_P

[PATCH] c++: Move consteval folding to cp_fold_r

2023-09-01 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- In the review of P2564: it turned out that in order to correctly handle an example in the paper, we should stop doing immediate evaluation in build_over_call a

Re: [PATCH] c++: CWG 2359, wrong copy-init with designated init [PR91319]

2023-08-30 Thread Marek Polacek via Gcc-patches
On Tue, Aug 29, 2023 at 04:44:11PM -0400, Jason Merrill wrote: > On 8/28/23 19:09, Marek Polacek wrote: > > On Mon, Aug 28, 2023 at 06:27:26PM -0400, Jason Merrill wrote: > > > On 8/25/23 12:44, Marek Polacek wrote: > > > > Bootstrapped/regtested on x86

Re: RFC: Introduce -fhardened to enable security-related flags

2023-08-29 Thread Marek Polacek via Gcc-patches
On Tue, Aug 29, 2023 at 09:11:35PM +0100, Sam James via Gcc-patches wrote: > > Marek Polacek via Gcc-patches writes: > > > Improving the security of software has been a major trend in the recent > > years. Fortunately, GCC offers a wide variety of flags that enable extra

Re: [PATCH v2] c++: tweaks for explicit conversion fns diagnostic

2023-08-29 Thread Marek Polacek via Gcc-patches
On Tue, Aug 29, 2023 at 04:42:33PM -0400, Jason Merrill wrote: > On 8/28/23 19:24, Marek Polacek wrote: > > On Fri, Aug 25, 2023 at 08:34:37PM -0400, Jason Merrill wrote: > > > On 8/25/23 19:37, Marek Polacek wrote: > > > > Bootstrapped/regtested on x86

RFC: Introduce -fhardened to enable security-related flags

2023-08-29 Thread Marek Polacek via Gcc-patches
Improving the security of software has been a major trend in the recent years. Fortunately, GCC offers a wide variety of flags that enable extra hardening. These flags aren't enabled by default, though. And since there are a lot of hardening flags, with more to come, it's been difficult to keep

[PATCH] c++: disallow constinit on functions [PR111173]

2023-08-29 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- [dcl.constinit]/1: The constinit specifier shall be applied only to a declaration of a variable with static or thread storage duration. and while we detect constinit int fn(); we weren't detecting using F = int(); co

[PATCH v2] c++: tweaks for explicit conversion fns diagnostic

2023-08-28 Thread Marek Polacek via Gcc-patches
On Fri, Aug 25, 2023 at 08:34:37PM -0400, Jason Merrill wrote: > On 8/25/23 19:37, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > -- >8 -- > > > > 1) When saying that a conversion is erroneous because it would

Re: [PATCH] c++: CWG 2359, wrong copy-init with designated init [PR91319]

2023-08-28 Thread Marek Polacek via Gcc-patches
On Mon, Aug 28, 2023 at 06:27:26PM -0400, Jason Merrill wrote: > On 8/25/23 12:44, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > -- >8 -- > > > > This CWG clarifies that designated initializer support > >

[PATCH] c++: tweaks for explicit conversion fns diagnostic

2023-08-25 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- 1) When saying that a conversion is erroneous because it would use an explicit constructor, it might be nice to show where exactly the explicit constructor is located. For example, with this patch: [...] explicit.C:4:12: note

Re: [PATCH] c++: use conversion_obstack_sentinel throughout

2023-08-25 Thread Marek Polacek via Gcc-patches
On Fri, Aug 25, 2023 at 12:33:31PM -0400, Patrick Palka via Gcc-patches wrote: > Boostrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk? Very nice. LGTM. > -- >8 -- > > This replaces manual memory management via conversion_obstack_alloc(0) > and obstack_free with the r

[PATCH] c++: CWG 2359, wrong copy-init with designated init [PR91319]

2023-08-25 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- This CWG clarifies that designated initializer support direct-initialization. Just be careful what Note 2 in [dcl.init.aggr]/4.2 says: "If the initialization is by designated-initializer-clause, its form determines whether copy

[PATCH] c++: implement P2564, consteval needs to propagate up [PR107687]

2023-08-23 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- This patch implements P2564, described at , whereby certain functions are promoted to consteval. For example: consteval int id(int i) { return i; } template constexpr int f(T t) { return t + id(t); // id causes

Re: [PATCH V4] Add warning options -W[no-]compare-distinct-pointer-types

2023-08-23 Thread Marek Polacek via Gcc-patches
On Thu, Aug 17, 2023 at 05:37:03PM +0200, Jose E. Marchesi via Gcc-patches wrote: > > > On Thu, 17 Aug 2023, Jose E. Marchesi via Gcc-patches wrote: > > > >> +@opindex Wcompare-distinct-pointer-types > >> +@item -Wcompare-distinct-pointer-types > > > > This @item should say @r{(C and Objective-C

Re: [committed] i386: Fix grammar typo in diagnostic

2023-08-07 Thread Marek Polacek via Gcc-patches
On Mon, Aug 07, 2023 at 10:12:35PM +0100, Jonathan Wakely via Gcc-patches wrote: > Committed as obvious. > > Less obvious (to me) is whether it's correct to say "GCC V13" here. I > don't think we refer to a version that way anywhere else, do we? > > Would "since GCC 13.1.0" be better? x86_field_

Re: [PATCH v2] analyzer: stash values for CPython plugin [PR107646]

2023-08-02 Thread Marek Polacek via Gcc-patches
On Wed, Aug 02, 2023 at 12:59:28PM -0400, David Malcolm wrote: > On Wed, 2023-08-02 at 12:20 -0400, Eric Feng wrote: > > Hi Eric, thanks for the updated patch. > > Overall, looks good to me, although I'd drop the "Exited." from the > "sorry" message (and thus from the dg-message directive), since

[PATCH] c++: parser cleanup, remove dummy arguments

2023-07-31 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Now that cp_parser_constant_expression accepts a null non_constant_p, we can transitively remove dummy arguments in the call chain. Running dg.exp and counting the # of is_rvalue_constant_expression calls from cp_parser_consta

Re: [PATCH] c++: fix ICE with is_really_empty_class [PR110106]

2023-07-25 Thread Marek Polacek via Gcc-patches
On Tue, Jul 25, 2023 at 04:24:39PM -0400, Jason Merrill wrote: > On 7/25/23 15:59, Marek Polacek wrote: > > Something like this, then? I see that cp_parser_initializer_clause et al > > offer further opportunities (because they sometimes use a dummy too) but > > this s

Re: [PATCH] c++: fix ICE with is_really_empty_class [PR110106]

2023-07-25 Thread Marek Polacek via Gcc-patches
On Fri, Jul 21, 2023 at 01:44:17PM -0400, Jason Merrill wrote: > On 7/20/23 17:58, Marek Polacek wrote: > > On Thu, Jul 20, 2023 at 03:51:32PM -0400, Marek Polacek wrote: > > > On Thu, Jul 20, 2023 at 02:37:07PM -0400, Jason Merrill wrote: > > > > On 7/20

[PATCH] c++: clear tf_partial et al in instantiate_template [PR108960]

2023-07-25 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- In we concluded that we might clear all flags except tf_warning_or_error when performing instantiate_template. PR c++/108960 gcc/cp/ChangeLog:

[PATCH v3] c++: fix ICE with constexpr ARRAY_REF [PR110382]

2023-07-25 Thread Marek Polacek via Gcc-patches
On Tue, Jul 25, 2023 at 11:15:07AM -0400, Jason Merrill wrote: > On 7/24/23 18:37, Marek Polacek wrote: > > On Sat, Jul 22, 2023 at 12:28:59AM -0400, Jason Merrill wrote: > > > On 7/21/23 18:38, Marek Polacek wrote: > > > > Bootstrapped/regtested on x86_64

[PATCH v2] c++: fix ICE with constexpr ARRAY_REF [PR110382]

2023-07-24 Thread Marek Polacek via Gcc-patches
On Sat, Jul 22, 2023 at 12:28:59AM -0400, Jason Merrill wrote: > On 7/21/23 18:38, Marek Polacek wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13? > > > > -- >8 -- > > > > This code in cxx_eval_array_reference has been hard to get righ

[PATCH] c++: fix ICE with constexpr ARRAY_REF [PR110382]

2023-07-21 Thread Marek Polacek via Gcc-patches
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13? -- >8 -- 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_ct

Re: [PATCH] c++: fix ICE with is_really_empty_class [PR110106]

2023-07-20 Thread Marek Polacek via Gcc-patches
On Thu, Jul 20, 2023 at 03:51:32PM -0400, Marek Polacek wrote: > On Thu, Jul 20, 2023 at 02:37:07PM -0400, Jason Merrill wrote: > > On 7/20/23 14:13, Marek Polacek wrote: > > > On Wed, Jul 19, 2023 at 10:11:27AM -0400, Patrick Palka wrote: > > > > On Tue, 18 Jul 2023,

Re: [PATCH] c++: fix ICE with is_really_empty_class [PR110106]

2023-07-20 Thread Marek Polacek via Gcc-patches
On Thu, Jul 20, 2023 at 02:37:07PM -0400, Jason Merrill wrote: > On 7/20/23 14:13, Marek Polacek wrote: > > On Wed, Jul 19, 2023 at 10:11:27AM -0400, Patrick Palka wrote: > > > On Tue, 18 Jul 2023, Marek Polacek via Gcc-patches wrote: > > > > > > > Bootst

Re: [PATCH] c++: fix ICE with is_really_empty_class [PR110106]

2023-07-20 Thread Marek Polacek via Gcc-patches
On Wed, Jul 19, 2023 at 10:11:27AM -0400, Patrick Palka wrote: > On Tue, 18 Jul 2023, Marek Polacek via Gcc-patches wrote: > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk and branches? > > Looks reasonable to me. Thanks. > Though I wonder if we could

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