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]

[Bug c/15236] New: pedantic switch modifies treatment of non-ISO compliant enumerations


The GNU compiler treats some non-ISO compliant enumerations as being 64 bit 
enumerations rather than 32-bit enumerations.  Specifying the "-pedantic" 
command line switch not only warns about the enumeration being non-ISO 
compliant, but it also forces those enumerations to be treated as 32-bit 
enumerations.  Being a switch to generate warnings about non-ISO compliance, 
it should do just that -- warn the user.  It should not change the behavior of 
the compiler.

I have generated the .i and .s files, but do not see a way to attach them to 
this report.  No matter, the program to reproduce the problem is only 12 lines 
long.

The problem exhibits itself with:
 - gcc 3.3.3 on Fedora Core 2 Linux
 - gcc 3.3.1 on Cygwin

The command line for default behavior of gcc is:
  gcc enum.c -o enum

The command line for exhibiting the problem is:
  gcc -pedantic enum.c -o enum

The source file enum.c is:

#include <stdio.h>

typedef enum MyEnum
{
  A = -1,
  B = 0xFFFFFFFF
} MyEnum;

int main()
{
  printf("sizeof(MyEnum) = %d\n", sizeof(MyEnum));
}

-- 
           Summary: pedantic switch modifies treatment of non-ISO compliant
                    enumerations
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kevin dot hall at motioneng dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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