This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/7362: "Pack" attribute causes compiler error on empty structs


>Number:         7362
>Category:       c++
>Synopsis:       "Pack" attribute causes compiler error on empty structs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 20 11:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Pete Gonzalez <gonz@bluel.com>
>Release:        gcc version 2.95.2
>Organization:
>Environment:
Occurs on the GCC shipping with the current distribution of Debian Linux.  Originally discovered with GCC 3.0.4 on Win32.
>Description:
The "__attribute__((packed))" modifier cannot be applied to an empty struct because it produces an Internal Compiler Error.
>How-To-Repeat:
int test() {
  __attribute__((packed))
  struct TEmpty { };  // <-- crash here
}
>Fix:
The correct behavior is probably to reduce the size of the struct from 4 to 1.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]