Bug 82487

Summary: [all Bisected]Piglit glslparsertest_glsl2_17000-consecutive-chars-identifier.frag segfault
Product: Mesa Reporter: lu hua <huax.lu>
Component: Drivers/DRI/i915Assignee: Ian Romanick <idr>
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: All   
OS: Linux (All)   
i915 platform: i915 features:

Description lu hua 2014-08-12 01:56:45 UTC
System Environment:
Platform: BDW
Libdrm:		(master)libdrm-2.4.56-4-g07fead4462b2d537d0c3cae69a09272fc426c598
Mesa:		(master)9276ef6f41626307c3da2ed94a77c0d51b6d8efd
Xserver:	(master)xorg-server-
Libva:		(master)3fddb7f937df4e0e15391bd65ae3c7552ea5b3d7
Kernel:   (drm-intel-nightly)ee55e72e4941947049780df49f01d320f1b98a4b

Bug detailed description:
It fails on all platforms with mesa master, but wokrs well on 10.2 branch.
glslparsertest_glsl2_16385-consecutive-chars.frag fails on i965 platforms with mesa master branch, it has same bisect commit.

Bisect shows: 04e40fd337a244ee77ef9553985e9398ff0344af is the first bad commit.
commit 04e40fd337a244ee77ef9553985e9398ff0344af
Author:     Carl Worth <cworth@cworth.org>
AuthorDate: Tue Jul 1 16:31:07 2014 -0700
Commit:     Ian Romanick <ian.d.romanick@intel.com>
CommitDate: Thu Aug 7 16:08:29 2014 -0700

    glsl/glcpp: Treat CR+LF pair as a single newline

    The GLSL specification says that either carriage-return, line-feed, or both
    together can be used to terminate lines. Further, it says that when used
    together, the pair of terminators shall be interpreted as a single line.

    This final requirement has not been respected by glcpp up until now, (it has
    been emitting two newlines for every CR+LF pair).

    Here, we fix the lexer by using a regular expression for NEWLINE that eats
    up both "\r\n" (or even "\n\r") if possible before also considering a single
    '\n' or a single '\r' as a line terminator.

    Before this commit, the test results are as follows:

        \r:     135/143 tests pass
        \r\n:     4/143 tests pass
        \n\r:     4/143 tests pass

    After this commit, the test results are as follows:

        \r:     135/143 tests pass
        \r\n:   140/143 tests pass
        \n\r:   139/143 tests pass

    So, obviously, a dramatic improvement.

    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

Segmentation fault (core dumped)

(gdb) bt
#0  0x000000372f07dd6f in _int_malloc () from /usr/lib64/libc.so.6
#1  0x000000372f07ee5c in _int_realloc () from /usr/lib64/libc.so.6
#2  0x000000372f0803e2 in realloc () from /usr/lib64/libc.so.6
#3  0x00007ffff42b2201 in resize (ptr=0x870fc8, size=<optimized out>) at ralloc.c:147
#4  0x00007ffff42b2854 in ralloc_vasprintf_rewrite_tail (str=0x86c718, start=0x86c728, fmt=0x7ffff43f53c5 "%s", args=args@entry=0x7fffffffbdf8) at ralloc.c:484
#5  0x00007ffff42b2a52 in ralloc_asprintf_rewrite_tail (str=<optimized out>, start=<optimized out>, fmt=<optimized out>) at ralloc.c:462
#6  0x00007ffff42871bf in _token_list_print (list=<optimized out>, parser=0x86c6b8) at glcpp/glcpp-parse.y:1319
#7  _glcpp_parser_print_expanded_token_list (list=<optimized out>, parser=0x86c6b8) at glcpp/glcpp-parse.y:2077
#8  glcpp_parser_parse (parser=parser@entry=0x86c6b8) at glcpp/glcpp-parse.y:214
#9  0x00007ffff42d9f82 in glcpp_preprocess (ralloc_ctx=0x86bee8, shader=0x7fffffffdeb8, info_log=0x86c0d8, extensions=<optimized out>, gl_ctx=<optimized out>)
    at ../../src/glsl/glcpp/pp.c:149
#10 0x00007ffff42a2ac0 in _mesa_glsl_compile_shader (ctx=ctx@entry=0x7ffff3ffb038, shader=shader@entry=0x867a38, dump_ast=dump_ast@entry=false, dump_hir=dump_hir@entry=false)
    at ../../src/glsl/glsl_parser_extras.cpp:1443
#11 0x00007ffff413e9ce in compile_shader (ctx=0x7ffff3ffb038, shaderObj=<optimized out>) at ../../src/mesa/main/shaderapi.c:850
#12 0x00007ffff7cfc5dc in stub_glCompileShader (shader=1) at /GFX/Test/Piglit/piglit/tests/util/piglit-dispatch-gen.c:6375
#13 0x0000000000401e64 in test () at /GFX/Test/Piglit/piglit/tests/glslparsertest/glslparsertest.c:276
#14 0x00000000004025b6 in piglit_init (argc=4, argv=0x7fffffffe1a8) at /GFX/Test/Piglit/piglit/tests/glslparsertest/glslparsertest.c:507
#15 0x00007ffff7d86564 in run_test (gl_fw=0x605010, argc=4, argv=0x7fffffffe1a8) at /GFX/Test/Piglit/piglit/tests/util/piglit-framework-gl/piglit_winsys_framework.c:70
#16 0x00007ffff7d6bae9 in piglit_gl_test_run (argc=4, argv=0x7fffffffe1a8, config=0x7fffffffe060) at /GFX/Test/Piglit/piglit/tests/util/piglit-framework-gl.c:151
#17 0x000000000040192b in main (argc=4, argv=0x7fffffffe1a8) at /GFX/Test/Piglit/piglit/tests/glslparsertest/glslparsertest.c:76

Reproduce steps:
1. xinit
2. bin/glslparsertest tests/glslparsertest/glsl2/17000-consecutive-chars-identifier.frag pass 1.10
Comment 1 Kenneth Graunke 2014-08-16 01:09:33 UTC
Marking as a duplicate of 82472 - bot the 16385 and 17000 consecutive character problems are caused by the same bug.

*** This bug has been marked as a duplicate of bug 82472 ***

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.