public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Mohamed Shafi <shafitvm@gmail.com>
Cc: gcc-help@gcc.gnu.org, Rohit Arul Raj <rohitarulraj@gmail.com>
Subject: Re: structure packing
Date: Fri, 22 May 2009 13:51:00 -0000	[thread overview]
Message-ID: <m3hbzds22t.fsf@google.com> (raw)
In-Reply-To: <ba0bd44d0905212356j7064835dw4b215ef27d15b30d@mail.gmail.com> (Mohamed Shafi's message of "Fri\, 22 May 2009 12\:26\:00 +0530")

Mohamed Shafi <shafitvm@gmail.com> writes:

>     I thought so. With STRICT_ALIGNMENT = 1 the compiler makes sure
> that all access are aligned. So irrespective of whether the structure
> is aligned or not to be safe it generates byte access. Am i right?
> If so in the given example the base address is 0 and the offset will
> be known to the compiler. If the compiler is aware of these two
> information can't it decide whether the structure is aligned or not?

I'm not sure.  If the compiler knows the alignment of the specific
object, it may take that into account to override the packed attribute.
However, I would not be surprised if a specific case like casting 0 to
an address does not record the alignment even though it is known, since
that is such an odd case.

Ian

  reply	other threads:[~2009-05-22 13:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ba0bd44d0905210723n5e6e85f5rea8b2b52c381d5d9@mail.gmail.com>
2009-05-21 14:39 ` Mohamed Shafi
2009-05-22  6:39   ` Ian Lance Taylor
2009-05-22  8:01     ` Mohamed Shafi
2009-05-22 13:51       ` Ian Lance Taylor [this message]
2014-01-16 10:45 vijay nag
2014-01-16 11:34 ` David Brown
  -- strict thread matches above, loose matches on Subject: below --
2008-10-20  7:52 Duft Markus
2008-10-20  7:33 Duft Markus

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=m3hbzds22t.fsf@google.com \
    --to=iant@google.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=rohitarulraj@gmail.com \
    --cc=shafitvm@gmail.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).