public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/46636] New: attribute aligned is documented as using bytes, uses addressable units instead.
@ 2010-11-24 7:16 amylaar at gcc dot gnu.org
2010-11-24 11:59 ` [Bug c/46636] " amylaar at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: amylaar at gcc dot gnu.org @ 2010-11-24 7:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46636
Summary: attribute aligned is documented as using bytes, uses
addressable units instead.
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: amylaar@gcc.gnu.org
Blocks: 46489
attribute aligned - and also linked to that pragma align - are documented
as specifying an alignment in bytes. However, the implementation uses
BITS_PER_UNIT, which could be 1 on a bit-addressed architecture, or
something largish like 16, 32 or 36 on a word-addressed architecture.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/46636] attribute aligned is documented as using bytes, uses addressable units instead.
2010-11-24 7:16 [Bug c/46636] New: attribute aligned is documented as using bytes, uses addressable units instead amylaar at gcc dot gnu.org
@ 2010-11-24 11:59 ` amylaar at gcc dot gnu.org
2010-11-24 12:18 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: amylaar at gcc dot gnu.org @ 2010-11-24 11:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46636
--- Comment #1 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> 2010-11-24 10:34:40 UTC ---
Alignof also uses units at the moment, anthough the documentation
suggests it should be bytes.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/46636] attribute aligned is documented as using bytes, uses addressable units instead.
2010-11-24 7:16 [Bug c/46636] New: attribute aligned is documented as using bytes, uses addressable units instead amylaar at gcc dot gnu.org
2010-11-24 11:59 ` [Bug c/46636] " amylaar at gcc dot gnu.org
@ 2010-11-24 12:18 ` rguenth at gcc dot gnu.org
2010-11-24 14:36 ` amylaar at gcc dot gnu.org
2010-11-24 16:07 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-24 12:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46636
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-24 12:08:54 UTC ---
Well, on these targets "bytes" really are larger I suppose (for example
each character in a C string constant consumes BITS_PER_UNIT).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/46636] attribute aligned is documented as using bytes, uses addressable units instead.
2010-11-24 7:16 [Bug c/46636] New: attribute aligned is documented as using bytes, uses addressable units instead amylaar at gcc dot gnu.org
2010-11-24 11:59 ` [Bug c/46636] " amylaar at gcc dot gnu.org
2010-11-24 12:18 ` rguenth at gcc dot gnu.org
@ 2010-11-24 14:36 ` amylaar at gcc dot gnu.org
2010-11-24 16:07 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: amylaar at gcc dot gnu.org @ 2010-11-24 14:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46636
--- Comment #3 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> 2010-11-24 14:26:52 UTC ---
(In reply to comment #2)
> Well, on these targets "bytes" really are larger I suppose (for example
> each character in a C string constant consumes BITS_PER_UNIT).
A 32 bit wide character is not a byte, it is four bytes.
The documentation states:
You can also specify the alignment of structure fields. For example, to
create a double-word aligned @code{int} pair, you could write:
@smallexample
struct foo @{ int x[2] __attribute__ ((aligned (8))); @};
@end smallexample
If, on a 32-bit word-addressed target, this is aligned to 8 words
instead of two, that would be unexpected.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/46636] attribute aligned is documented as using bytes, uses addressable units instead.
2010-11-24 7:16 [Bug c/46636] New: attribute aligned is documented as using bytes, uses addressable units instead amylaar at gcc dot gnu.org
` (2 preceding siblings ...)
2010-11-24 14:36 ` amylaar at gcc dot gnu.org
@ 2010-11-24 16:07 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2010-11-24 16:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46636
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2010-11-24 15:32:00 UTC ---
On Wed, 24 Nov 2010, rguenth at gcc dot gnu.org wrote:
> Well, on these targets "bytes" really are larger I suppose (for example
> each character in a C string constant consumes BITS_PER_UNIT).
A character in a C string constant consumes TYPE_PRECISION
(char_type_node) bits. Any attribute defined in terms of bytes - such as
"aligned" or "vector_size" - should work in bytes in the C sense, that is
units of TYPE_PRECISION (char_type_node) bits. The __SIZEOF_* macros
should also count in bytes, but it appears they wrongly work in
BITS_PER_UNIT (via TYPE_SIZE_UNIT) at present - although
c_sizeof_or_alignof_type gets this right for the actual "sizeof" operator.
QImode, however, I think corresponds to BITS_PER_UNIT bits (and SImode to
4*BITS_PER_UNIT, etc.).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-11-24 15:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-24 7:16 [Bug c/46636] New: attribute aligned is documented as using bytes, uses addressable units instead amylaar at gcc dot gnu.org
2010-11-24 11:59 ` [Bug c/46636] " amylaar at gcc dot gnu.org
2010-11-24 12:18 ` rguenth at gcc dot gnu.org
2010-11-24 14:36 ` amylaar at gcc dot gnu.org
2010-11-24 16:07 ` joseph at codesourcery dot com
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).