Dear Maintainer,
qjoypad fails to build from source when built with -O3 and LTO
(-flto=auto -ffat-lto-objects) under GCC 15 (as on Ubuntu ppc64el):
In function 'sendevent',
inlined from 'move' at /usr/src/qjoypad-4.3.1-3.1/src/axis.cpp:436:11:
/usr/src/qjoypad-4.3.1-3.1/src/event.cpp:8:5: error: 'MEM <unsigned int> [(struct FakeEvent *)&e]' may be used uninitialized [-Werror=maybe-uninitialized]
In Axis::move() (src/axis.cpp), when mode != Keyboard and press == false,
FakeEvent e is never initialized, and sendevent() reads uninitialized memory
(e.type). With LTO and -O3, sendevent() is inlined and GCC's -Werror makes this
fatal.
The attached patch fixes this by returning early in Axis::move() when released
in mouse mode (as mouse movement has no release action) and value-initializing
FakeEvent e{}.
Ubuntu tracking bug: https://bugs.launchpad.net/ubuntu/+source/qjoypad/+bug/2170324
Regards,
Viktor Pashaiev