Bug 30415 - segfault in r300compiler
Summary: segfault in r300compiler
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r300 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
: 30416 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-28 02:28 UTC by Wiktor Janas
Modified: 2010-09-29 00:09 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
segfault fix (1.03 KB, patch)
2010-09-28 09:32 UTC, Tom Stellard
Details | Splinter Review

Description Wiktor Janas 2010-09-28 02:28:31 UTC
Compilation of this fragment shader segfaults:

uniform vec4 vecX, vecY;
uniform int iter;

void main() {
    bool b = (dot(gl_TexCoord[0], gl_TexCoord[0]) < 4.0);
    gl_FragColor.z = iter == 0 ? vecX.z - vecY.z : 15.0;
    if(b)
        gl_FragColor.x = 1.0;
}

Program terminated with signal 11, Segmentation fault.
#0  0x00007f202341cd8a in vfprintf () from /lib/libc.so.6
(gdb) bt
#0  0x00007f202341cd8a in vfprintf () from /lib/libc.so.6
#1  0x00007f202343e3f2 in vsnprintf () from /lib/libc.so.6
#2  0x00007f2020251ce9 in rc_error (c=0x7fffcd99ca70, fmt=0x7f20209b75f0 "%s::%s(): %s: cannot write output and ALU result at the same time\n")
    at radeon_compiler.c:73
#3  0x00007f2020264fea in emit_paired (c=<value optimized out>, user=<value optimized out>) at r500_fragprog_emit.c:253
#4  r500BuildFragmentProgramHwCode (c=<value optimized out>, user=<value optimized out>) at r500_fragprog_emit.c:614
#5  0x00007f2020251988 in rc_run_compiler (c=0x7fffcd99ca70, list=0x7fffcd99c900, shader_name=0x7f20209b69a2 "Fragment Program") at radeon_compiler.c:365
#6  0x00007f2020261571 in r3xx_compile_fragment_program (c=0x7fffcd99ca70) at r3xx_fragprog.c:155
#7  0x00007f2020258c53 in r300_translate_fragment_shader (r300=0x257d2a0, shader=0x2ab84d0, tokens=0x269daf0) at r300_fs.c:429
#8  0x00007f2020259644 in r300_pick_fragment_shader (r300=0x257d2a0) at r300_fs.c:507
#9  0x00007f202024b395 in r300_bind_fs_state (pipe=0x257d2a0, shader=0x7f20209b75f6) at r300_state.c:885
#10 0x00007f20203a3f40 in cso_set_fragment_shader_handle (ctx=<value optimized out>, handle=0x7f20209b75f6) at cso_cache/cso_context.c:743
#11 0x00007f202038aef7 in st_validate_state (st=0x25f67d0) at state_tracker/st_atom.c:172
#12 0x00007f202035fd05 in st_draw_vbo (ctx=<value optimized out>, arrays=0x25f9950, prims=<value optimized out>, nr_prims=<value optimized out>, ib=0x4, 
    index_bounds_valid=16 '\020', min_index=0, max_index=3) at state_tracker/st_draw.c:639
#13 0x00007f202038497f in vbo_exec_vtx_flush (exec=0x25f7e00, unmap=<value optimized out>) at vbo/vbo_exec_draw.c:384
#14 0x00007f202038207c in vbo_exec_FlushVertices_internal (ctx=<value optimized out>, unmap=246 '\366') at vbo/vbo_exec_api.c:876
#15 0x00007f20203820d2 in vbo_exec_FlushVertices (ctx=0x490010, flags=1) at vbo/vbo_exec_api.c:910
#16 0x00007f202027ec1e in _mesa_Flush () at main/context.c:1673
#17 0x00007f20237506e6 in glutSwapBuffers () from /usr/lib/libglut.so.3

r300: Initial fragment program
FRAG
DCL IN[0], GENERIC[0], PERSPECTIVE
DCL OUT[0], COLOR
DCL CONST[0..2]
DCL TEMP[0..2]
IMM FLT32 {    4.0000,     0.0000,    15.0000,     1.0000}
  0: DP4 TEMP[0].x, IN[0], IN[0]
  1: SLT TEMP[1].x, TEMP[0].xxxx, IMM[0].xxxx
  2: MOV TEMP[0].x, TEMP[1].xxxx
  3: SEQ TEMP[1].x, CONST[0].xxxx, IMM[0].yyyy
  4: IF TEMP[1].xxxx :7
  5:   ADD TEMP[1].x, CONST[2].zzzz, -CONST[1].zzzz
  6:   MOV TEMP[2].x, TEMP[1].xxxx
  7: ELSE :9
  8:   MOV TEMP[2].x, IMM[0].zzzz
  9: ENDIF
 10: MOV OUT[0].z, TEMP[2].xxxx
 11: IF TEMP[0].xxxx :13
 12:   MOV OUT[0].x, IMM[0].wwww
 13: ENDIF
 14: END

The hardware is RV515, mesa is from git, commit 175261a1...
Comment 1 Tom Stellard 2010-09-28 09:32:28 UTC
Created attachment 39018 [details] [review]
segfault fix

This should fix the segfault, but the shader will still fail to compile, which is still a bug.
Comment 2 Marek Olšák 2010-09-28 09:49:10 UTC
Making a piglit for this bug...
Comment 3 Marek Olšák 2010-09-28 10:30:31 UTC
Removing myself from CC, I get the emails via dri-devel already.
Comment 4 Tom Stellard 2010-09-28 22:10:47 UTC
*** Bug 30416 has been marked as a duplicate of this bug. ***
Comment 5 Tom Stellard 2010-09-29 00:09:29 UTC
This is fixed in git master by commit b27a809266bd664cd101fcfdf20886cc2b7df787


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.