[LLVMbugs] [Bug 2192] New: Struct initializer initlistexpr wrong from sema

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Apr 4 11:45:12 PDT 2008


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

           Summary: Struct initializer initlistexpr wrong from sema
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org
                CC: llvmbugs at cs.uiuc.edu, snaroff at apple.com


Consider:
typedef struct mark_header_tag {
 unsigned char mark[7];
} mark_header_t;
int is_rar_archive(int fd) {
        mark_header_t rar_hdr = {0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00};
        foo(rar_hdr);

        return 0;
}

Sema currently only creates one initlistexpr:

 (DeclStmt 0x906a90 <line:5:23, :0:0>
    0x9068d0 "mark_header_t rar_hdr =
      (InitListExpr 0x9069e0 <t.c:5:33, col:74> 'mark_header_t':'struct
mark_header_tag'
        (ImplicitCastExpr 0x906a20 <col:34> 'unsigned char'
          (IntegerLiteral 0x906900 <col:34> 'int' 82))
        (ImplicitCastExpr 0x906a30 <col:40> 'unsigned char'
          (IntegerLiteral 0x906920 <col:40> 'int' 97))
        (ImplicitCastExpr 0x906a40 <col:46> 'unsigned char'
          (IntegerLiteral 0x906940 <col:46> 'int' 114))
        (ImplicitCastExpr 0x906a50 <col:52> 'unsigned char'
          (IntegerLiteral 0x906960 <col:52> 'int' 33))
        (ImplicitCastExpr 0x906a60 <col:58> 'unsigned char'
          (IntegerLiteral 0x906980 <col:58> 'int' 26))
        (ImplicitCastExpr 0x906a70 <col:64> 'unsigned char'
          (IntegerLiteral 0x9069a0 <col:64> 'int' 7))
        (ImplicitCastExpr 0x906a80 <col:70> 'unsigned char'
          (IntegerLiteral 0x9069c0 <col:70> 'int' 0)))"

This causes codegen to miscompile the example.  We need to start making
"implicit" initlistexprs as we've previously discussed.


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