Bug 76198 - Segfault on void-typed last sequence element
Summary: Segfault on void-typed last sequence element
Status: RESOLVED WORKSFORME
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-15 11:13 UTC by Sir Anthony
Modified: 2016-07-30 05:04 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
0001-glsl-Fix-segfault-on-void-rightmost-sequence-express.patch (888 bytes, text/plain)
2014-03-15 11:13 UTC, Sir Anthony
Details

Description Sir Anthony 2014-03-15 11:13:58 UTC
Created attachment 95847 [details]
0001-glsl-Fix-segfault-on-void-rightmost-sequence-express.patch

I have some autogenerated geometry shader with sequence like 
((dbgIter0 == 0 && (dbgResult = float(1.0), true)), EmitVertex())
It is wrong code generation on my side, but I found that glsl-compiler segfaults on this line.
Problem in ast_to_hir.cpp (:1737 for current git) in ast_sequence expression type processing. Result of last operand is NULL due to void return type of EmitVertex.
From the GLSL spec (p.107 of pdf of 4.40) sequence must return type and value of rightmost expression, so void-typed expressions must emit some error. I've attached patch with fix. I'm not sure about the way I chose, maybe compiler must do something different in that case.
Comment 1 Ian Romanick 2014-12-17 20:10:26 UTC
We need a piglit test for this.  I'll see if I can find someone to write it.

I don't recall seeing this patch on the mesa-dev list, so it completely escaped my notice.
Comment 2 Sir Anthony 2014-12-17 20:47:40 UTC
Good to hear it is not lost. Not sure why I did not sent it to mesa-dev. 
I can add test, but it will take some time. I'll do so if you have not done it before.
Comment 3 Timothy Arceri 2016-02-11 09:11:20 UTC
I tried to reproduce the segfault but failed would be good if you could provide an example or piglit test.
Comment 4 Timothy Arceri 2016-07-30 05:04:32 UTC
Could not reproduce this last time I tried and OP has not provided an example. There were a bunch of void fixes a while back so its possible this was fixed. Closing.


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.