#1150639 qjoypad: FTBFS with -O3 and LTO: uninitialized FakeEvent in Axis::move()

Package:
qjoypad
Source:
qjoypad
Description:
map gamepad/joystick events to mouse/keyboard event
Submitter:
Viktor Pashaiev
Date:
2026-10-11 16:15:02 UTC
Severity:
normal
Tags:
#1150639#5
Date:
2026-10-11 16:12:01 UTC
From:
To:
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