public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug pending/17250] New:
@ 2004-08-31 12:53 gcc-bugzilla at gcc dot gnu dot org
2004-08-31 13:00 ` [Bug pending/17250] struct size falk at debian dot org
0 siblings, 1 reply; 2+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-08-31 12:53 UTC (permalink / raw)
To: gcc-bugs
NOTE: Defaulting component because reported component no longer exists
I just compile this code below and the sizeof yield wrong size for this stucture, haven't tried it at other machine yet. The code is:
typedef struct tagBITMAPFILEHEADER {
unsigned short bfType;
unsigned long bfSize;
unsigned short bfReserved1;
unsigned short bfReserved2;
unsigned long bfOffBits;
} BITMAPFILEHEADER;
When I try to find the size of the structure above using sizeof I get 16 but it supposed to be 14. I suspect that the bug is on the sizeof. And please notify me about this bug (fix, explaination, anything), thank you!
Environment:
System: Linux xhell 2.6.8xhell #3 Tue Aug 31 13:06:30 WIT 2004 i686 unknown unknown GNU/Linux
Architecture: i686
host: i486-slackware-linux-gnu
build: i486-slackware-linux-gnu
target: i486-slackware-linux-gnu
configured with: ../gcc-3.3.4/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux
How-To-Repeat:
Just compile any code that use sizeof to find out the size of the structure.
------- Additional Comments From david at xhell dot goo 2004-08-31 12:53 -------
Fix:
Haven't found any fix yet, but I get around by using sizeof to the elements of the structure
--
Product: gcc
Version: 3.3.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: pending
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: david at xhell dot goo
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i486-slackware-linux-gnu
GCC host triplet: i486-slackware-linux-gnu
GCC target triplet: i486-slackware-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17250
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug pending/17250] struct size
2004-08-31 12:53 [Bug pending/17250] New: gcc-bugzilla at gcc dot gnu dot org
@ 2004-08-31 13:00 ` falk at debian dot org
0 siblings, 0 replies; 2+ messages in thread
From: falk at debian dot org @ 2004-08-31 13:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2004-08-31 13:00 -------
(In reply to comment #0)
> typedef struct tagBITMAPFILEHEADER {
> unsigned short bfType;
> unsigned long bfSize;
> unsigned short bfReserved1;
> unsigned short bfReserved2;
> unsigned long bfOffBits;
> } BITMAPFILEHEADER;
>
> When I try to find the size of the structure above using sizeof I get 16 but
it supposed to be 14.
No, it's not; there are two padding bytes before bfSize to ensure it is 4-byte
aligned.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
Summary| |struct size
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17250
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-08-31 13:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-31 12:53 [Bug pending/17250] New: gcc-bugzilla at gcc dot gnu dot org
2004-08-31 13:00 ` [Bug pending/17250] struct size falk at debian dot org
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).