public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: "gcc-bugzilla@gcc.gnu.org" <gcc-bugzilla@gcc.gnu.org>
Cc: "gcc-bugs@gcc.gnu.org" <gcc-bugs@gcc.gnu.org>
Subject: Re: [Bug c/41990] New: Incorrect stack setup on x86_64
Date: Sun, 08 Nov 2009 20:29:00 -0000 [thread overview]
Message-ID: <D143BF2E-C460-4E6A-83AB-A33F6E001B2F@gmail.com> (raw)
In-Reply-To: <bug-41990-11100@http.gcc.gnu.org/bugzilla/>
The x86_64 abi includes a red zone. So I doubt this a bug in gcc
unless netbsd's abi does not match what gcc does.
Sent from my iPhone
On Nov 8, 2009, at 12:25 PM, "cube at cubidou dot net" <gcc-bugzilla@gcc.gnu.org
> wrote:
> Provided a somewhat specific set of local variables, and as long as
> the code of
> the function doesn't make any other function calls, gcc will
> decrease %rsp but
> an incorrect and too small value. This leads to local variables being
> corrupted when the execution is interrupted; this happens notably
> in the
> kernel where interrupts use the stack of the thread they interrupted.
>
> The file that I will hopefully be able to attach to that report
> demonstrates
> the issue, if you look at the assembler output. With the function
> call
> commented out, gcc sets up the stack that way:
>
> movq %rsp, %rbp
> subq $152, %rsp
>
> and later access one of the local variables with:
>
> movl $0, -272(%rbp,%rax,4)
>
> When the function call is uncommented, the subq instruction here
> will correctly
> substract 272 to %rsp.
>
> I've compiled a 4.4.2 for the sole purpose of doing this bug
> report; NetBSD
> comes with 4.1.3 and that's where the bug was initially spotted.
>
>
> --
> Summary: Incorrect stack setup on x86_64
> Product: gcc
> Version: 4.4.2
> Status: UNCONFIRMED
> Severity: major
> Priority: P3
> Component: c
> AssignedTo: unassigned at gcc dot gnu dot org
> ReportedBy: cube at cubidou dot net
> GCC build triplet: x86_64-unknown-netbsd4.99.60
> GCC host triplet: x86_64-unknown-netbsd4.99.60
> GCC target triplet: x86_64-unknown-netbsd4.99.60
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41990
>
next prev parent reply other threads:[~2009-11-08 20:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-08 20:25 cube at cubidou dot net
2009-11-08 20:28 ` [Bug c/41990] " cube at cubidou dot net
2009-11-08 20:29 ` pinskia at gmail dot com
2009-11-08 20:29 ` Andrew Pinski [this message]
2009-11-08 20:37 ` cube at cubidou dot net
2009-11-08 20:38 ` cube at cubidou dot net
2009-11-08 20:56 ` cube at cubidou dot net
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=D143BF2E-C460-4E6A-83AB-A33F6E001B2F@gmail.com \
--to=pinskia@gmail.com \
--cc=gcc-bugs@gcc.gnu.org \
--cc=gcc-bugzilla@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).