I could not walk past a bug where a package named `barvinok` (the
periwinkle flower in my native Ukrainian) is stuck in -proposed and
facing removal on ppc64el :)

Attached debdiff for tenacious (1.6.15+ds-1ubuntu1) fixing the out-of-
bounds array access in VectorAux (src/ppi/ppi.cpp).

In ExtendPPI(), `v(p)--, v(n+1-p)--` accesses `Stuff[p]` and
`Stuff[n+1-p]` inside a 4-byte `signed char Stuff[4]` array. For `n >=
3`, `Stuff[n+1-p]` is out of bounds, so GCC on ppc64el (-O2/-O3) assumes
the two pointers cannot alias and hoists the second `lbzu` before the
first `stb`. At `n = 3, p = 2` (`p == n+1-p`), `v(2)` becomes -1 instead
of -2, inserting the bogus identity `0 -1 0 1`.

Replacing `Stuff[4]` with `unsigned char len_` and `signed char data_[]`
fixes the miscompilation. Verified on ppc64el at -O3 -flto=auto: ppi5
(47 vectors), ppi10 (2465 vectors), and ppi16 (99328 vectors) match
test/ppi/*.gra.chk byte-for-byte.

PPA build (ppc64el, amd64, arm64 - all tests passing):
- ppc64el: https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33883651
- amd64: https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33883649
- arm64: https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33883650

Upstream PR: https://github.com/4ti2/4ti2/pull/61
Debian BTS: https://bugs.debian.org/1152433

** Description changed:

- 4ti2 1.6.15+ds-1 has been in stonking-proposed for 151 days. It fails to
- build on ppc64el because one test fails (4ti2-ppi 5, in test/ppi):
+ Root Cause:
+ In src/ppi/ppi.cpp, struct VectorAux declares a fixed-size 4-byte array 
`signed char Stuff[4]`, stores the vector length in `Stuff[0]`, and returns 
`Stuff + 1` from `Data()`. Accessing `v(i)` for `i >= 4` indexes `Stuff[i]` 
past the declared array bound (undefined behavior).
+ On ppc64el at -O2/-O3, GCC alias analysis concludes that `v(p)` (`Stuff[p]`) 
and `v(n+1-p)` (`Stuff[n+1-p]`) in `ExtendPPI()` cannot alias once `n >= 3`, 
and schedules the load (`lbzu`) of `v(n+1-p)` before the store (`stb`) of 
`v(p)` in `v(p)--, v(n+1-p)--`. When `n + 1` is even and `p == n + 1 - p` 
(first hit at `n = 3, p = 2`), `v(2)` is decremented once to -1 instead of 
twice to -2, inserting the invalid identity `0 -1 0 1` and causing `4ti2-ppi 5` 
to compute 50 vectors instead of 47.
+ 
+ Fix:
+ Replace `signed char Stuff[4]` in `VectorAux` with an explicit `unsigned char 
len_` field and a `signed char data_[]` flexible array member, and update the 
allocation and `memcpy` sizes to `sizeof(VectorAux) + length`.
+ 
+ Upstream, Debian & PPA Verification:
+ - Upstream PR: https://github.com/4ti2/4ti2/pull/61
+ - Debian BTS: https://bugs.debian.org/1152433
+ - PPA build (ppc64el, all tests passing): 
https://launchpad.net/~steelf/+archive/ubuntu/ppa/+build/33883651
+ 
+ --- [ Original Report ]
+ 4ti2 1.6.15+ds-1 has been in stonking-proposed for 151 days. It fails to 
build on ppc64el because one test fails (4ti2-ppi 5, in test/ppi):
  
  https://launchpad.net/ubuntu/+source/4ti2/1.6.15+ds-1/+build/32844029
  
    src/ppi/4ti2-ppi 5 ...
    **** 1 test(s) FAILED! ****
  
  It also blocks barvinok 0.41.9+ds-3 (new, 83 days in proposed), which
  depends on 4ti2.
  
  This isn't new: every 4ti2 upload since 1.6.13 (Nov 2025) has failed on
  ppc64el in Ubuntu. Debian builds the same 1.6.15+ds-1 on ppc64el with
  all tests passing.
  
  The visible difference is the optimisation flags: Ubuntu's ppc64el build
  uses -O3 -flto=auto, Debian uses -O2 (and a slightly older g++ 15.2 vs
  Ubuntu's 15.3). That's the likely trigger, but it hasn't been verified:
  a ppc64el test build with -O2 and/or
  DEB_BUILD_MAINT_OPTIONS=optimize=-lto would confirm it.

** Tags added: patch tenacious

** Bug watch added: Debian Bug tracker #1152433
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1152433

** Patch added: "debdiff for 4ti2 1.6.15+ds-1ubuntu1 (tenacious)"
   
https://bugs.launchpad.net/bugs/2170794/+attachment/6013317/+files/4ti2_1.6.15+ds-1ubuntu1_tenacious.debdiff

** Changed in: 4ti2 (Ubuntu)
       Status: New => Confirmed

** Changed in: barvinok (Ubuntu)
       Status: New => Confirmed

** Changed in: 4ti2 (Debian)
 Remote watch: None => Debian Bug tracker #1152433

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

Title:
  4ti2 FTBFS on ppc64el: 4ti2-ppi test fails (likely -O3/LTO), blocks
  barvinok

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/4ti2/+bug/2170794/+subscriptions


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

Reply via email to