[LLVMbugs] [Bug 11325] New: Clang doesn't detect a code problem with enum deceleration that Sun's CC detects

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 7 04:59:10 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11325

             Bug #: 11325
           Summary: Clang doesn't detect a code problem with enum
                    deceleration that Sun's CC detects
           Product: clang
           Version: 2.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: avarab at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


On the following program:

    static enum { ABORT, FOO } first_enum;
    static enum { ERROR, BAR } second_enum;

    int main (void) {
        first_enum  = ABORT;
        second_enum = ABORT;
        return 0;
    }

Clang 2.9 will only (irrelevant to this example) produce warnings
about first_enum and second_enum being unused, but it doesn't detect
that we're assigning a constant declared for one enum to another.

Sun Studio 12 Update 1 detects this:

    $ cc -o enum enum.c
    "enum.c", line 6: warning: enum type mismatch: op "="

Which is a warning that goes away with this change:

    -    second_enum = ABORT;
    +    second_enum = ERROR;

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list