Bug 25664 - [GLSL] re-declaring an empty array fails to compile
Summary: [GLSL] re-declaring an empty array fails to compile
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: Ian Romanick
QA Contact: Eric Anholt
Depends on: 25826
Blocks: 29044
  Show dependency treegraph
Reported: 2009-12-16 00:12 UTC by Gordon Jin
Modified: 2010-08-18 19:31 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Description Gordon Jin 2009-12-16 00:12:15 UTC
"float freq2[];" appears twice in piglit/tests/glslparsertest/shaders/CorrectFull.vert:

    float freq2[];

    while(test_float1 < 1.0);

    float freq2[]; 

This causes fail:
Failed to compile vertex shader piglit/tests/glslparsertest/shaders/CorrectFull.vert: Error: declaration of 'freq2' conflicts with previous declaration

The GLSL spec says "Unsized arrays can be explicitly sized by an initializer at declaration time", but it doesn't say arrays can be declared as unsized twice.
Comment 1 Ian Romanick 2009-12-17 10:25:22 UTC
I think the sequence is correct.  These tests originally came from 3dlabs and the original authors of the GLSL specification.  I'll talk to John K. to find the specific language in the GLSL spec.
Comment 2 Ian Romanick 2009-12-17 10:29:15 UTC
The test is correct.  Section 4.2 "Scoping" of the GLSL 1.10 document says, "A variable declared as an empty array can be re-declared as an array of the same base type."
Comment 3 Eric Anholt 2010-08-17 09:11:58 UTC
This is fixed in glsl2.
Comment 4 Gordon Jin 2010-08-18 19:31:51 UTC
verified with mesa master d442a01ac14382d83cdaac87d2832315ceb3e963. CorrectFull.vert still fails, but that'll be another bug.

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.