[LLVMbugs] [Bug 9900] New: scalarrepl-ssa can produce invalid code for zero sized array members

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 11 08:50:29 PDT 2011


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

           Summary: scalarrepl-ssa can produce invalid code for zero sized
                    array members
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Running opt -scalarrepl-ssa on

-----------------------------
arget datalayout = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
%foobar = type { i32, [0 x i8] }

define void @f(%foobar %arg) {
  %tmp = alloca %foobar
  store %foobar %arg, %foobar* %tmp
  %tmp113 = bitcast %foobar* %tmp to i8*
  ret void
}
---------------------------

Will produce

-------------------------------
target datalayout = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"

%foobar = type { i32, [0 x i8] }

define void @f(%foobar %arg) {
  %arg1 = extractvalue %foobar %arg, 0
  %arg2 = extractvalue %foobar %arg, 1
  ret void
}
----------------------------------

llc is happy with the first code, but crashes on the second on
SelectionDAGBuilder::visitExtractValue when it tries to access the first
element of a zero sized ValValueVTs.

We have two options. One is declaring zero sized array values illegal and
fixing scalarrepl to not produce them and the verifier to check for them.
Another one is making CodeGen handle them correctly.

I am don't see much value is having zero size array values, so I am reporting
this on scalarrrepl. Let me know if you think we should allow them and fix
CodeGen instead.

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