{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,2]],"date-time":"2026-10-02T13:33:34Z","timestamp":1790948014577,"version":"4.1.0"},"reference-count":61,"publisher":"Association for Computing Machinery (ACM)","issue":"PLDI","license":[{"start":{"date-parts":[[2023,6,6]],"date-time":"2023-06-06T00:00:00Z","timestamp":1686009600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"DOI":"10.13039\/501100000266","name":"Engineering and Physical Sciences Research Council","doi-asserted-by":"publisher","award":["EP\/R006865\/1"],"award-info":[{"award-number":["EP\/R006865\/1"]}],"id":[{"id":"10.13039\/501100000266","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2023,6,6]]},"abstract":"<jats:p>We introduce program reconditioning, a method for allowing program generation and differential testing to be used to find miscompilation bugs, and test-case reduction to be used to simplify bug-triggering programs, even when (a) the programming language of interest features undefined behaviour (UB) and (b) no tools exist to detect and avoid this UB. We present two program generation tools based on our reconditioning idea: GLSLsmith for the OpenGL Shading Language (GLSL), a widely-used language for graphics programming, and WGSLsmith for the WebGPU Shading Language (WGSL), a new language for web-based graphics rendering. GLSL features many UBs, but unlike for languages such as C and C++ no tools exist to detect them automatically. While the WGSL language specification features very limited UB, early WGSL implementations do exhibit UB, for reasons of initial implementation simplicity, making it challenging to test them to quickly detect and eliminate unrelated miscompilation bugs. Thanks to reconditioning, we show that GLSLsmith and WGSLsmith allow differential testing and test-case reduction to be applied to compilers for GLSL and WGSL for the first time, despite the unavailability of UB detection techniques for these languages. Through a large testing campaign, we have found 24 and 33 bugs in GLSL and WGSL compilers, respectively. We present experiments showing that when reconditioning is disabled, compiler testing leads to a high rate of test programs that appear to trigger miscompilation bugs, but actually just feature UB. We also present a novel approach to managing floating-point roundoff error using reconditioning, implemented for both GLSL and WGSL.<\/jats:p>","DOI":"10.1145\/3591294","type":"journal-article","created":{"date-parts":[[2023,6,6]],"date-time":"2023-06-06T20:06:24Z","timestamp":1686081984000},"page":"1801-1825","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":14,"title":["Program Reconditioning: Avoiding Undefined Behaviour When Finding and Reducing Compiler Bugs"],"prefix":"10.1145","volume":"7","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-0516-0551","authenticated-orcid":false,"given":"Bastien","family":"Lecoeur","sequence":"first","affiliation":[{"name":"Imperial College London, UK"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0009-0005-1275-5122","authenticated-orcid":false,"given":"Hasan","family":"Mohsin","sequence":"additional","affiliation":[{"name":"Imperial College London, UK"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-7448-7961","authenticated-orcid":false,"given":"Alastair F.","family":"Donaldson","sequence":"additional","affiliation":[{"name":"Imperial College London, UK"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2023,6,6]]},"reference":[{"key":"e_1_2_1_1_1","unstructured":"Apple. 2022. Metal Shading Language Specification.  https:\/\/developer.apple.com\/metal\/Metal-Shading-Language-Specification.pdf \t\t\t\t  Apple. 2022. Metal Shading Language Specification.  https:\/\/developer.apple.com\/metal\/Metal-Shading-Language-Specification.pdf"},{"key":"e_1_2_1_2_1","unstructured":"Apple. 2023. Metal.  https:\/\/developer.apple.com\/metal\/ \t\t\t\t  Apple. 2023. Metal.  https:\/\/developer.apple.com\/metal\/"},{"key":"e_1_2_1_3_1","unstructured":"C-Reduce Project. 2023. Using C-Reduce.  https:\/\/embed.cs.utah.edu\/creduce\/using\/ \t\t\t\t  C-Reduce Project. 2023. Using C-Reduce.  https:\/\/embed.cs.utah.edu\/creduce\/using\/"},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/3363562"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1109\/ASE.2019.00037"},{"key":"e_1_2_1_6_1","doi-asserted-by":"publisher","DOI":"10.1109\/TSE.2018.2889771"},{"key":"e_1_2_1_7_1","unstructured":"T.Y. Chen S.C. Cheung and S.M. Yiu. 1998. Metamorphic Testing: a New Approach for Generating Next Test Cases. Department of Computer Science The Hong Kong University of Science and Technology. \t\t\t\t  T.Y. Chen S.C. Cheung and S.M. Yiu. 1998. Metamorphic Testing: a New Approach for Generating Next Test Cases. Department of Computer Science The Hong Kong University of Science and Technology."},{"key":"e_1_2_1_8_1","doi-asserted-by":"publisher","DOI":"10.1145\/2491956.2462173"},{"key":"e_1_2_1_9_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-33826-7_16"},{"key":"e_1_2_1_10_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICST57152.2023.00042"},{"key":"e_1_2_1_11_1","doi-asserted-by":"publisher","DOI":"10.1145\/3133917"},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1145\/3453483.3454092"},{"key":"e_1_2_1_13_1","doi-asserted-by":"publisher","DOI":"10.1145\/3324884.3418933"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1007\/s10664-022-10146-1"},{"key":"e_1_2_1_15_1","unstructured":"Freedesktop.org. 2021. Miscompilation of a switch case.  https:\/\/gitlab.freedesktop.org\/mesa\/mesa\/-\/issues\/5185 \t\t\t\t  Freedesktop.org. 2021. Miscompilation of a switch case.  https:\/\/gitlab.freedesktop.org\/mesa\/mesa\/-\/issues\/5185"},{"key":"e_1_2_1_16_1","unstructured":"Google. 2023. ANGLE.  https:\/\/opensource.google\/projects\/angle \t\t\t\t  Google. 2023. ANGLE.  https:\/\/opensource.google\/projects\/angle"},{"key":"e_1_2_1_17_1","unstructured":"Google. 2023. Dawn a WebGPU implementation.  https:\/\/dawn.googlesource.com\/dawn\/+\/refs\/heads\/main\/README.md \t\t\t\t  Google. 2023. Dawn a WebGPU implementation.  https:\/\/dawn.googlesource.com\/dawn\/+\/refs\/heads\/main\/README.md"},{"key":"e_1_2_1_18_1","unstructured":"Google. 2023. ShaderTrap GitHub repository.  https:\/\/github.com\/google\/shadertrap \t\t\t\t  Google. 2023. ShaderTrap GitHub repository.  https:\/\/github.com\/google\/shadertrap"},{"key":"e_1_2_1_19_1","unstructured":"GraphicsFuzz project authors. 2023. GraphicsFuzz.  https:\/\/github.com\/google\/graphicsfuzz \t\t\t\t  GraphicsFuzz project authors. 2023. GraphicsFuzz.  https:\/\/github.com\/google\/graphicsfuzz"},{"key":"e_1_2_1_20_1","unstructured":"The Khronos Vulkan Working Group. 2019. Vulkan 1.1.141 - A Specification (with all registered Vulkan extensions). Khronos Group.  https:\/\/www.khronos.org\/registry\/vulkan\/specs\/1.1-extensions\/pdf\/vkspec.pdf \t\t\t\t  The Khronos Vulkan Working Group. 2019. Vulkan 1.1.141 - A Specification (with all registered Vulkan extensions). Khronos Group.  https:\/\/www.khronos.org\/registry\/vulkan\/specs\/1.1-extensions\/pdf\/vkspec.pdf"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.1145\/3373087.3375310"},{"key":"e_1_2_1_22_1","unstructured":"IEEE. 1985. IEEE Standard for Binary Floating-Point Arithmetic. \t\t\t\t  IEEE. 1985. IEEE Standard for Binary Floating-Point Arithmetic."},{"key":"e_1_2_1_23_1","volume-title":"John Kessenich (Ed.)","unstructured":"2019. The OpenGL Shading Language Version 4.60.7 , John Kessenich (Ed.) . Khronos Group . https:\/\/www.khronos.org\/registry\/OpenGL\/specs\/gl\/GLSLangSpec.4.60.pdf 2019. The OpenGL Shading Language Version 4.60.7, John Kessenich (Ed.). Khronos Group. https:\/\/www.khronos.org\/registry\/OpenGL\/specs\/gl\/GLSLangSpec.4.60.pdf"},{"key":"e_1_2_1_24_1","unstructured":"2022. SPIR-V Specification Version 1.6 Revision 2 Unified John Kessenich Boaz Ouriel and Raun Krisch (Eds.). Khronos Group.  https:\/\/www.khronos.org\/registry\/spir-v\/specs\/unified1\/SPIRV.pdf \t\t\t\t  2022. SPIR-V Specification Version 1.6 Revision 2 Unified John Kessenich Boaz Ouriel and Raun Krisch (Eds.). Khronos Group.  https:\/\/www.khronos.org\/registry\/spir-v\/specs\/unified1\/SPIRV.pdf"},{"key":"e_1_2_1_25_1","unstructured":"Khronos Group. 2023. glslang GitHub repository.  https:\/\/github.com\/KhronosGroup\/glslang \t\t\t\t  Khronos Group. 2023. glslang GitHub repository.  https:\/\/github.com\/KhronosGroup\/glslang"},{"key":"e_1_2_1_26_1","unstructured":"Khronos Group. 2023. The OpenCL Specification.  https:\/\/registry.khronos.org\/OpenCL\/specs\/3.0-unified\/pdf\/OpenCL_API.pdf \t\t\t\t  Khronos Group. 2023. The OpenCL Specification.  https:\/\/registry.khronos.org\/OpenCL\/specs\/3.0-unified\/pdf\/OpenCL_API.pdf"},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.1145\/2594291.2594334"},{"key":"e_1_2_1_28_1","doi-asserted-by":"publisher","DOI":"10.1145\/2814270.2814319"},{"key":"e_1_2_1_29_1","unstructured":"Bastien Lecoeur. 2023. GLSLsmith GitHub repository.  https:\/\/github.com\/AaronGhost\/glslsmith \t\t\t\t  Bastien Lecoeur. 2023. GLSLsmith GitHub repository.  https:\/\/github.com\/AaronGhost\/glslsmith"},{"key":"e_1_2_1_30_1","doi-asserted-by":"publisher","DOI":"10.5281\/zenodo.7819755"},{"key":"e_1_2_1_31_1","volume-title":"Jon Leech (Ed.)","unstructured":"2019. OpenGL ES Version 3.2 , Jon Leech (Ed.) . Khronos Group . https:\/\/www.khronos.org\/registry\/OpenGL\/specs\/es\/3.2\/es_spec_3.2.pdf 2019. OpenGL ES Version 3.2, Jon Leech (Ed.). Khronos Group. https:\/\/www.khronos.org\/registry\/OpenGL\/specs\/es\/3.2\/es_spec_3.2.pdf"},{"key":"e_1_2_1_32_1","unstructured":"Xavier Leroy. 2023. The CompCert C verified compiler: Documentation and user\u2019s manual.  https:\/\/compcert.org\/man\/manual004.html \t\t\t\t  Xavier Leroy. 2023. The CompCert C verified compiler: Documentation and user\u2019s manual.  https:\/\/compcert.org\/man\/manual004.html"},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1145\/2737924.2737986"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.1145\/3428264"},{"key":"e_1_2_1_35_1","unstructured":"LLVM. 2023. UndefinedBehaviorSanitizer.  https:\/\/clang.llvm.org\/docs\/UndefinedBehaviorSanitizer.html \t\t\t\t  LLVM. 2023. UndefinedBehaviorSanitizer.  https:\/\/clang.llvm.org\/docs\/UndefinedBehaviorSanitizer.html"},{"key":"e_1_2_1_36_1","first-page":"100","article-title":"Differential Testing for Software","volume":"10","author":"McKeeman William M.","year":"1998","unstructured":"William M. McKeeman . 1998 . Differential Testing for Software . Digital Technical Journal , 10 , 1 (1998), 100 \u2013 107 . William M. McKeeman. 1998. Differential Testing for Software. Digital Technical Journal, 10, 1 (1998), 100\u2013107.","journal-title":"Digital Technical Journal"},{"key":"e_1_2_1_37_1","unstructured":"Microsoft. 2019. Reference for HLSL.  https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/direct3dhlsl\/dx-graphics-hlsl-reference \t\t\t\t  Microsoft. 2019. Reference for HLSL.  https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/direct3dhlsl\/dx-graphics-hlsl-reference"},{"key":"e_1_2_1_38_1","unstructured":"Microsoft. 2021. Direct3D 12 graphics.  https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/direct3d12\/direct3d-12-graphics \t\t\t\t  Microsoft. 2021. Direct3D 12 graphics.  https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/direct3d12\/direct3d-12-graphics"},{"key":"e_1_2_1_39_1","doi-asserted-by":"publisher","DOI":"10.1145\/1134285.1134307"},{"key":"e_1_2_1_40_1","unstructured":"Hasan Mohsin. 2023. WGSLsmith GitHub repository.  https:\/\/github.com\/wgslsmith\/wgslsmith \t\t\t\t  Hasan Mohsin. 2023. WGSLsmith GitHub repository.  https:\/\/github.com\/wgslsmith\/wgslsmith"},{"key":"e_1_2_1_41_1","doi-asserted-by":"publisher","DOI":"10.2197\/ipsjtsldm.7.91"},{"issue":"2","key":"e_1_2_1_42_1","first-page":"1","article-title":"CUDA C++ Programming Guide","volume":"11","year":"2021","unstructured":"Nvidia. 2021 . CUDA C++ Programming Guide , Version 11 . 2 . 1 . https:\/\/docs.nvidia.com\/cuda\/archive\/11.2.1\/cuda-c-programming-guide\/ Nvidia. 2021. CUDA C++ Programming Guide, Version 11.2.1. https:\/\/docs.nvidia.com\/cuda\/archive\/11.2.1\/cuda-c-programming-guide\/","journal-title":"Version"},{"key":"e_1_2_1_43_1","unstructured":"Terence Parr. 2023. ANTLR.  https:\/\/www.antlr.org\/ \t\t\t\t  Terence Parr. 2023. ANTLR.  https:\/\/www.antlr.org\/"},{"key":"e_1_2_1_44_1","unstructured":"pest project authors. 2023. pest. The Elegant Parser.  https:\/\/github.com\/pest-parser\/pest \t\t\t\t  pest project authors. 2023. pest. The Elegant Parser.  https:\/\/github.com\/pest-parser\/pest"},{"key":"e_1_2_1_45_1","doi-asserted-by":"publisher","DOI":"10.1145\/2909437.2909439"},{"key":"e_1_2_1_46_1","volume-title":"Picire: Parallel Delta Debugging Framework.  https:\/\/github.com\/renatahodovan\/picire","author":"Project Picire","year":"2012","unstructured":"Picire Project . 2012 . Picire: Parallel Delta Debugging Framework. https:\/\/github.com\/renatahodovan\/picire Picire Project. 2012. Picire: Parallel Delta Debugging Framework. https:\/\/github.com\/renatahodovan\/picire"},{"key":"e_1_2_1_47_1","unstructured":"John Regehr. 2012. Responsible and Effective Bugfinding.  https:\/\/blog.regehr.org\/archives\/1679 \t\t\t\t  John Regehr. 2012. Responsible and Effective Bugfinding.  https:\/\/blog.regehr.org\/archives\/1679"},{"key":"e_1_2_1_48_1","doi-asserted-by":"publisher","DOI":"10.1145\/2254064.2254104"},{"key":"e_1_2_1_49_1","unstructured":"Rust Graphics Mages. 2022. Invalid result when using implicitly initialized array.  https:\/\/github.com\/gfx-rs\/naga\/issues\/1748 \t\t\t\t  Rust Graphics Mages. 2022. Invalid result when using implicitly initialized array.  https:\/\/github.com\/gfx-rs\/naga\/issues\/1748"},{"key":"e_1_2_1_50_1","unstructured":"Rust Graphics Mages. 2023. The wgpu project.  https:\/\/github.com\/gfx-rs\/wgpu \t\t\t\t  Rust Graphics Mages. 2023. The wgpu project.  https:\/\/github.com\/gfx-rs\/wgpu"},{"key":"e_1_2_1_51_1","volume-title":"The OpenGL Graphics System: A Specification Version 4.6 (Core Profile)","unstructured":"2019. The OpenGL Graphics System: A Specification Version 4.6 (Core Profile) , Mark Segal and Kurt Akeley (Eds.). Khronos Group . https:\/\/www.khronos.org\/registry\/OpenGL\/specs\/gl\/glspec46.core.pdf 2019. The OpenGL Graphics System: A Specification Version 4.6 (Core Profile), Mark Segal and Kurt Akeley (Eds.). Khronos Group. https:\/\/www.khronos.org\/registry\/OpenGL\/specs\/gl\/glspec46.core.pdf"},{"key":"e_1_2_1_52_1","volume-title":"AddressSanitizer: A Fast Address Sanity Checker. In 2012 USENIX Annual Technical Conference","author":"Serebryany Konstantin","year":"2012","unstructured":"Konstantin Serebryany , Derek Bruening , Alexander Potapenko , and Dmitriy Vyukov . 2012 . AddressSanitizer: A Fast Address Sanity Checker. In 2012 USENIX Annual Technical Conference , Boston, MA, USA , June 13-15, 2012, Gernot Heiser and Wilson C. Hsieh (Eds.). USENIX Association, 309\u2013318. https:\/\/www.usenix.org\/conference\/atc12\/technical-sessions\/presentation\/serebryany Konstantin Serebryany, Derek Bruening, Alexander Potapenko, and Dmitriy Vyukov. 2012. AddressSanitizer: A Fast Address Sanity Checker. In 2012 USENIX Annual Technical Conference, Boston, MA, USA, June 13-15, 2012, Gernot Heiser and Wilson C. Hsieh (Eds.). USENIX Association, 309\u2013318. https:\/\/www.usenix.org\/conference\/atc12\/technical-sessions\/presentation\/serebryany"},{"key":"e_1_2_1_53_1","volume-title":"Robert J. Simpson and John Kessenich (Eds.)","unstructured":"2019. The OpenGL ES Shading Language Version 3.20.6 , Robert J. Simpson and John Kessenich (Eds.) . Khronos Group . https:\/\/www.khronos.org\/registry\/OpenGL\/specs\/es\/3.2\/GLSL_ES_Specification_3.20.pdf 2019. The OpenGL ES Shading Language Version 3.20.6, Robert J. Simpson and John Kessenich (Eds.). Khronos Group. https:\/\/www.khronos.org\/registry\/OpenGL\/specs\/es\/3.2\/GLSL_ES_Specification_3.20.pdf"},{"key":"e_1_2_1_54_1","doi-asserted-by":"publisher","DOI":"10.1145\/2909437.2909440"},{"key":"e_1_2_1_55_1","doi-asserted-by":"publisher","DOI":"10.1109\/CGO.2015.7054186"},{"key":"e_1_2_1_56_1","doi-asserted-by":"publisher","DOI":"10.1145\/2983990.2984038"},{"key":"e_1_2_1_57_1","doi-asserted-by":"publisher","DOI":"10.1145\/3180155.3180236"},{"key":"e_1_2_1_58_1","unstructured":"W3C. 2023. WebGPU Shading Language W3C Working Draft.  https:\/\/www.w3.org\/TR\/WGSL\/ \t\t\t\t  W3C. 2023. WebGPU Shading Language W3C Working Draft.  https:\/\/www.w3.org\/TR\/WGSL\/"},{"key":"e_1_2_1_59_1","unstructured":"W3C. 2023. WebGPU W3C Working Draft.  https:\/\/www.w3.org\/TR\/webgpu\/ \t\t\t\t  W3C. 2023. WebGPU W3C Working Draft.  https:\/\/www.w3.org\/TR\/webgpu\/"},{"key":"e_1_2_1_60_1","doi-asserted-by":"publisher","DOI":"10.1145\/1993498.1993532"},{"key":"e_1_2_1_61_1","doi-asserted-by":"publisher","DOI":"10.1109\/32.988498"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3591294","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3591294","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T16:47:21Z","timestamp":1750178841000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3591294"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2023,6,6]]},"references-count":61,"journal-issue":{"issue":"PLDI","published-print":{"date-parts":[[2023,6,6]]}},"alternative-id":["10.1145\/3591294"],"URL":"https:\/\/doi.org\/10.1145\/3591294","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2023,6,6]]},"assertion":[{"value":"2023-06-06","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}