[Mesa-dev] Segfault in r300_compiler_tests' peephole_mul_omod()

Matt Turner mattst88 at gmail.com
Sun Feb 22 11:58:37 PST 2015

Hi Tom,

I've gotten a report about a segfault in the r300 compile tests. See
Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=540970

It seems to be dependent on optimization level whether the test
segfaults or not.

Program received signal SIGSEGV, Segmentation fault.
0x00000000004013fd in test_runner_rc_optimize (result=0x6231d0 <tests+16>)
    at /var/tmp/portage/media-libs/mesa-10.5.0_rc1/work/mesa-10.5.0-rc1/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c:72
72 if (inst_list[0]->U.I.Omod != RC_OMOD_MUL_2 ||

inst_list looks to be uninitialized:

(gdb) p *inst_list[0]
Cannot access memory at address 0xb4ebe20b

The loop that initializes inst_list[] looks suspect:

66 for(inst = c.Program.Instructions.Next;
67 inst != &c.Program.Instructions;

and indeed the start of the list is the end of the list, so
inst_list[] is never initialized:

(gdb) p c.Program.Instructions.Next
$3 = (struct rc_instruction *) 0x7fffffffe340
(gdb) p &c.Program.Instructions
$4 = (struct rc_instruction *) 0x7fffffffe340

Separately, when I run r300_compiler_tests compiled with -O2 under
valgrind, I see

Test rc_pair_regalloc() => TEX 1D Swizzle - r300
==31863== Conditional jump or move depends on uninitialised value(s)
==31863==    at 0x414FF0: readers_intersect (radeon_variable.c:252)
==31863==    by 0x414FF0: get_variable_helper (radeon_variable.c:302)
==31863==    by 0x415367: get_variable_pair_helper (radeon_variable.c:344)
==31863==    by 0x415432: rc_get_variables (radeon_variable.c:376)
==31863==    by 0x40D341: do_advanced_regalloc (radeon_pair_regalloc.c:527)
==31863==    by 0x40D341: rc_pair_regalloc (radeon_pair_regalloc.c:775)
==31863==    by 0x4013B9: test_runner_rc_regalloc
==31863==    by 0x4013B9: tex_1d_swizzle (radeon_compiler_regalloc_tests.c:88)
==31863==    by 0x402614: run_tests (unit_test.c:41)
==31863==    by 0x40107C: main (r300_compiler_tests.c:36)

Would you mind taking a look at both of these?


More information about the mesa-dev mailing list