[LLVMbugs] [Bug 10065] New: Bogus pedantic warning when using offsetof(type, field[n])

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 2 07:23:49 PDT 2011


           Summary: Bogus pedantic warning when using offsetof(type,
           Product: clang
           Version: 2.9
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rb at ravenbrook.com
                CC: llvmbugs at cs.uiuc.edu

If you use an expression like

  offsetof(struct hello_s, stuff[99])

when compiling with -ansi -pedantic, you get a warning "using extended field
designator is an extension".  The C89 standard says:

"The member-designator shall be such that given

         static  type t;

then the expression &(t.  member-designator ) evaluates to an address

I can't find anything which says this is any kind of extension.  And,  for what
it's worth, gcc's pedantic mode doesn't complain.

Test code attached.

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