Bug 103895

Summary: Spurious “used uninitialized” warning
Product: Mesa Reporter: Steinar H. Gunderson <sgunderson>
Component: glsl-compilerAssignee: mesa-dev
Status: RESOLVED MOVED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: apinheiro
Version: 17.2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Steinar H. Gunderson 2017-11-24 20:16:16 UTC
Hi,

When compiling this GLSL compute shader:

===
#version 430

layout(local_size_x = 1) in;
uniform restrict writeonly image2D outbuf;

vec4 CS_OUTPUT_VAL;

vec4 func() {
        return CS_OUTPUT_VAL;
}

void main()
{       
        CS_OUTPUT_VAL = vec4(0.0, 0.0, 0.0, 1.0);
        vec4 val = func(); 
        imageStore(outbuf, ivec2(0, 0), val);
}
===

I get this warning:

Shader compile log: 0:9(9): warning: `CS_OUTPUT_VAL' used uninitialized

If I move func() below main() (with a forward declaration), the warning goes away.
Comment 1 GitLab Migration User 2019-09-18 19:45:57 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/814.

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.