<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Shader fails to build in LLVMpipe, aborts program"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=61036">61036</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Shader fails to build in LLVMpipe, aborts program
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>freedesktop@fluggo.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86 (IA32)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=75019" name="attach_75019" title="Shader test program">attachment 75019</a> <a href="attachment.cgi?id=75019&action=edit" title="Shader test program">[details]</a></span>
Shader test program

I'm aware that some of the problems with shaders in LLVMpipe depend on the
version of LLVM installed, so I tested the attached program with LLVM 3.0 and
3.2, and both fail in Mesa 9.0.1.

Building with LLVM 3.2 and running the attached program yields:

shader1:
/home/james/software/extern/llvm-3.2.src/lib/VMCore/Instructions.cpp:1487:
llvm::InsertElementInst::InsertElementInst(llvm::Value*, llvm::Value*,
llvm::Value*, const llvm::Twine&, llvm::Instruction*): Assertion
`isValidOperands(Vec, Elt, Index) && "Invalid insertelement instruction
operands!"' failed.
Aborted


The backtrace:

#0  0xb7fe1430 in __kernel_vsyscall ()
#1  0xb5eb6941 in *__GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb5eb9d72 in *__GI_abort () at abort.c:92
#3  0xb5eafb58 in *__GI___assert_fail (
    assertion=0xb7975fa8 "isValidOperands(Vec, Elt, Index) && \"Invalid
insertelement instruction operands!\"", 
    file=0xb7975180
"/home/james/software/extern/llvm-3.2.src/lib/VMCore/Instructions.cpp",
line=1487, 
    function=0xb797c9c0
"llvm::InsertElementInst::InsertElementInst(llvm::Value*, llvm::Value*,
llvm::Value*, const llvm::Twine&, llvm::Instruction*)")
    at assert.c:81
#4  0xb7249aff in llvm::InsertElementInst::InsertElementInst(llvm::Value*,
llvm::Value*, llvm::Value*, llvm::Twine const&, llvm::Instruction*) ()
   from
/home/james/software/extern/mesa/build/linux-x86-debug/gallium/targets/libgl-xlib/libGL.so.1
#5  0xb6e43a63 in llvm::InsertElementInst::Create(llvm::Value*, llvm::Value*,
llvm::Value*, llvm::Twine const&, llvm::Instruction*) ()
   from
/home/james/software/extern/mesa/build/linux-x86-debug/gallium/targets/libgl-xlib/libGL.so.1
#6  0xb6e4453b in llvm::IRBuilder<true, llvm::ConstantFolder,
llvm::IRBuilderDefaultInserter<true> >::CreateInsertElement(llvm::Value*,
llvm::Value*, llvm::Value*, llvm::Twine const&) ()
   from
/home/james/software/extern/mesa/build/linux-x86-debug/gallium/targets/libgl-xlib/libGL.so.1
#7  0xb71b4777 in LLVMBuildInsertElement ()
   from
/home/james/software/extern/mesa/build/linux-x86-debug/gallium/targets/libgl-xlib/libGL.so.1
#8  0xb684f29f in build_gather (bld=0xbfffb66c, base_ptr=0x81b530c, 
    indexes=0x817df50) at src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c:451
#9  0xb684f9d9 in emit_fetch_constant (bld_base=0xbfffb624, reg=0x8331a80, 
    stype=TGSI_TYPE_SIGNED, swizzle=0)
    at src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c:640
#10 0xb688562f in lp_build_emit_fetch (bld_base=0xbfffb624, inst=0x8331a50, 
    src_op=0, chan_index=0) at src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:305
#11 0xb688513b in lp_build_fetch_args (bld_base=0xbfffb624, 
    emit_data=0xbfffb4c8) at src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:177
#12 0xb688538b in lp_build_tgsi_inst_llvm (bld_base=0xbfffb624, 
    inst=0x8331a50) at src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:245
#13 0xb6885c30 in lp_build_tgsi_llvm (bld_base=0xbfffb624, tokens=0x81cade8)
    at src/gallium/auxiliary/gallivm/lp_bld_tgsi.c:475
#14 0xb6853f29 in lp_build_tgsi_soa (gallivm=0x81c0138, tokens=0x81cade8, 
    type=..., mask=0x0, consts_ptr=0x81b7514, system_values=0xbfffed1c, 
    pos=0x0, inputs=0xbfffe714, outputs=0xbfffed28, sampler=0x81c1f70, 
    info=0x81ca75c) at src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c:2561
#15 0xb6855f1e in generate_vs (variant=0x81a2b78, builder=0x82c87f8, 
    vs_type=..., outputs=0xbfffed28, inputs=0xbfffe714, 
    system_values=0xbfffed1c, context_ptr=0x81b2380, draw_sampler=0x81c1f70, 
    clamp_vertex_color=1 '\001') at src/gallium/auxiliary/draw/draw_llvm.c:494
#16 0xb6858895 in draw_llvm_generate (llvm=0x805b010, variant=0x81a2b78, 
    elts=0 '\000') at src/gallium/auxiliary/draw/draw_llvm.c:1342
#17 0xb6855d61 in draw_llvm_create_variant (llvm=0x805b010, num_inputs=6, 
    key=0xbffff1b8) at src/gallium/auxiliary/draw/draw_llvm.c:449
#18 0xb685a3f3 in llvm_middle_end_prepare (middle=0x80694c8, in_prim=6, 
    opt=3, max_vertices=0x80668cc)
    at src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c:170
#19 0xb67a452f in vsplit_prepare (frontend=0x80668b0, in_prim=6, 
    middle=0x80694c8, opt=3)
    at src/gallium/auxiliary/draw/draw_pt_vsplit.c:175
# And so on


I'm not sure if you care what LLVM 3.0 yields, but it's a very long IL printout
and complaint list. I'll attach it separately.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>