Bug 101360 - Assertion failure comparing result of ballotARB
Summary: Assertion failure comparing result of ballotARB
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
Depends on:
Reported: 2017-06-09 09:38 UTC by James Legg
Modified: 2017-06-19 10:08 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Piglit test reproducing the problem (1.15 KB, application/mbox)
2017-06-09 09:38 UTC, James Legg
fix (1.59 KB, patch)
2017-06-12 08:58 UTC, Nicolai Hähnle
Details | Splinter Review

Description James Legg 2017-06-09 09:38:14 UTC
Created attachment 131825 [details]
Piglit test reproducing the problem

When comparing a constant to the result of a call to the ballotARB function, or a variable containing the result, an assert in void glsl_to_tgsi_visitor::copy_propagate() can fail. If assertions are disabled, then copy_propagate writes over the end of an allocation, corrupting memory instead.

The attached patch to piglit adds a test reproducing the problem.

Steps to reproduce:
 1) Apply attached patch to piglit
 2) Run ./piglit run -t arb_shader_ballot shader results/ballot
    The newly added test will crash.

The test crashes with:
state_tracker/st_glsl_to_tgsi.cpp:4936: void glsl_to_tgsi_visitor::copy_propagate(): Assertion `inst->dst[0].file != PROGRAM_TEMPORARY || inst->dst[0].index < this->next_temp' failed.

I'm using mesa ada3c3aa3da5d04bd597014dc1b5d4b028313513 with an AMD RX480.
Comment 1 Nicolai Hähnle 2017-06-12 08:33:09 UTC
Hi James, thanks for the report. I can reproduce and am investigating.
Comment 2 Nicolai Hähnle 2017-06-12 08:58:28 UTC
Created attachment 131885 [details] [review]

Please try with the attached patch.
Comment 3 James Legg 2017-06-12 09:15:55 UTC
The attached patch fixes the issue for me.
Comment 4 Nicolai Hähnle 2017-06-19 10:08:38 UTC
Fixed in Mesa master, commit b28938ffce0580e89e6012826900da2b6013b0df ("st/glsl_to_tgsi: use correct writemask when converting generic intrinsics").

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.