media-libs/netpbm: fix compilation with clang -O2

Closes: https://bugs.gentoo.org/885561
Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
This commit is contained in:
Viorel Munteanu
2023-01-02 18:29:39 +02:00
parent 3c6c0a2c89
commit 1c7a04ecf4
2 changed files with 28 additions and 3 deletions
@@ -0,0 +1,26 @@
When compiling with clang and -O2, local variable origJmpbufP with value
changed after setjmp contains garbage after longjmp.
According to glibc documentation, making it volatile should have fixed the
issue, but it didn't. Static outside the function works.
Bug: https://bugs.gentoo.org/885561
--- a/lib/libpamread.c
+++ b/lib/libpamread.c
@@ -25,6 +25,7 @@
#include "fileio.h"
#include "pam.h"
+static jmp_buf * origJmpbufP = NULL;
static void
readPbmRow(const struct pam * const pamP,
@@ -35,7 +36,6 @@
"It says PBM format, but 'depth' member is not 1.");
else {
jmp_buf jmpbuf;
- jmp_buf * origJmpbufP;
unsigned char * bitrow;
bitrow = (unsigned char *) pbm_allocrow(pbm_packed_bytes(pamP->width));
@@ -42,16 +42,14 @@ RDEPEND="
)
rle? ( media-libs/urt:= )
svga? ( media-libs/svgalib )
tiff? ( >=media-libs/tiff-3.5.5:= )
tiff? ( media-libs/tiff )
xml? ( dev-libs/libxml2 )
X? ( x11-libs/libX11 )
"
DEPEND="
${RDEPEND}
x11-base/xorg-proto
"
BDEPEND="
app-arch/xz-utils
sys-devel/flex
@@ -61,6 +59,7 @@ BDEPEND="
PATCHES=(
"${FILESDIR}"/netpbm-10.86.21-build.patch
"${FILESDIR}"/netpbm-11.0.0-misc-deps.patch
"${FILESDIR}"/netpbm-11.1.0-fix-clang-O2.patch
)
netpbm_libtype() {