[LLVMbugs] [Bug 6822] New: clang assertion when compiling reinterpret_cast<float3>(float4_var)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 12 10:41:27 PDT 2010


           Summary: clang assertion when compiling
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bixia.zheng at amd.com
                CC: llvmbugs at cs.uiuc.edu

float3 and float4 are defined by the test case below.
Clang seems to believe that BitWidth(float3) = 4 * BitWidth(float) while LLVM
Core VectorType::getBitWidth(float3) returns 3 * BitWidth(float). This
discrepancy causes the assertion error. Where are you doing to fix this, Clang
or LLVM Core?
Thanks for your attention to this bug!

command line:
clang -emit-llvm -ObjC++ -S vector03.c

error message:
Assertion failed: castIsValid(getOpcode(), S, Ty) && "Illegal BitCast", file
... llvm\lib\VMCore\Instructions.cpp, line 2732

test case:
typedef float float4 __attribute__((ext_vector_type(4)));
typedef float float3 __attribute__((ext_vector_type(3)));
//typedef float float2 __attribute__((ext_vector_type(2)));

typedef struct _mystruct {
    float3 field1;
    float field2;
    float field3;
    float field4;
    float field5;
} mystruct;

float3 foo() {
  float3 vec3;
  float4 vec4;
  vec4 = sizeof(mystruct);
  vec3 = reinterpret_cast<float3>(vec4);

  return vec3;

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