[LLVMbugs] [Bug 2354] New: readdir broken with -D_FILE_OFFSET_BITS=64 ( asm on func discarded)

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu May 22 04:56:48 PDT 2008


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

           Summary: readdir broken with -D_FILE_OFFSET_BITS=64 (asm on func
                    discarded)
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: parser
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


Per description; simple real testcase:
#include <stdio.h>
#include <dirent.h>
int main() {        
struct dirent *dp;
DIR *dirp = opendir(".");
dp = readdir(dirp);
puts(dp->d_name);
}

Should list the first file in the current dir. With "clang -emit-llvm
-D_FILE_OFFSET_BITS=64", the first 8 letters get cut off.  The issue is the
following declaration:

extern struct dirent *readdir (DIR *__dirp) __asm__ ("" "readdir64")
     __attribute__ ((__nonnull__ (1)));

clang's parser is lazy, so it decides to throw away the __asm__ bit.  (The
relevant code is in Parser::ParseInitDeclaratorListAfterFirstDeclarator.)  This
makes everything break, of course.

Bug found while trying to build ruby with clang.  And it took quite a while to
figure out what was going on...


-- 
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