[LLVMbugs] [Bug 4116] New: promotion of bit-field differs from gcc

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri May 1 12:18:48 PDT 2009


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

           Summary: promotion of bit-field differs from gcc
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: daniel at zuster.org
                CC: llvmbugs at cs.uiuc.edu


clang and llvm-gcc differ in the promotion rules for bit-fields. I'm not sure
yet who is correct, filing while I try to figure it out.

--
ddunbar at lordcrumb:tmp$ cat t.c
long long f0(void) {
  struct { unsigned f0 : 16; } x = { 18 };
  struct { unsigned f1 : 16; } y = { 22 };
  return (long long) (x.f0 - y.f1);
}

long long f1(void) {
  struct { unsigned f0 : 16; } x = { 18 };
  struct { unsigned f1     ; } y = { 22 };
  return (long long) (x.f0 - y.f1);
}
ddunbar at lordcrumb:tmp$ llvm-gcc -O3 -emit-llvm -S -o - t.c
; ModuleID = 't.c'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin10.0"

define i64 @f0() nounwind readnone ssp {
entry:
        ret i64 -4
}

define i64 @f1() nounwind readnone ssp {
entry:
        ret i64 4294967292
}
ddunbar at lordcrumb:tmp$ clang -O3 -emit-llvm -S -o - t.c
; ModuleID = 't.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "x86_64-apple-darwin10.0"

define i64 @f0() nounwind readnone {
entry:
        ret i64 4294967292
}

define i64 @f1() nounwind readnone {
entry:
        ret i64 4294967292
}
--


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