Re: Help with non-reproducible .debug_loclists

Nazar Kazakov via Gcc <[email protected]>
Newsgroups gmane.comp.gcc.devel
Message-ID <[email protected]>
On 2026-07-15 08:11, Richard Biener wrote:
> Is this happening in a build without -flto?  If so then I'd suggest to
> isolate the TU having the issue.  You can also try to see whether
> -fcompare-debug catches any issue (though in principle that's
> somewhat an unrelated class of problems).
> 
> You can see whether disabling address-space randomization helps
> (it would still be a GCC bug).
> 
> Once you have a reproducer (preprocessed source) please file
> a bugreport.

Hello Richard,

I've managed to get a reproducer, it's not minimal though :)
I didn't manage to create an account on bugzilla (got no response
to the email asking for an account), so I'll post reproduction
steps here. Sorry in advance for a lot of text.

I've tested this on:
* 16-core x86_64 machine with 32G of RAM
   kernel: Linux 6.12.95+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 
6.12.95-1 (2026-07-04) x86_64 GNU/Linux
* 8-core x86_64 machine with 16G of RAM
   kernel: Linux 7.1.5 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jul 24 14:21:27 
UTC 2026 x86_64 GNU/Linux

I've run the following commands:
podman run -it --rm --network host --workdir /src -v .:/src 
debian:sid-20260803
apt update && apt install g++ git #installs gcc (Debian 16.1.0-3) 16.1.0
git clone https://github.com/KhronosGroup/glslang.git
cd glslang && git checkout vulkan-sdk-1.4.350.1

cat <<EOF >/src/glslang/glslang/build_info.h
#ifndef GLSLANG_BUILD_INFO
#define GLSLANG_BUILD_INFO

#define GLSLANG_VERSION_MAJOR 16
#define GLSLANG_VERSION_MINOR 3
#define GLSLANG_VERSION_PATCH 0
#define GLSLANG_VERSION_FLAVOR ""

#define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \
     ((GLSLANG_VERSION_MAJOR) > (major) || ((major) == 
GLSLANG_VERSION_MAJOR && \
     ((GLSLANG_VERSION_MINOR) > (minor) || ((minor) == 
GLSLANG_VERSION_MINOR && \
      (GLSLANG_VERSION_PATCH) > (patch)))))

#define GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch) \
     ((GLSLANG_VERSION_MAJOR) > (major) || ((major) == 
GLSLANG_VERSION_MAJOR && \
     ((GLSLANG_VERSION_MINOR) > (minor) || ((minor) == 
GLSLANG_VERSION_MINOR && \
      (GLSLANG_VERSION_PATCH >= (patch))))))

#define GLSLANG_VERSION_LESS_THAN(major, minor, patch) \
     ((GLSLANG_VERSION_MAJOR) < (major) || ((major) == 
GLSLANG_VERSION_MAJOR && \
     ((GLSLANG_VERSION_MINOR) < (minor) || ((minor) == 
GLSLANG_VERSION_MINOR && \
      (GLSLANG_VERSION_PATCH) < (patch)))))

#define GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch) \
     ((GLSLANG_VERSION_MAJOR) < (major) || ((major) == 
GLSLANG_VERSION_MAJOR && \
     ((GLSLANG_VERSION_MINOR) < (minor) || ((minor) == 
GLSLANG_VERSION_MINOR && \
      (GLSLANG_VERSION_PATCH <= (patch))))))

#endif // GLSLANG_BUILD_INFO
EOF
mkdir -p /src/glslang/_builddir/glslang/CMakeFiles/glslang.dir
cat <<EOF 
 >/src/glslang/_builddir/glslang/CMakeFiles/glslang.dir/cmake_pch.hxx
/* generated by CMake */

#pragma GCC system_header
#ifdef __cplusplus
#include "/src/glslang/glslang/MachineIndependent/pch.h"
#endif // __cplusplus
EOF
cat <<EOF 
 >/src/glslang/_builddir/glslang/CMakeFiles/glslang.dir/cmake_pch.hxx.cxx
/* generated by CMake */
EOF
cd _builddir
cat <<EOF >compile.sh
#!/usr/bin/env bash
set -eux
c++ -DENABLE_HLSL -DENABLE_OPT=0 -DENABLE_SPIRV 
-DGLSLANG_IS_SHARED_LIBRARY=1 -DGLSLANG_OSINCLUDE_UNIX 
-DGLSLANG_TEST_BUILD -Dglslang_EXPORTS -I/src/glslang/glslang/.. 
-I/src/glslang/_builddir/include -O2 -pipe -g -Wp,-D_FORTIFY_SOURCE=3 
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong 
-grecord-gcc-switches -fasynchronous-unwind-tables 
-fstack-clash-protection -fcf-protection -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer -fdump-rtl-vartrack-details -DNDEBUG 
-std=c++17 -fPIC -fvisibility=hidden -Wall -Wmaybe-uninitialized 
-Wuninitialized -Wunused -Wunused-local-typedefs -Wimplicit-fallthrough 
-Wunused-parameter -Wunused-value -Wunused-variable 
-Wunused-but-set-parameter -Wunused-but-set-variable -fno-rtti 
-fno-exceptions -Werror=deprecated-copy -Winvalid-pch -x c++-header 
-include 
/src/glslang/_builddir/glslang/CMakeFiles/glslang.dir/cmake_pch.hxx -o 
glslang/CMakeFiles/glslang.dir/cmake_pch.hxx.gch -c 
/src/glslang/_builddir/glslang/CMakeFiles/glslang.dir/cmake_pch.hxx.cxx
c++ -DENABLE_HLSL -DENABLE_OPT=0 -DENABLE_SPIRV 
-DGLSLANG_IS_SHARED_LIBRARY=1 -DGLSLANG_OSINCLUDE_UNIX 
-DGLSLANG_TEST_BUILD -Dglslang_EXPORTS -I/src/glslang -O2 -pipe -g 
-Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions 
-fstack-protector-strong -grecord-gcc-switches 
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection 
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer 
-fdump-rtl-vartrack-details -DNDEBUG -std=c++17 -fPIC 
-fvisibility=hidden -Wall -Wmaybe-uninitialized -Wuninitialized -Wunused 
-Wunused-local-typedefs -Wimplicit-fallthrough -Wunused-parameter 
-Wunused-value -Wunused-variable -Wunused-but-set-parameter 
-Wunused-but-set-variable -fno-rtti -fno-exceptions 
-Werror=deprecated-copy -Winvalid-pch -include 
/src/glslang/_builddir/glslang/CMakeFiles/glslang.dir/cmake_pch.hxx -o 
/src/glslang/glslang/MachineIndependent/ShaderLang.cpp.o -c 
/src/glslang/glslang/MachineIndependent/ShaderLang.cpp

EOF
chmod +x compile.sh
cat <<EOF >clean.sh
#!/usr/bin/env bash
set -eux
rm -f glslang/CMakeFiles/glslang.dir/cmake_pch.hxx.gch
rm -f /src/glslang/glslang/MachineIndependent/ShaderLang.cpp.*
EOF
chmod +x clean.sh

./clean.sh
./compile.sh
mkdir build_reference
sha256sum /src/glslang/glslang/MachineIndependent/ShaderLang.cpp.o > 
build_reference/sha256.txt
mv glslang/CMakeFiles/glslang.dir/cmake_pch.hxx.gch 
/src/glslang/glslang/MachineIndependent/ShaderLang.cpp.* 
build_reference/

for x in $(seq 1 1000); do ./clean.sh; ./compile.sh; sha256sum 
/src/glslang/glslang/MachineIndependent/ShaderLang.cpp.o > 
build_result_$x.txt; if [ "$(cat build_result_$x.txt)" != "$(cat 
build_reference/sha256.txt)" ]; then mkdir checkout_$x; mv 
glslang/CMakeFiles/glslang.dir/cmake_pch.hxx.gch 
/src/glslang/glslang/MachineIndependent/ShaderLang.cpp.* checkout_$x/; 
fi; done

After about 15-20 minutes I reliably get a checkout_* directory with a 
different
build result.

My guess is that it's related to the interaction between pre-compiled 
headers and
variable tracking pass. I've worked around that by disabling 
pre-compiled headers
in glslang build for now, but the bug is still there in gcc I think.

Thanks,
Nazar Kazakov
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.