Bug 101360

Summary: Assertion failure comparing result of ballotARB
Product: Mesa Reporter: James Legg <jlegg>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Piglit test reproducing the problem
fix

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

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.