Bug 25808 - [GLSL] const variable is modified successfully
[GLSL] const variable is modified successfully
Status: VERIFIED FIXED
Product: Mesa
Classification: Unclassified
Component: Mesa core
git
Other All
: medium normal
Assigned To: Ian Romanick
:
Depends on:
Blocks: 29044
  Show dependency treegraph
 
Reported: 2009-12-28 00:47 UTC by Gordon Jin
Modified: 2010-08-18 19:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gordon Jin 2009-12-28 00:47:25 UTC
piglit/tests/glslparsertest/shaders/function3.frag expects to be compiled fail
because it writes to a "const" variable (which is defined as read-only in GLSL
spec):

void function(const int i)  
{
    i = 3;  // const value cant be modified
}


But it gets compiled successfully in mesa.
Comment 1 Gordon Jin 2010-01-11 21:54:07 UTC
piglit/tests/glslparsertest/shaders/struct9.frag fails with similar issue:

const struct s {
    int i;
} s1 = s(1);

void main()
{
   s1.i = 1;  // const struct members cannot be modified
}
Comment 2 Eric Anholt 2010-08-17 09:12:52 UTC
Fixed with glsl2 merge.
Comment 3 Gordon Jin 2010-08-18 19:23:59 UTC
verified with mesa master d442a01ac14382d83cdaac87d2832315ceb3e963