[LLVMbugs] [Bug 11905] New: struct{bool} -> int function argument coercion emits an invalid store on ARM

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 2 04:57:58 PST 2012


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

             Bug #: 11905
           Summary: struct{bool} -> int function argument coercion emits
                    an invalid store on ARM
           Product: clang
           Version: trunk
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


# cat 1.cc

struct S {
  bool qq;
};

bool f(S a) {
  return a.qq;
}

# clang++  -target arm-linux-gnueabi 1.cc -O0 -S -emit-llvm -o 1.ll
# cat 1.ll

; ModuleID = '1.cc'
target datalayout =
"e-p:32:32:32-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:64:128-a0:0:64-n32-S64"
target triple = "armv4t--linux-gnueabi"

%struct.S = type { i8 }

define zeroext i1 @_Z1f1S([1 x i32] %a.coerce0) nounwind {
entry:
  %a = alloca %struct.S, align 4
  %0 = bitcast %struct.S* %a to { [1 x i32] }*
  %1 = getelementptr { [1 x i32] }* %0, i32 0, i32 0
  store [1 x i32] %a.coerce0, [1 x i32]* %1
  %qq = getelementptr inbounds %struct.S* %a, i32 0, i32 0
  %2 = load i8* %qq, align 1
  %tobool = trunc i8 %2 to i1
  ret i1 %tobool
}

Store at the fourth line of the function copies 4-byte %a.coerce0 into 1-byte
%a.

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