vkCreateRayTracingPipelinesKHR throws for certain glsl code with driver version 511.23 and 511.65

Problematic glsl code snippet:

for (int i = a; i < b; ++i) { // a, b and i can also be uint
    //... do something or nothing
    //... do something or nothing

If all of the following conditions are fulfilled:

  1. the values of a and b can be determined at compile time (e.g. macro or literal, or direct assigned with macro or literal right before the loop);
  2. and a >= b;
  3. and VkRayTracingPipelineCreateInfoKHR::pStages has other stages aside from the problematic raygen stage;

vkCreateRayTracingPipelinesKHR will throw: Exception thrown at 0x00007FF88F850D36 (nvrtum64.dll) in basic_test.exe: 0xC0000005: Access violation reading location 0x0000000000000030.
Platform: Windows 11, RTX 2070 (notebook), Vulkan SDK, VS 2019 version 16.11.9.
I didn’t have this issue with driver version 497.29. Seems like erroneous shader optimization by the Vulkan driver.