Launchpad has imported 5 comments from the remote bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124427.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://documentation.ubuntu.com/launchpad/user/reference/bugs/multi-project-bugs/about-multi-project-bugs/#bugs-in-external-trackers.

------------------------------------------------------------------------
On 2026-03-10T09:33:13+00:00 Amachhiw-j wrote:

GCC 15 (tested on v15.2.1) reports the below false positive 
'-Wmaybe-uninitialized'
warning in vphn_unpack_associativity() when building the powerpc selftests as
below:

  # make -C tools/testing/selftests TARGETS="powerpc"
  [...]
  make: Entering directory '/home/linux/tools/testing/selftests/powerpc/vphn'
  gcc -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"v7.0-rc2-0-g11439c4635ed"' 
-I/home/linux/tools/testing/selftests/powerpc/include  -m64 
-I/home/linux/tools/testing/selftests/powerpc/vphn    test-vphn.c ../harness.c  
-o /home/linux/tools/testing/selftests/powerpc/vphn/test-vphn
  In file included from test-vphn.c:3:
  In function ‘vphn_unpack_associativity’,
      inlined from ‘test_one’ at test-vphn.c:371:2,
      inlined from ‘test_vphn’ at test-vphn.c:399:9:
  test-vphn.c:10:33: error: ‘be_packed’ may be used uninitialized 
[-Werror=maybe-uninitialized]
     10 | #define be16_to_cpup(x)         bswap_16(*x)
        |                                 ^~~~~~~~
  vphn.c:42:27: note: in expansion of macro ‘be16_to_cpup’
     42 |                 u16 new = be16_to_cpup(field++);
        |                           ^~~~~~~~~~~~
  In file included from test-vphn.c:19:
  vphn.c: In function ‘test_vphn’:
  vphn.c:27:16: note: ‘be_packed’ declared here
     27 |         __be64 be_packed[VPHN_REGISTER_COUNT];
        |                ^~~~~~~~~
  cc1: all warnings being treated as errors

When vphn_unpack_associativity() is called from hcall_vphn(), this error is not
seen during compilation because GCC 15 seems to consider 'retbuf' always
populated from the hypervisor which is eventually referred by 'be_packed'.
However, GCC 15's dataflow analysis can’t prove the same before the first
dereference when vphn_unpack_associativity() is called from test_one() with
pre-initialized array of 'struct test'. This results in a false positive warning
which is promoted to an error under '-Werror'.

Also, please note that this problem is not seen when the compilation is
performed with GCC 13 and 14.

Steps to recreate:
------------------
1. Clone upstream Linux
2. Run the below command to build powerpc selftests:

        make -C tools/testing/selftests TARGETS="powerpc"

Reply at: https://bugs.launchpad.net/ubuntu-kernel-
tests/+bug/2129844/comments/1

------------------------------------------------------------------------
On 2026-03-10T09:36:37+00:00 Pinskia wrote:

Can you provide the preprocessed source?

Reply at: https://bugs.launchpad.net/ubuntu-kernel-
tests/+bug/2129844/comments/2

------------------------------------------------------------------------
On 2026-03-10T10:08:53+00:00 Amachhiw-j wrote:

Created attachment 63864
Preprocessed source

Offending line in Linux source:
  
https://github.com/torvalds/linux/blob/1f318b96cc84d7c2ab792fcc0bfd42a7ca890681/arch/powerpc/platforms/pseries/vphn.c#L42

Also, I've attached the preprocessed source. Please let me know if you'd need
any further information.

Reply at: https://bugs.launchpad.net/ubuntu-kernel-
tests/+bug/2129844/comments/3

------------------------------------------------------------------------
On 2026-03-10T10:16:38+00:00 Pinskia wrote:

This code has aliasing violations in it.
The uninitialized happens due to the undefined code due to the alias violations.

I don't see -fno-strict-aliasing being used either.

__be64 be_packed[VPHN_REGISTER_COUNT];
const __be16 *field = (const __be16 *) be_packed;
...
for (i = 0; i < VPHN_REGISTER_COUNT; i++)
                be_packed[i] = cpu_to_be64(packed[i]);
...

u16 new = be16_to_cpup(field++);

But that is a read via be16 while the writes were via be64.

Reply at: https://bugs.launchpad.net/ubuntu-kernel-
tests/+bug/2129844/comments/4

------------------------------------------------------------------------
On 2026-03-10T10:18:02+00:00 Pinskia wrote:

The bad diagnostic is a dup of bug 99768.

But the code is undefined. Either should be using -fno-strict-aliasing
or fix up the aliasing issues in the code.

*** This bug has been marked as a duplicate of bug 99768 ***

Reply at: https://bugs.launchpad.net/ubuntu-kernel-
tests/+bug/2129844/comments/5


** Changed in: gcc
       Status: Unknown => Invalid

** Changed in: gcc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2129844

Title:
  powerpc-build in ubuntu_kernel_selftests fails to build due to
  uninitialized value

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/2129844/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to