public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12176] New: Incorrect size for unions with very large bitfields
@ 2003-09-05 4:53 austern at apple dot com
2003-09-05 14:34 ` [Bug c++/12176] [ABI] " bangerth at dealii dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: austern at apple dot com @ 2003-09-05 4:53 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12176
Summary: Incorrect size for unions with very large bitfields
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: austern at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
Consider the following C++ code (it has to be C++, because C imposes limits on bitfield sizes):
extern "C" int printf(const char*,...);
union abcde {
char foo : 4096;
};
int main()
{
abcde x;
printf("%d\n", sizeof(x));
}
When I compile and run this program, I get the result "504". That makes no sense. I'm running it
on a system with 8-bit bytes, so the size of an abcde object should be 512. Somehow 8 bytes
have been lost.
Note that this is a problem only with unions, not with structs.
I've seen the same behavior with every version of gcc I've tested, from 2.95 through today's
mainline, and on both OS X and Linux.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12176] [ABI] Incorrect size for unions with very large bitfields
2003-09-05 4:53 [Bug c++/12176] New: Incorrect size for unions with very large bitfields austern at apple dot com
@ 2003-09-05 14:34 ` bangerth at dealii dot org
2003-09-08 19:19 ` austern at apple dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2003-09-05 14:34 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12176
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-09-05 14:34:16
date| |
Summary|Incorrect size for unions |[ABI] Incorrect size for
|with very large bitfields |unions with very large
| |bitfields
------- Additional Comments From bangerth at dealii dot org 2003-09-05 14:34 -------
Confirmed. That makes it incompatible with icc, which returns 512.
W.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12176] [ABI] Incorrect size for unions with very large bitfields
2003-09-05 4:53 [Bug c++/12176] New: Incorrect size for unions with very large bitfields austern at apple dot com
2003-09-05 14:34 ` [Bug c++/12176] [ABI] " bangerth at dealii dot org
@ 2003-09-08 19:19 ` austern at apple dot com
2003-09-15 0:51 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: austern at apple dot com @ 2003-09-08 19:19 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12176
austern at apple dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |austern at apple dot com
|dot org |
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12176] [ABI] Incorrect size for unions with very large bitfields
2003-09-05 4:53 [Bug c++/12176] New: Incorrect size for unions with very large bitfields austern at apple dot com
2003-09-05 14:34 ` [Bug c++/12176] [ABI] " bangerth at dealii dot org
2003-09-08 19:19 ` austern at apple dot com
@ 2003-09-15 0:51 ` pinskia at gcc dot gnu dot org
2003-09-15 0:59 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-15 0:51 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12176
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-09-15 00:31 -------
Fixed by:
2003-09-14 Mark Mitchell <mark@codesourcery.com>
* class.c (layout_class_type): Make DECL_MODE match TYPE_MODE for
an bit-field whose width exceeds that of its type.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12176] [ABI] Incorrect size for unions with very large bitfields
2003-09-05 4:53 [Bug c++/12176] New: Incorrect size for unions with very large bitfields austern at apple dot com
` (2 preceding siblings ...)
2003-09-15 0:51 ` pinskia at gcc dot gnu dot org
@ 2003-09-15 0:59 ` pinskia at gcc dot gnu dot org
2003-09-22 8:44 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-15 0:59 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12176
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-09-15 00:35 -------
That me reopen it because I did not test the patch at all, I should have might have been fixed by.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12176] [ABI] Incorrect size for unions with very large bitfields
2003-09-05 4:53 [Bug c++/12176] New: Incorrect size for unions with very large bitfields austern at apple dot com
` (3 preceding siblings ...)
2003-09-15 0:59 ` pinskia at gcc dot gnu dot org
@ 2003-09-22 8:44 ` pinskia at gcc dot gnu dot org
2003-12-26 23:32 ` [Bug c++/12176] " pinskia at gcc dot gnu dot org
2003-12-30 1:45 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-22 8:44 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12176
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |ASSIGNED
Keywords| |wrong-code
Target Milestone|--- |3.4
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-09-22 08:12 -------
Still happens.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12176] Incorrect size for unions with very large bitfields
2003-09-05 4:53 [Bug c++/12176] New: Incorrect size for unions with very large bitfields austern at apple dot com
` (4 preceding siblings ...)
2003-09-22 8:44 ` pinskia at gcc dot gnu dot org
@ 2003-12-26 23:32 ` pinskia at gcc dot gnu dot org
2003-12-30 1:45 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-26 23:32 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Keywords| |ABI
Summary|[ABI] Incorrect size for |Incorrect size for unions
|unions with very large |with very large bitfields
|bitfields |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12176
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12176] Incorrect size for unions with very large bitfields
2003-09-05 4:53 [Bug c++/12176] New: Incorrect size for unions with very large bitfields austern at apple dot com
` (5 preceding siblings ...)
2003-12-26 23:32 ` [Bug c++/12176] " pinskia at gcc dot gnu dot org
@ 2003-12-30 1:45 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-12-30 1:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2003-12-30 01:10 -------
This is a problem with -fabi-version=1; it does not occur with -fabi-version=2.
Since changing the size of the union would change the version 1 ABI, and since
this kind of code is very rare, I have closed this PR.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12176
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-12-30 1:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-05 4:53 [Bug c++/12176] New: Incorrect size for unions with very large bitfields austern at apple dot com
2003-09-05 14:34 ` [Bug c++/12176] [ABI] " bangerth at dealii dot org
2003-09-08 19:19 ` austern at apple dot com
2003-09-15 0:51 ` pinskia at gcc dot gnu dot org
2003-09-15 0:59 ` pinskia at gcc dot gnu dot org
2003-09-22 8:44 ` pinskia at gcc dot gnu dot org
2003-12-26 23:32 ` [Bug c++/12176] " pinskia at gcc dot gnu dot org
2003-12-30 1:45 ` mmitchel at gcc dot gnu 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).