🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.ports.s390
9 messages
9 total messages Started by Rafael Laboissière Tue, 10 Nov 2026 16:10
gmpfrxx-mkii FTBFS on s309x
#27
Author: Rafael Laboissière
Date: Tue, 10 Nov 2026 16:10
18 lines
2265 bytes
Hi Maho,

I am cc'ing this message to the debian-science and debian-s390 mailing lists. Perhaps the folks there can help us with the issue.

gmpfrxx-mkii FTBFS on s309x: https://buildd.debian.org/status/fetch.php?pkg=gmpfrxx-mkii&arch=s390x&ver=1.5.0+ds-1&stamp=1793237796&raw=0

The error message is not very informative:

    The following tests FAILED:
    103 - test_mpz_arithmetic (SEGFAULT)
    Errors while running CTest
    make[1]: *** [Makefile:74: test] Error 8

Since s390x is an official Debian architecture, this issue will block the other two packages in the dependency chain: mplapack and octave-mplapack.

Best,

Rafael Laboissière
Re: gmpfrxx-mkii FTBFS on s309x
#28
Author: Rafael Laboissière
Date: Tue, 10 Nov 2026 23:00
36 lines
3859 bytes
* Ed . <ej_zg@hotmail.com> [2026-11-10 16:49]:

> Hi Rafael,
>
> I tried to look at the log and it says "log file not found!". As you say, if it just says "segfault", I'm not missing much.
>
> The way to dig into this would be to run a qemu and emulated an s390x, running Debian, and use gdb to get a stack-trace. Warning: that emulation can be kind of slow.

I built the package on a s390x Debian porterbox. This the gdb session:

$ gdb ./obj-s390x-linux-gnu/tests/test_mpz_arithmetic
(gdb) run
Starting program: /home/rafael/PKGS/gmpfrxx-mkii/gmpfrxx-mkii/obj-s390x-linux-gnu/tests/test_mpz_arithmetic
Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/s390x-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x000003fff7cd9788 in __cxa_begin_catch () from /usr/lib/s390x-linux-gnu/libstdc++.so.6
(gdb) backtrace
#0  0x000003fff7cd9788 in __cxa_begin_catch () from /usr/lib/s390x-linux-gnu/libstdc++.so.6
#1  0x000002aa00002090 in gmpxx::mpz_class::mpz_class<gmpfrxx_mkII::detail::binary_expr<gmpfrxx_mkII::detail::div_op, gmpfrxx_mkII::detail::object_leaf<gmpxx::mpz_class>, gmpfrxx_mkII::detail::object_leaf<gmpxx::mpz_class>, gmpxx::mpz_class>, void> (this=0x3ffffff9ef8, expr=...) at ./include/gmpfrxx_mkII/detail/zq_impl.hpp:2774
#2  operator() (__closure=<optimized out>) at ./tests/test_mpz_arithmetic.cpp:101
#3  (anonymous namespace)::require_domain_error<(anonymous namespace)::check_division_by_zero_throws()::<lambda()> > (function=...) at ./tests/test_mpz_arithmetic.cpp:59
#4  (anonymous namespace)::check_division_by_zero_throws () at ./tests/test_mpz_arithmetic.cpp:100
#5  main () at ./tests/test_mpz_arithmetic.cpp:392

I submitted this backtrace to Gemini, who recommended adding some compiler flags:

export CXXFLAGS="-fexceptions -fasynchronous-unwind-tables"

The package then built correctly.

I am not an expert on this matter, and as usual, I am skeptical of AI debugging. Could someone confirm that this would be a reasonable fix?

Best 

Rafael
Re: gmpfrxx-mkii FTBFS on s309x
#29
Author: Rafael Laboissière
Date: Wed, 11 Nov 2026 07:50
9 lines
2187 bytes
* Ed . <ej_zg@hotmail.com> [2026-11-10 16:49]:

> I tried to look at the log and it says "log file not found!". As you say, if it just says "segfault", I'm not missing much.

This link should work: https://buildd.debian.org/status/fetch.php?pkg=gmpfrxx-mkii&arch=s390x&ver=1.5.0%2Bds-1&stamp=1793237796&raw=0

Best,

Rafael Laboissière
Re: gmpfrxx-mkii FTBFS on s309x
#33
Author: Rafael Laboissière
Date: Fri, 13 Nov 2026 13:40
14 lines
2932 bytes
* Pranav P <pranav.p7@ibm.com> [2026-11-12 05:11]:

> I am able to reproduce this in the upstream source code
> as well but with a catch. This shows up only with optimizations
> turned on. It doesn't segfault with the O0 optimizer.

Thanks for this suggestion. I tested this solution on an s390x Debian porterbox and it worked. I uploaded version 1.5.0+ds-2 to unstable with the fix [1]. Let us see how the s390x autobuilder behaves.

Best,

Rafael Laboissière

[1] https://tracker.debian.org/news/1823226/accepted-gmpfrxx-mkii-150ds-2-source-into-unstable/
[2] https://buildd.debian.org/status/package.php?p=gmpfrxx-mkii
Re: gmpfrxx-mkii FTBFS on s309x
#34
Author: Rafael Laboissière
Date: Fri, 13 Nov 2026 16:10
20 lines
2923 bytes
* Rafael Laboissière <rafael@debian.org> [2026-11-13 14:18]:

> * Pranav P <pranav.p7@ibm.com> [2026-11-12 05:11]:
>
>> I am able to reproduce this in the upstream source code
>> as well but with a catch. This shows up only with optimizations
>> turned on. It doesn't segfault with the O0 optimizer.
>
> Thanks for this suggestion. I tested this solution on an s390x Debian porterbox and it worked. I uploaded version 1.5.0+ds-2 to unstable with the fix [1]. Let us see how the s390x autobuilder behaves.

> [1] https://tracker.debian.org/news/1823226/accepted-gmpfrxx-mkii-150ds-2-source-into-unstable/
> [2] https://buildd.debian.org/status/package.php?p=gmpfrxx-mkii

It worked!

https://buildd.debian.org/status/fetch.php?pkg=gmpfrxx-mkii&arch=s390x&ver=1.5.0%2Bds-2&stamp=1794576589&raw=0

Best,

Rafael Laboissière
Re: gmpfrxx-mkii FTBFS on s309x
#35
Author: Peter Blackman
Date: Fri, 13 Nov 2026 20:50
16 lines
3274 bytes
Hi,

FWIW There was a somewhat similar bug in flam3.
https://bugs.debian.org/1067907

Package worked perfectly on all architectures except IBM ppc64el,
where it segfaulted depending on the optimisation level

The offending optimisation turned out to be  finite-math-only

That's as far as we got at the time.

That bug, and this one, smell like compiler issues to me.

Regards,
Peter B
Re: gmpfrxx-mkii FTBFS on s309x
#36
Author: Rafael Laboissière
Date: Sat, 14 Nov 2026 06:20
19 lines
3165 bytes
* Peter Blackman <peter@pblackman.plus.com> [2026-11-13 19:41]:

> FWIW There was a somewhat similar bug in flam3.
> https://bugs.debian.org/1067907
>
> Package worked perfectly on all architectures except IBM ppc64el,
> where it segfaulted depending on the optimisation level
>
> The offending optimisation turned out to be  finite-math-only
>
> That's as far as we got at the time.
>
> That bug, and this one, smell like compiler issues to me.

So, it is a good think the debian-s390 folks are involved in this thread.

Best,

Rafael Laboissière
Re: gmpfrxx-mkii FTBFS on s309x
#37
Author: Rafael Laboissière
Date: Sat, 14 Nov 2026 07:40
36 lines
4178 bytes
* Pranav P <pranavp1729@gmail.com> [2026-11-13 22:46]:

> On Fri, 2026-11-13 at 16:47 +0100, Rafael Laboissière wrote:
>>> Thanks for this suggestion. I tested this solution on an s390x
>>> Debian porterbox and it worked. I uploaded version 1.5.0+ds-2 to
>>> unstable with the fix [1]. Let us see how the s390x autobuilder
>>> behaves.
>
> I don't think that it is a proper solution. I am still looking into
> this. When I was reading the disassembly, I saw that an ag instruction
> happens in the following way:
>
> ag %r3,0(%r11)
>
> while the value of register r11 was 0. This was causing a null pointer
> dereference (value at address 0 + 0) and causing the segfault. The
> value for register r11 was loaded from r2 which is an argument register
> (as well as the return register) according the s390x abi.
>
> But for the code compiled with O0, r2 was loaded with the right value
> (in the code compiled with O2 `lghi r2, 0` was done to zero out r2
> before doing a function call with the brasl instruction). There is a
> chance that this is because of an undefined behaviour. It's just a
> guess and I am not sure.
>
> I will update any findings as soon as I find any.

Thank you for this complementary information.

As Peter Blackman pointed out in this thread, this appears to be a compiler bug. He also mentioned a similar issue with the flam3 package that was fixed by adding -fno-finite-math-only to CFLAGS. Perhaps we could find a similar interim solution for gmpfrxx-mkii on s390x instead of using the aggressive -O0 solution.

Best,

Rafael

P.S.: I uploaded version 1.5.0+ds-3 of the gmpfrxx-mkii package using DEB_CXXFLAGS_MAINT_APPEND in debian/rules instead of setting CXXFLAGS directly.
Re: gmpfrxx-mkii FTBFS on s309x
#41
Author: Rafael Laboissière
Date: Mon, 23 Nov 2026 12:50
72 lines
4660 bytes
Hi Pranav,

Thanks for the update.

The debian/rules file of the gmpfrxx-mkii package currently contains the following:

    ifeq (s390x,$(DEB_HOST_ARCH))
    export DEB_CXXFLAGS_MAINT_APPEND = -O0
    endif

Do you think that it would be better to change it to the following?

    ifeq (s390x,$(DEB_HOST_ARCH))
    export DEB_CXXFLAGS_MAINT_APPEND = -O2 -fno-inline-functions
    endif

I would argue that the latter is the better option since it is more optimized. However, I am not an expert on this topic, so I can't judge correctly.

Best,

Rafael

* Pranav P <pranavp1729@gmail.com> [2026-11-23 11:53]:

> Hi Rafael, Hi Peter,
>
> So sorry for the late reply. I was away for some time. I have tested
> this with clang and it works perfectly fine over there. And with -O2 if
> I pass -fno-inline or -fno-inline-functions also works fine. And I don't
> see anything that points to an undefined behaviour at the respective
> part of the code (re-verified by running an LLM there as well). I think
> I'll ping Stefan (gcc maintainer for s390x) and ask for help.
>
> In the function:
>
>
> void check_division_by_zero_throws()
> {
>     const gmpxx::mpz_class numerator(42);
>     const gmpxx::mpz_class zero(0);
>
>     require_domain_error([&] {
>         const gmpxx::mpz_class quotient = numerator / zero;
>         (void)quotient;
>     });
>
>     require_domain_error([&] {
>         gmpxx::mpz_class quotient = numerator;
>         quotient /= zero;
>     });
>
>     require_domain_error([&] {
>         gmpxx::mpz_class quotient = numerator;
>         quotient /= 0;
>     });
>
>     require_domain_error([&] {
>         gmpxx::mpz_class quotient = numerator;
>         quotient /= 0.0;
>     });
> }
>
>
> If I only keep one of the require_domain_error (tried each combination)
> it doesn't crash. And it doesn't crash with every combination taken 2 at
> a time either. One example I have seen it crash is with the 1st and 4th
> `require_domain_error`s.
>
> I'll update in this thread if I find anything else.
>
> Thanks,
> Pranav
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads