[Bug c/17844] New: -fshort-enums: ISO/IEC 9899:1999 : wrong size of identifier in enumerator list

heinrich dot brand at fujitsu-siemens dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 5 14:53:00 GMT 2004


With option -fshort-enums is the size of an identifier in an enumerator list 1 
and not sizeof(int) == 4 as required by ISO/IEC 9899:1999. 

Reference:

ISO/IEC 9899:1999(E)
6.7.2.2 Enumeration specifiers
page 105
Semantics
The identifiers in an enumerator list are declared as constants 
that have type int ...



Example:

enum v { yes, no };
main(){ 
 if( sizeof(yes) != sizeof(int) ){ 
  printf("ISO/IEC 9899:1999 : " 
         "wrong size of identifier in enumerator list " 
         ": %d\n", 
         sizeof(yes));
  return 1;
 } else { 
  return 0; 
 }
       
}

-- 
           Summary: -fshort-enums: ISO/IEC 9899:1999 : wrong size of
                    identifier in enumerator list
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: heinrich dot brand at fujitsu-siemens 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


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17844



More information about the Gcc-bugs mailing list