Bug 34376 - [GLSL] allowing assignment to unsized array
Summary: [GLSL] allowing assignment to unsized array
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: All Linux (All)
: medium minor
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-17 01:11 UTC by Gordon Jin
Modified: 2011-06-07 17:53 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
new piglit test case (326 bytes, text/plain)
2011-02-17 01:13 UTC, Gordon Jin
Details

Description Gordon Jin 2011-02-17 01:11:53 UTC
# bin/glslparsertest tests/glslparsertest/glsl2/array-assign-to-unsized.frag fail

Successfully compiled fragment shader tests/glslparsertest/glsl2/array-assign-to
-unsized.frag:
Shader source:
/* From page 20 (page 26 of the PDF) of the GLSL 1.20 spec:
 *    "However, implicitly sized arrays cannot be assigned to."
 *
 * [config]
 * expect_result: fail
 * glsl_version: 120
 * [end config]
 */

#version 120
void main()
{
        float a[];
        float b[] = float[2](0,1);

        a = b;

}

PIGLIT: {'result': 'fail' }
Comment 1 Gordon Jin 2011-02-17 01:13:57 UTC
Created attachment 43477 [details]
new piglit test case
Comment 2 Gordon Jin 2011-02-17 19:12:46 UTC
Ian, do you think this failure should be caught in compiling time or linking time?

On Nvidia, it's caught only in linking time. So the attached case also fails. I can write another test to check in linking time though.

On Intel, it even gets linked successfully.
Comment 3 Ian Romanick 2011-03-08 12:15:25 UTC
(In reply to comment #2)
> Ian, do you think this failure should be caught in compiling time or linking
> time?

Both this and the use of the .length() method should be caught at compile time.  I'll add a couple tests like this to the specs/glsl-1.20/compiler directory in piglit.  There should already be some in glslparsertest/glsl2, but we clearly need more tests.
Comment 4 Gordon Jin 2011-03-08 17:54:09 UTC
a side question: what's the strategy to put into specs/glsl-* v.s. glslparsertest/glsl2?
Comment 5 Ian Romanick 2011-03-24 13:59:59 UTC
Fixed in 7.10 (386921cf45aa5a34f543708a94a3bf43ba787237).
Comment 6 Gordon Jin 2011-06-01 18:53:52 UTC
verified on 7.10 branch. 

btw, the similar test case was committed to piglit as array-assign-implicit-size.vert


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.