#1067907 flam3-utils: flam3-genome randomly segfaults on ppc64el

Package:
flam3-utils
Source:
flam3-utils
Description:
Render and animate FLAM3s and manipulate their genomes
Submitter:
Date:
2025-08-22 16:10:02 UTC
Severity:
normal
#1067907#5
Date:
2024-03-28 18:10:00 UTC
From:
To:
Dear Maintainer,

flam3-genome randomly segfaults on ppc64el, but runs OK on all other
architectures.

See
https://ci.debian.net/packages/f/flam3/testing/ppc64el/
segfaults maybe one run in five.

See also
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001667

#1067907#10
Date:
2024-04-13 09:45:03 UTC
From:
To:
Hello,
tried to reproduce the issue and got on a first run this stack:

(gdb) bt
#0  iter_thread_int (fth=0x157681210) at rect.c:500
#1  0x00007fffaa36bad0 in iter_thread_float () at rect.c:253
#2  0x00007fffa9c9b010 in start_thread (arg=0x7fffa740f100) at pthread_create.c:444
#3  0x00007fffa9d3e364 in .LY__clone () at ../sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S:107
(gdb)

More details in attached file.

Kind regards,
Bernhard

#1067907#15
Date:
2024-04-19 09:34:30 UTC
From:
To:
On 13/04/2024 10:45, Bernhard Übelacker wrote:

Hi Bernard,

Many thanks for looking at this, but I'm afraid I still can't see any
obvious solution.

The failing instruction is

   500                 if (p[3]==1.0) {

I assume the issue is with p[3] rather than 1.0,
but the gbd dump shows p[3] holding a valid value!

   (gdb) print p[3]
   $8 = 1


If anyone with access to hardware was minded to have a further look,
it might be interesting to see if the program works without optimisation,
or maybe with just -O1   (set in Makefile.am)


Kind Regards,
Peter

#1067907#20
Date:
2025-07-22 06:57:53 UTC
From:
To:
On Fri, 19 Apr 2024 10:34:30 +0100 Peter Blackman <peter@pblackman.plus.com> wrote:

Hello Peter,

Thanks for the suggestion. I have access to the ppc64el hardware, and I
will look into this.


Best Regards,
Trupti

#1067907#25
Date:
2025-07-29 18:19:22 UTC
From:
To:
As you suggested, I tried setting the optimization level to -O1 in
Makefile.am, and the program ran without any segmentation faults.

Below are the result :



autopkgtest [14:06:20]: test genome.sh: preparing testbed
Reading package lists...
Building dependency tree...
Reading state information...
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
autopkgtest [14:06:21]: test genome.sh: [-----------------------
+ set -e
+ env seed=22839 issac_seed=12917 flam3-genome
+ xmllint -noout random.flam3
+ env ss=12 qs=6 flam3-render
chaos: 100.0%  took: 1 seconds
filtering...writing 00000.png...done.
+ pngcheck 00000.png
zlib warning:  different version (expected 1.2.13, using 1.3.1)

OK: 00000.png (1200x1200, 32-bit RGB+alpha, non-interlaced, 69.5%).
autopkgtest [14:06:24]: test genome.sh: -----------------------]
autopkgtest [14:06:24]: test genome.sh:  - - - - - - - - - - results - -
- - - - - - - -
genome.sh            PASS
autopkgtest [14:06:24]: @@@@@@@@@@@@@@@@@@@@ summary
convert.sh           PASS
animate.sh           PASS
render.sh            PASS
genome.sh            PASS


Best Regards,
Trupti

#1067907#30
Date:
2025-07-30 11:03:29 UTC
From:
To:

Hi Trupti,

Thanks for looking at this.
Does it run consistently at -O1?
(At -O3, sometimes it works, sometimes it doesn't)


I should have mentioned earlier,
I have a little test script, that I attached to #1001667

A run of a minute or two would suffice to show any issues.


Would be interesting to know what happens with -O2,
as I like to use the highest optimisation that is stable.

Wondering whether this really is a bug in gcc...


Best regards,
Peter

#1067907#35
Date:
2025-07-30 20:05:00 UTC
From:
To:
Hello Peter,

  You are right, I tested using your script, and the program crashes
randomly.

I tried multiple approaches and found that reducing the optimization
level from -O3 to -O2,-O1 does not resolve the segmentation faults.

However, when I removed only the -ffast-math flag (while keeping other
optimizations) from Makefile.am, the program ran consistently without
any segmentation faults.

This seems to indicate that the instability is likely related to the
-ffast-math flag, rather than the optimization level itself.


Thanks Trupti

#1067907#40
Date:
2025-07-31 17:23:58 UTC
From:
To:

Interesting!  I was not expecting -ffast-math to be the cause of the trouble.

Attaching a rules file to use clang. (Clang seems to break dwz!)

If you are happy to try this, it would show if the problem is with gcc.
If the build works with clang with -ffast-math enabled,
I will raise a bug against gcc for this.

Cheers,
Peter

#1067907#45
Date:
2025-08-01 07:17:44 UTC
From:
To:

Thanks for suggestion.
Yes, I tested the build using Clang with -ffast-math enabled, but
unfortunately the genome.sh test still results in a segmentation fault
when run in a loop.

I will once again debug the issue using the gdb tool to get more
clarity.Any additional insights or suggestions are most welcome.

Best Regards,
Trupti

#1067907#50
Date:
2025-08-01 10:31:56 UTC
From:
To:
Hi Trupti,

Just to be sure this is not an own goal,
I attach a series file that comments out
all the non essential patches.


 From the gcc man page, -ffast-math enables the following optimisations

#1067907#55
Date:
2025-08-12 12:52:56 UTC
From:
To:
Hi Peter,

As per the list of flags you provided, I tested each one to identify
which flag triggers the segmentation fault.

I found that the -ffinite-math-only flag is the cause of the
segmentation fault.

Thanks and Regards,
Trupti

#1067907#60
Date:
2025-08-16 16:59:08 UTC
From:
To:
Hi Trupti,

I assume then, that adding -fno-finite-math-only to

export DEB_CFLAGS_MAINT_APPEND =

in debian/rules should fix the problem?


I tried this locally on amd64, and cannot detect
any performance hit, so I am tempted to make this
a general change, not just specific to ppc64el

Thanks for your assistance with this bug.

Regards,
Peter

#1067907#65
Date:
2025-08-19 08:15:55 UTC
From:
To:
Hi Peter,

Yes, that's correct. I verified this by adding -fno-finite-math-only to
debian/rules on the ppc64el machine, and it resolved the segmentation
faults.

So, we can make this change.

Thanks
Trupti.

#1067907#70
Date:
2025-08-22 16:08:29 UTC
From:
To:
Thanks for confirming.
I'll include the fix in the next upload.

Regards,
Peter