From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Jonathan Wakely <jwakely@redhat.com>
Subject: Re: [PATCH] c++, v4: Implement C++26 P2741R3 - user-generated static_assert messages [PR110348]
Date: Tue, 28 Nov 2023 18:52:34 +0100 [thread overview]
Message-ID: <ZWYo4glksozKbFh6@tucnak> (raw)
In-Reply-To: <aafda314-903b-4c12-a421-785eb5df4098@redhat.com>
On Tue, Nov 28, 2023 at 11:31:48AM -0500, Jason Merrill wrote:
> > + if (len)
> > + {
> > + if (data)
> > + msg = c_getstr (data);
> > + if (msg == NULL)
> > + buf = XNEWVEC (char, len);
>
> Jonathan pointed out elsewhere that this gets leaked if error return
> prevents us from getting to the XDELETEVEC.
Seems it is just one of the returns, so ok to just XDELETEVEC there,
or should I add some RAII for that? The other error return after
this point is for !len case and so buf isn't allocated.
2023-11-28 Jakub Jelinek <jakub@redhat.com>
* semantics.cc (finish_static_assert): Free buf on error return.
--- gcc/cp/semantics.cc.jj 2023-11-25 10:28:27.778191561 +0100
+++ gcc/cp/semantics.cc 2023-11-28 18:50:00.094733919 +0100
@@ -11582,6 +11582,7 @@ finish_static_assert (tree condition, tr
error_at (location,
"%<static_assert%> message %<data()[%d]%> "
"must be a constant expression", i);
+ XDELETEVEC (buf);
return;
}
if (msg == NULL)
Jakub
next prev parent reply other threads:[~2023-11-28 17:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 14:30 [PATCH] c++: " Jakub Jelinek
2023-09-18 17:21 ` [PATCH] c++, v2: " Jakub Jelinek
2023-10-27 1:21 ` Jason Merrill
2023-11-17 14:18 ` Jason Merrill
2023-11-17 14:22 ` Jakub Jelinek
2023-11-21 17:17 ` [PATCH] c++, v3: " Jakub Jelinek
2023-11-21 17:23 ` Jakub Jelinek
2023-11-21 21:44 ` Jason Merrill
2023-11-21 22:19 ` Jakub Jelinek
2023-11-21 22:51 ` Jakub Jelinek
2023-11-22 3:51 ` Jason Merrill
2023-11-22 10:00 ` [PATCH] c++, v4: " Jakub Jelinek
2023-11-22 21:53 ` Jason Merrill
2023-11-23 8:32 ` Jakub Jelinek
2023-11-28 16:31 ` Jason Merrill
2023-11-28 17:52 ` Jakub Jelinek [this message]
2023-11-28 21:33 ` Jason Merrill
2023-11-28 17:08 ` Fix 'g++.dg/cpp26/static_assert1.C' for '-fno-exceptions' configurations (was: [PATCH] c++, v4: Implement C++26 P2741R3 - user-generated static_assert messages [PR110348]) Thomas Schwinge
2023-11-28 17:11 ` Fix 'g++.dg/cpp26/static_assert1.C' for '-fno-exceptions' configurations Jason Merrill
2023-11-29 13:19 ` Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZWYo4glksozKbFh6@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=jwakely@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).