linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Li <christ.li@gmail.com>
To: Dan Carpenter <error27@gmail.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: typedefs and alignment
Date: Wed, 10 Feb 2010 01:46:39 -0800	[thread overview]
Message-ID: <70318cbf1002100146r4b1ae748ida389c688d3fc4ce@mail.gmail.com> (raw)
In-Reply-To: <20100208103501.GA14210@bicker>

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

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.

Can you try this one line patch?

Thanks

Chris

[-- Attachment #2: 0002-Pointer-don-t-inherent-the-alignment-from-base-type.patch --]
[-- Type: application/octet-stream, Size: 756 bytes --]

From 27af04c47164d6c6a49f64c568d24d99a902e449 Mon Sep 17 00:00:00 2001
From: Christopher Li <chrisl@heli.(none)>
Date: Wed, 10 Feb 2010 01:32:30 -0800
Subject: [PATCH 2/2] Pointer don't inherent the alignment from base type

Signed-off-by: Christopher Li <sparse@chrisli.org>
---
 parse.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/parse.c b/parse.c
index 66b8112..f81b19f 100644
--- a/parse.c
+++ b/parse.c
@@ -1698,6 +1698,7 @@ static struct token *pointer(struct token *token, struct decl_state *ctx)
 		ctx->ctype.base_type = ptr;
 		ctx->ctype.as = 0;
 		ctx->ctype.contexts = NULL;
+		ctx->ctype.alignment = 0;
 
 		token = handle_qualifiers(token->next, ctx);
 		ctx->ctype.base_type->endpos = token->pos;
-- 
1.6.2.5


  parent reply	other threads:[~2010-02-10  9:46 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
2010-02-10  9:46 ` Chris Li [this message]
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=70318cbf1002100146r4b1ae748ida389c688d3fc4ce@mail.gmail.com \
    --to=christ.li@gmail.com \
    --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).