From: Jakub Jelinek <jakub@redhat.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, nd <nd@arm.com>
Subject: Re: [PATCH v2] Fix PR64242
Date: Fri, 07 Dec 2018 15:55:00 -0000 [thread overview]
Message-ID: <20181207155542.GL12380@tucnak> (raw)
In-Reply-To: <DB5PR08MB10302ABC70FBEA6ED34A646083AA0@DB5PR08MB1030.eurprd08.prod.outlook.com>
On Fri, Dec 07, 2018 at 02:52:48PM +0000, Wilco Dijkstra wrote:
> - struct __attribute__((aligned (32))) S { int a[4]; } s;
> - bar (&s);
Any reason to remove the above?
> p = __builtin_alloca (x);
> + q = __builtin_alloca (x);
> if (!__builtin_setjmp (buf))
> broken_longjmp (buf);
>
> + /* Compute expected next alloca offset - some targets don't align properly
> + and allocate too much. */
> + p = q + (q - p);
This is UB, pointer difference is only defined within the same object.
So, you can only do such subtraction in some integral type rather than as
pointer subtraction.
> +
> /* Fails if stack pointer corrupted. */
> - q = __builtin_alloca (x);
> - if (foo (p) < foo (q))
> - {
> - if (foo (q) - foo (p) >= 1024)
> - abort ();
> - }
> - else if (foo (p) - foo (q) >= 1024)
> + if (p != __builtin_alloca (x))
And I'm not sure you have a guarantee that every zero sized alloca is at the
same offset from the previous one.
Jakub
next prev parent reply other threads:[~2018-12-07 15:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-07 14:52 Wilco Dijkstra
2018-12-07 15:55 ` Jakub Jelinek [this message]
2018-12-07 16:19 ` Wilco Dijkstra
2018-12-07 16:23 ` Jakub Jelinek
2018-12-07 16:49 ` Wilco Dijkstra
2019-01-10 13:06 ` Wilco Dijkstra
2019-05-28 17:33 Wilco Dijkstra
2019-05-31 21:41 ` Jeff Law
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=20181207155542.GL12380@tucnak \
--to=jakub@redhat.com \
--cc=Wilco.Dijkstra@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nd@arm.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).