From: Christopher Li <sparse@chrisli.org>
To: Dan Carpenter <error27@gmail.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: typedefs and alignment
Date: Tue, 9 Feb 2010 17:36:27 -0800 [thread overview]
Message-ID: <70318cbf1002091736s3ca92377pfc97c2fcf9e15478@mail.gmail.com> (raw)
In-Reply-To: <20100208103501.GA14210@bicker>
On Mon, Feb 8, 2010 at 2:35 AM, Dan Carpenter <error27@gmail.com> wrote:
> I've found an issue handling typedefs and alignment. In the appended
> code sparse things 'ptr' has to be aligned so the size of 'bar' is 1024.
> I haven't looked at how to fix this at all, I thought I would ask the
> experts for hints first.
Hmm, there is a bug there.
For the simplified code:
typedef struct aligned_struct {
int a;
} __attribute__ ((aligned(1024))) ali_t;
ali_t *ppr;
running test-parsing will show:
.align 1024
struct aligned_struct [usertype] *[addressable] [toplevel] ppr
I am looking at it right now.
Chris
>
> regards,
> dan carpenter
>
> #include <stdio.h>
>
> typedef struct aligned_struct {
> int a;
> } __attribute__ ((aligned(1024))) ali_t;
>
> struct foo {
> int b;
> ali_t *ptr;
> };
It does look wrong. The easier way to expose it
>
> int mainx(void)
> {
> struct foo bar;
>
> printf("%d\n", sizeof(bar));
> return 0;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-02-10 1:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-08 10:35 typedefs and alignment Dan Carpenter
2010-02-10 1:36 ` Christopher Li [this message]
2010-02-10 9:46 ` Chris Li
2010-02-10 10:11 ` Dan Carpenter
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=70318cbf1002091736s3ca92377pfc97c2fcf9e15478@mail.gmail.com \
--to=sparse@chrisli.org \
--cc=error27@gmail.com \
--cc=linux-sparse@vger.kernel.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 NNTP newsgroup(s).