Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized variables can generate illegal glsl #317

Closed
csynth opened this issue Oct 15, 2023 · 1 comment
Closed

uninitialized variables can generate illegal glsl #317

csynth opened this issue Oct 15, 2023 · 1 comment

Comments

@csynth
Copy link

csynth commented Oct 15, 2023

Very helpful project, thank you.

The code
vec4 main() { vec4 bb; return bb; }
minimizes to
vec4 main(){return bb;}

The original is clearly bad code but according to the spec is legal with undefined results.
The minimized version is not legal glsl and will not compile.

I had much more complicated (autogenerated) code where the result was well-defined despite the uninitialized variables.
I don't think it worth posting that here, but could if it helped.

slightly related to #153

@laurentlb
Copy link
Owner

Thanks for the report, this is clearly a bug. No need to send more code.

(if no one else sends a PR before, I expect to work on it in a couple of months)

eldritchconundrum added a commit that referenced this issue May 26, 2024
* Stop removing side-effecting init of unused locals.

* Stop removing unassigned-but-used locals.
This is accomplished by moving the unassigned removal from the "simple" inlining to the "safe" inlining.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants