On 7/17/25 10:12 AM, Peter Maydell wrote:
On Thu, 17 Jul 2025 at 18:05, Pierrick Bouvier
<pierrick.bouv...@linaro.org> wrote:
On 7/17/25 9:56 AM, Peter Maydell wrote:
I'm not really a fan of relying on the compiler to fold stuff
away -- it's fragile and there's no guarantee the compiler
will actually do it. In this example it would be really easy
for somebody coming along to tidy this up later to put the
nested if()s back into a single if() condition and reintroduce
the problem, for instance.
There are various places where we already relied on that, including
before the single-binary work ({accel}_allowed).
For the fragile aspect of it, that's why CI exists. Building all
binaries with clang --enable-debug should ensure no regression can be
introduced.
But our CI can't check all versions of gcc and clang at
all optimisation levels. The reason it's fragile is because
there's never a guarantee that the compiler does it or what
situations it will work vs not work. It's not a feature
provided by the language or the compiler that you can fold
away references to functions that don't exist; it just
happens to work.
Sure, it's always a compromise, and it's overkill to try to cover all
the {os, compiler, version} possibilities.
That said, checking debug builds with available clang version in latest
ubuntu LTS + latest clang version published should already cover a lot
of cases, including new warnings that might appear.
I would be happy to help contribute on QEMU CI side, but in my personal
experience trying to approach concerned developers, either I didn't have
any answer, or received a "No, our minutes are precious".
I know your point of view (Engineers are already paid, minutes are not),
but it still doesn't make sense to me. I hope one day we can move away
from this paradigm, and really make a good usage of cpu time instead of
people time for testing things.
I know we already rely on constant-folding in various
places: I'm not super enthusiastic about those either.
-- PMM