Bug 29608 - Regression crash when a function return type is invalid (following GLSL2 merge)
Summary: Regression crash when a function return type is invalid (following GLSL2 merge)
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium major
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-17 03:19 UTC by Cedric Vivier
Modified: 2010-08-23 13:31 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Cedric Vivier 2010-08-17 03:19:52 UTC
When a function return type is unknown/invalid the GLSL compiler crashes instead of issuing a proper "invalid type" error.
This only occurs when the invalid type is return type of a function, not when a function parameter is an invalid type.

Testcase :
--
foo bar()
{
}

void main()
{
    gl_Position = vec4(0.0);
}
--


Stacktrace :
#0  0xf6846a45 in ast_function_definition::hir(exec_list*, _mesa_glsl_parse_state*) () from /usr/local/lib/dri/i965_dri.so
#1  0xf6847340 in _mesa_ast_to_hir(exec_list*, _mesa_glsl_parse_state*) () from /usr/local/lib/dri/i965_dri.so
#2  0xf683c9fb in _mesa_glsl_compile_shader () from /usr/local/lib/dri/i965_dri.so
#3  0xf67467c6 in _mesa_CompileShaderARB () from /usr/local/lib/dri/i965_dri.so
Comment 1 Cedric Vivier 2010-08-17 05:10:14 UTC
FWIW I forgot to add previous error for such error was pre-GLSL2 :
""
Error: undeclared type name 'foo'
""
Comment 2 Eric Anholt 2010-08-23 13:31:49 UTC
Thanks for providing sample code!  piglit case:

commit 4557c70734668f7ec3680e08d408ae368a4a76a7
Author: Cedric Vivier <cedricv@neonux.com>
Date:   Mon Aug 23 13:22:09 2010 -0700

    function-12.vert: New test for bug #29608.

Mesa fix:

commit 76e96d74f49cc262ceaf2ed6c48d2f4ed21d219f
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Aug 23 13:26:52 2010 -0700

    glsl: Cleanly fail when a function has an unknown return type.
    
    Bug #29608.


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.