<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>198305</bug_id>
          
          <creation_ts>2019-05-28 14:31:58 -0700</creation_ts>
          <short_desc>[WHLSL] Multiple variables with initializers in a declaration statement crashes the compiler</short_desc>
          <delta_ts>2019-07-16 12:42:00 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGPU</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Saam Barati">saam</reporter>
          <assigned_to name="Robin Morisset">rmorisset</assigned_to>
          <cc>fpizlo</cc>
    
    <cc>jonlee</cc>
    
    <cc>justin_fan</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>rmorisset</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1539727</commentid>
    <comment_count>0</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2019-05-28 14:31:58 -0700</bug_when>
    <thetext>e.g:

int test() {
    int x = 42, y = 44 ;
    return 42;
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539729</commentid>
    <comment_count>1</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2019-05-28 14:32:39 -0700</bug_when>
    <thetext>Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebCore             	0x00000006322c7ffb WebCore::WHLSL::Checker::visit(WebCore::WHLSL::AST::VariableReference&amp;) + 27 (RefPtr.h:81)
1   com.apple.WebCore             	0x00000006322c70c2 WebCore::WHLSL::Checker::visit(WebCore::WHLSL::AST::AssignmentExpression&amp;) + 34 (WHLSLVisitor.h:181)
2   com.apple.WebCore             	0x0000000632322c89 WebCore::WHLSL::Visitor::visit(WebCore::WHLSL::AST::CommaExpression&amp;) + 73 (WHLSLVisitor.cpp:511)
3   com.apple.WebCore             	0x00000006322c92fa WebCore::WHLSL::Checker::visit(WebCore::WHLSL::AST::CommaExpression&amp;) + 26 (WHLSLVisitor.h:181)
4   com.apple.WebCore             	0x00000006322c6969 WebCore::WHLSL::Checker::visit(WebCore::WHLSL::AST::VariableDeclaration&amp;) + 105 (WHLSLVisitor.h:181)
5   com.apple.WebCore             	0x0000000632322a69 WebCore::WHLSL::Visitor::visit(WebCore::WHLSL::AST::VariableDeclarationsStatement&amp;) + 73 (WHLSLVisitor.cpp:475)
6   com.apple.WebCore             	0x0000000632322149 WebCore::WHLSL::Visitor::visit(WebCore::WHLSL::AST::Block&amp;) + 73 (WHLSLVisitor.cpp:299)
7   com.apple.WebCore             	0x00000006322c55cb WebCore::WHLSL::Checker::visit(WebCore::WHLSL::AST::FunctionDefinition&amp;) + 1963
8   com.apple.WebCore             	0x00000006322c4b6b WebCore::WHLSL::Checker::visit(WebCore::WHLSL::Program&amp;) + 315 (Vector.h:691)
9   com.apple.WebCore             	0x00000006322cab4d WebCore::WHLSL::check(WebCore::WHLSL::Program&amp;) + 189 (WHLSLVisitor.h:181)
10  com.apple.WebCore             	0x000000063230b80a WebCore::WHLSL::prepareShared(WTF::String&amp;) + 778 (WHLSLPrepare.cpp:119)
11  com.apple.WebCore             	0x000000063230b0e6 WebCore::WHLSL::prepare(WTF::String&amp;, WebCore::WHLSL::RenderPipelineDescriptor&amp;) + 38 (Optional.h:371)
12  com.apple.WebCore             	0x0000000631b8d822 WebCore::GPURenderPipeline::tryCreate(WebCore::GPUDevice const&amp;, WebCore::GPURenderPipelineDescriptor const&amp;) + 2290 (Optional.h:371)
13  com.apple.WebCore             	0x0000000632cb75be WebCore::GPUDevice::tryCreateRenderPipeline(WebCore::GPURenderPipelineDescriptor const&amp;) const + 14 (GPUDevice.cpp:85)
14  com.apple.WebCore             	0x00000006322be893 WebCore::WebGPUDevice::createRenderPipeline(WebCore::WebGPURenderPipelineDescriptor const&amp;) const + 67 (WebGPUDevice.cpp:139)
15  com.apple.WebCore             	0x0000000632045fc0 WebCore::jsWebGPUDevicePrototypeFunctionCreateRenderPipeline(JSC::ExecState*) + 304 (DumbPtrTraits.h:43)
16  ???                           	0x000021a0f7a0116b 0 + 36975232946539
17  com.apple.JavaScriptCore      	0x000000063655f73e llint_entry + 62149 (LowLevelInterpreter.asm:891)
18  com.apple.JavaScriptCore      	0x000000063655f6c2 llint_entry + 62025 (LowLevelInterpreter.asm:891)
19  com.apple.JavaScriptCore      	0x000000063655f6c2 llint_entry + 62025 (LowLevelInterpreter.asm:891)
20  com.apple.JavaScriptCore      	0x000000063655f73e llint_entry + 62149 (LowLevelInterpreter.asm:891)
21  com.apple.JavaScriptCore      	0x00000006365502cf vmEntryToJavaScript + 200 (LowLevelInterpreter64.asm:293)
22  com.apple.JavaScriptCore      	0x0000000636b43f21 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;) + 417 (JITCodeInlines.h:39)
23  com.apple.JavaScriptCore      	0x0000000636d99514 JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;) + 196 (CallData.cpp:59)
24  com.apple.JavaScriptCore      	0x0000000636e79cfd JSC::JSMicrotask::run(JSC::ExecState*) + 477 (VM.h:968)
25  com.apple.WebCore             	0x00000006323fa074 WebCore::JSExecState::runTask(JSC::ExecState*, JSC::Microtask&amp;) + 68 (JSExecState.h:50)
26  com.apple.WebCore             	0x0000000632401313 WebCore::JSMicrotaskCallback::call() + 67
27  com.apple.WebCore             	0x000000063260d9df WebCore::ActiveDOMCallbackMicrotask::run() + 47
28  com.apple.WebCore             	0x000000063269f0ea WebCore::MicrotaskQueue::performMicrotaskCheckpoint() + 106 (Microtasks.cpp:96)
29  com.apple.WebCore             	0x0000000632405a63 WebCore::JSExecState::didLeaveScriptContext(JSC::ExecState*) + 35 (memory:2619)
30  com.apple.WebCore             	0x00000006323ed29f WebCore::JSExecState::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;, WTF::NakedPtr&lt;JSC::Exception&gt;&amp;) + 143
31  com.apple.WebCore             	0x000000063240333e WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext&amp;, WebCore::Event&amp;) + 1150 (JSEventListener.cpp:175)
32  com.apple.WebCore             	0x00000006326920a5 WebCore::EventTarget::innerInvokeEventListeners(WebCore::Event&amp;, WTF::Vector&lt;WTF::RefPtr&lt;WebCore::RegisteredEventListener, WTF::DumbPtrTraits&lt;WebCore::RegisteredEventListener&gt; &gt;, 1ul, WTF::CrashOnOverflow, 16ul&gt;, WebCore::EventTarget::EventInvokePhase) + 821 (InspectorInstrumentation.h:285)
33  com.apple.WebCore             	0x0000000632690182 WebCore::EventTarget::fireEventListeners(WebCore::Event&amp;, WebCore::EventTarget::EventInvokePhase) + 418 (Vector.h:674)
34  com.apple.WebCore             	0x0000000632ab93c2 WebCore::DOMWindow::dispatchEvent(WebCore::Event&amp;, WebCore::EventTarget*) + 290 (InspectorInstrumentation.h:285)
35  com.apple.WebCore             	0x0000000632abff15 WebCore::DOMWindow::dispatchLoadEvent() + 181 (Ref.h:59)
36  com.apple.WebCore             	0x000000063263f6ef WebCore::Document::implicitClose() + 399 (Document.cpp:4618)
37  com.apple.WebCore             	0x0000000632a17a7f WebCore::FrameLoader::checkCompleted() + 431 (FrameLoader.cpp:900)
38  com.apple.WebCore             	0x0000000632a1660e WebCore::FrameLoader::finishedParsing() + 158 (FrameLoader.cpp:789)
39  com.apple.WebCore             	0x0000000632651506 WebCore::Document::finishedParsing() + 326 (InspectorInstrumentation.h:285)
40  com.apple.WebCore             	0x00000006328f893e WebCore::HTMLDocumentParser::prepareToStopParsing() + 190 (RefCounted.h:98)
41  com.apple.WebCore             	0x00000006328f9af2 WebCore::HTMLDocumentParser::finish() + 242
42  com.apple.WebCore             	0x00000006329f7e9a WebCore::DocumentLoader::finishedLoading() + 538 (utility:918)
43  com.apple.WebCore             	0x0000000632a837fc WebCore::CachedResource::checkNotify() + 332 (CachedResource.cpp:351)
44  com.apple.WebCore             	0x0000000632a810c9 WebCore::CachedRawResource::finishLoading(WebCore::SharedBuffer*) + 585 (CachedRawResource.cpp:121)
45  com.apple.WebCore             	0x0000000632a54575 WebCore::SubresourceLoader::didFinishLoading(WebCore::NetworkLoadMetrics const&amp;) + 677 (ResourceLoader.h:162)
46  com.apple.WebKit              	0x00000006303f2e81 WebKit::WebResourceLoader::didFinishResourceLoad(WebCore::NetworkLoadMetrics const&amp;) + 197
47  com.apple.WebKit              	0x0000000630534408 WebKit::WebResourceLoader::didReceiveWebResourceLoaderMessage(IPC::Connection&amp;, IPC::Decoder&amp;) + 800 (Optional.h:329)
48  com.apple.WebKit              	0x00000006303ecb30 WebKit::NetworkProcessConnection::didReceiveMessage(IPC::Connection&amp;, IPC::Decoder&amp;) + 642
49  com.apple.WebKit              	0x0000000630015418 IPC::Connection::dispatchMessage(std::__1::unique_ptr&lt;IPC::Decoder, std::__1::default_delete&lt;IPC::Decoder&gt; &gt;) + 108 (memory:2603)
50  com.apple.WebKit              	0x0000000630018b4b IPC::Connection::dispatchOneIncomingMessage() + 181
51  com.apple.JavaScriptCore      	0x000000063630c9d4 WTF::RunLoop::performWork() + 228
52  com.apple.JavaScriptCore      	0x000000063630cc62 WTF::RunLoop::performWork(void*) + 34 (RunLoopCF.cpp:39)
53  com.apple.CoreFoundation      	0x00007fff373d7083 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
54  com.apple.CoreFoundation      	0x00007fff373d7029 __CFRunLoopDoSource0 + 108
55  com.apple.CoreFoundation      	0x00007fff373ba9eb __CFRunLoopDoSources0 + 195
56  com.apple.CoreFoundation      	0x00007fff373b9fb5 __CFRunLoopRun + 1189
57  com.apple.CoreFoundation      	0x00007fff373b98be CFRunLoopRunSpecific + 455
58  com.apple.Foundation          	0x00007fff396d88ef -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 280
59  com.apple.Foundation          	0x00007fff396d87c4 -[NSRunLoop(NSRunLoop) run] + 76
60  libxpc.dylib                  	0x00007fff63b3a077 _xpc_objc_main + 552
61  libxpc.dylib                  	0x00007fff63b39b79 xpc_main + 433
62  com.apple.WebKit              	0x0000000630176253 WebKit::XPCServiceMain(int, char const**) + 547
63  libdyld.dylib                 	0x00007fff639013d5 start + 1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539733</commentid>
    <comment_count>2</comment_count>
    <who name="Robin Morisset">rmorisset</who>
    <bug_when>2019-05-28 14:51:55 -0700</bug_when>
    <thetext>Can you dump the AST for this example? From the stack trace, it looks like it parses as int x = (42, y = 44); instead of int (x = 42), (y = 44).. which sounds like an ambiguity in the grammar. I should double check that the spec is explicit on the fact that we want the latter, not the former.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1539735</commentid>
    <comment_count>3</comment_count>
    <who name="Robin Morisset">rmorisset</who>
    <bug_when>2019-05-28 14:55:00 -0700</bug_when>
    <thetext>I verified, and indeed there is a bug in the parser/grammar/spec.
I should replace &apos;expr&apos; in the definition of variableDeclarations by possibleTernaryConditional. And if someone actually wants to write int x = foo(), bar(); they can do it simply by adding parentheses.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1553269</commentid>
    <comment_count>4</comment_count>
    <who name="Robin Morisset">rmorisset</who>
    <bug_when>2019-07-16 12:42:00 -0700</bug_when>
    <thetext>This does not reproduce any longer, and the patch I suggested has visibly been already applied.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>