public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/110728] should __attribute__((cleanup())) callback get invoked for indirect edges of asm goto
Date: Thu, 03 Aug 2023 16:11:45 +0000 [thread overview]
Message-ID: <bug-110728-4-emdX6cYRsf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110728-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110728
--- Comment #11 from Michael Matz <matz at gcc dot gnu.org> ---
(In reply to Michael Matz from comment #9)
> Just for completeness: I agree with Andrew that the initial code example in
> comment #0 doesn't show any problem. The edge from asmgoto to l0 doesn't
> cross
> the scope of the variable, hence no cleanups should be run. The cleanup
> call that is there is from the edge that leaves the function scope before
> return, and it's placed correctly.
I was reminded that this is incorrect. Though it isn't documented that way
(AFAICS) the cleanup attribute itself create a scope, as we're using the
try/finally middle-end mechanisms to implement this attribute. We can't change
that behaviour anymore of course, so that's how it has to be: jumping in front
of the decl of 'x' _is_ supposed to run the cleanup.
The initial example essentially boils down to:
void test4(void) {
l0:;
try { /* implicit scope per instantiation of __cleanup__ variable */
int x __attribute__((cleanup(test4cleanup)));
asm goto("# %l0"::::l0); /* <-- leaves scope created by x */
} finally {
test4cleanup();
}
}
next prev parent reply other threads:[~2023-08-03 16:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 21:23 [Bug c/110728] New: " ndesaulniers at google dot com
2023-07-18 21:29 ` [Bug c/110728] " pinskia at gcc dot gnu.org
2023-07-18 21:32 ` pinskia at gcc dot gnu.org
2023-07-18 21:33 ` pinskia at gcc dot gnu.org
2023-07-18 21:48 ` pinskia at gcc dot gnu.org
2023-07-18 23:22 ` rjmccall at gmail dot com
2023-07-19 7:01 ` rguenth at gcc dot gnu.org
2023-07-19 16:46 ` [Bug middle-end/110728] " ndesaulniers at google dot com
2023-07-19 17:16 ` rjmccall at gmail dot com
2023-08-03 14:38 ` matz at gcc dot gnu.org
2023-08-03 16:00 ` ndesaulniers at google dot com
2023-08-03 16:11 ` matz at gcc dot gnu.org [this message]
2023-08-03 17:07 ` rjmccall at gmail dot com
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=bug-110728-4-emdX6cYRsf@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/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).