gcc-14 bugs, pile 1
Around beginning og the May
gcc-14 development got opened for major
changes to be merged into
master branch. 2 months have passed since
and I collected a “round” number of bugs: 16. Today is also a day when I
managed to build my whole system by
gcc-master without encountering
any obvious bugs.
Here is the full list of bugs I encountered in chronological order :
- tree-optimization/109732: wrong code
- c++/109755: imprecise warning location.
- tree-optimization/110067: wrong code
- middle-end/110228: wrong code on
llvmJIT test suite.
- target/110274: wrong code on
- middle-end/110515: wrong code on
- c++/110580: rejects valid on
- c++/110598: wrong code for
Let’s look at a few histograms.
Looking at the manifestation of the bug:
Wrong code is almost as much as compiler crashes. Some of wrong codes took me a while to extract from the real project. Once again robust test suites make it so much easier to extract an example for upstream reporting.
Looking at the subsystems:
Half the bugs happened in generic optimization phase (
middle-end). A few bugs in
c++ frontend (mainly in tempalte
instantiation code). And only one failure was target-specific. It should
be obvious by now that I did no test
gcc on anything besides
Tip of the day
When chasing wrong code generation down to a particular source file I
#pragma GCC optimize(1) injection hack to be useful:
# flip first halg to -O1 $ git grep -LF 'pragma GCC optimize' -- '**.cpp' | head -n $NUMBER | xargs sed '1i #pragma GCC optimize(1)' -i # flip second half to -O1 $ git grep -LF 'pragma GCC optimize' -- '**.cpp' | tail -n +$(($NUMBER+1)) | xargs sed '1i #pragma GCC optimize(1)' -i
That way I flip
$NUMBER files down to
-O1 optimization level
(assuming it is enough to inhibit the bug from happening) and bisect it
down to a single file without
ccache makes pragma addition and removal very cheap. You effectively
need to compile project only twice: with default options and with
pragma override. The rest is a bit of linking.
gcc-master is still a lot of fun. I keep finding ~2 new bugs
per week on a regular basis. I did not get to fix any of them: in almost
all cases maintainers figured out the fix way before I got closer to the
culprit code in
gcc. Maybe one day I’ll get there first :)
json remain to be the hardest stress tests for