Closed tonycoz closed 1 week ago
I built threaded debugging bleads on Linux using clang-15 on one machine and clang-16 on another. (These are the latest versions available through their respective package managers.) I got no build-time warnings on either. So can I assume that you only began to notice these when you started compiling with clang-17?
No, I'd been seeing them for a while, but then didn't see them when following up, probably because the follow-up normally happened some time after seeing it, and I used gcc when testing. As you can see below the warnings are produced as far back as clang-15.
Recently I was debugging #22132 and saw them consistently, so this time I tested with clang and was able to reproduce them and track down the causes.
You won't see the merged
warning in debugging builds.
See https://apt.llvm.org/ if you're running Debian or Ubuntu and want to try bleeding edge versions of clang, They don't list them, but I think you can also install clang 15 and 16 from there, in addition to the 17, 18 and 19 they do list.
clang-15 -c -DPERL_CORE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O2 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings regcomp_study.c
regcomp_study.c:1067:9: warning: variable 'merged' set but not used [-Wunused-but-set-variable]
U32 merged = 0;
^
1 warning generated.
clang-15 -c -DPERL_CORE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -O2 -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings regcomp_trie.c
regcomp_trie.c:667:13: warning: variable 'wordlen' set but not used [-Wunused-but-set-variable]
U32 wordlen = 0; /* required init */
^
1 warning generated.
Analysis:
Now trying non-debugging builds.
$ cat /etc/debian_version
12.5
$ clang-16 --version
Debian clang version 16.0.6 (15~deb12u1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
blead:
$ sh ./Configure -des -Dusedevel -Duseithreads -Dcc=clang-16 && make test-prep 2>&1 | tee $P5P_DIR/make-output/`extract-sha`.linux.threaded.clang-16.maketp.output.txt
$ report-build-warnings 67164c3968.linux.threaded.clang-16.maketp.output.txt.gz
File: 67164c3968.linux.threaded.clang-16.maketp.output.txt.gz
Wunused-but-set-variable 6
branch:
$ git checkout gh-22154-tonycoz-warning-cleanup-20240418
Switched to branch 'gh-22154-tonycoz-warning-cleanup-20240418'
$ sh ./Configure -des -Dusedevel -Duseithreads -Dcc=clang-16 && make test-prep 2>&1 | tee $P5P_DIR/make-output/`extract-sha`.linux.threaded.clang-16.maketp.output.txt
$ report-build-warnings 2b712a66ef.linux.threaded.clang-16.maketp.output.txt.gz
File: 2b712a66ef.linux.threaded.clang-16.maketp.output.txt.gz
Wunused-but-set-variable 3
$ parse-build-warnings 2b712a66ef.linux.threaded.clang-16.maketp.output.txt.gz
File: 2b712a66ef.linux.threaded.clang-16.maketp.output.txt.gz
[
{
char => 17,
group => "Wunused-but-set-variable",
line => 376,
source => "Bzip2.xs",
text => "variable 'flags' set but not used",
},
{
char => 11,
group => "Wunused-but-set-variable",
line => 765,
source => "blocksort.c",
text => "variable 'numQSorted' set but not used",
},
{
char => 30,
group => "Wunused-but-set-variable",
line => 247,
source => "compress.c",
text => "variable 'totc' set but not used",
},
]
The 3 remaining unused-but-set-variable warnings observed on Debian 12 using clang-16 are from cpan/
modules and hence outside the scope of this pull request.
Similar results on Ubuntu 22.04 LTS with clang-15. LGTM.
I built threaded debugging bleads on Linux using clang-15 on one machine and clang-16 on another. (These are the latest versions available through their respective package managers.) I got no build-time warnings on either. So can I assume that you only began to notice these when you started compiling with clang-17?