Thursday, May 25, 2017

Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

On Tue, 9 May 2017, Donovan Watteau wrote:
> Thanks everyone for your valuable suggestions!
>
> A new diff follows...
>

This new diff uses the new USE_CXX mechanism. Fine for me on macppc,
but I don't have any aarch64 device to test the clang-by-default case.

I've also added an upstream patch for ScummVM that fixes a crash with
Rex Nebular.


games/scummvm:

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/scummvm/Makefile,v
retrieving revision 1.68
diff -u -p -r1.68 Makefile
--- Makefile 10 Apr 2017 11:46:19 -0000 1.68
+++ Makefile 26 May 2017 13:20:44 -0000
@@ -2,6 +2,7 @@

COMMENT= graphical adventure game interpreter
V= 1.9.0
+REVISION= 0
DISTNAME= scummvm-${V}
CATEGORIES= games x11 emulators
MASTER_SITES= http://www.scummvm.org/frs/scummvm/${V}/
@@ -13,12 +14,17 @@ MAINTAINER= Jonathan Gray <jsg@openbsd.o
# GPLv2+
PERMIT_PACKAGE_CDROM= Yes

-WANTLIB += FLAC SDL2 c faad freetype jpeg m mad png pthread sndio ${LIBCXX}
+WANTLIB += FLAC SDL2 c faad freetype jpeg m mad png sndio ${LIBECXX}
WANTLIB += theoradec z

.if ${MACHINE_ARCH} == "i386"
BUILD_DEPENDS= devel/nasm
.endif
+
+# GCC 4.2.1 miscompiles this on at least ppc, so play safe and
+# just use a newer compiler everywhere.
+WANT_CXX= base gcc
+MODGCC4_LANGS= c++

RUN_DEPENDS= devel/desktop-file-utils
LIB_DEPENDS= audio/libmad \
Index: patches/patch-engines_mads_palette_cpp
===================================================================
RCS file: patches/patch-engines_mads_palette_cpp
diff -N patches/patch-engines_mads_palette_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-engines_mads_palette_cpp 26 May 2017 13:20:44 -0000
@@ -0,0 +1,28 @@
+$OpenBSD$
+
+MADS: Fix two off-by-ones in Fader::insertionSort
+
+Commit 407187161038403f4d5e1ea35841379edfcef47a upstream.
+
+Index: engines/mads/palette.cpp
+--- engines/mads/palette.cpp.orig
++++ engines/mads/palette.cpp
+@@ -665,15 +665,15 @@ void Fader::insertionSort(int size, byte *id, byte *va
+
+ int moveCount = size - arrIndex - 1;
+ if (moveCount > 0) {
+- Common::copy(idP + 1, idP + moveCount + 2, idP);
+- Common::copy(valueP + 1, valueP + moveCount + 2, valueP);
++ Common::copy(idP + 1, idP + moveCount + 1, idP);
++ Common::copy(valueP + 1, valueP + moveCount + 1, valueP);
+ }
+
+ // Scan for insert spot
+ int idx = 0;
+ if (endIndex > 0) {
+ bool breakFlag = false;
+- for (; idx <= endIndex && !breakFlag; ++idx) {
++ for (; idx <= endIndex - 1 && !breakFlag; ++idx) {
+ breakFlag = savedId < id[idx];
+ }
+ }



games/residualvm:

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/residualvm/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile 10 Apr 2017 11:46:19 -0000 1.7
+++ Makefile 26 May 2017 13:20:49 -0000
@@ -3,9 +3,9 @@
COMMENT = interpreter for some LucasArts 3D games

V = 0.2.1
+REVISION = 2
DISTNAME = residualvm-${V}-sources
PKGNAME = residualvm-${V}
-REVISION = 1

CATEGORIES = games

@@ -14,7 +14,7 @@ HOMEPAGE = http://residualvm.org/
# GPLv2+
PERMIT_PACKAGE_CDROM = Yes

-WANTLIB += GL SDL c freetype iconv jpeg m mad mpeg2 ogg png pthread ${LIBCXX}
+WANTLIB += GL SDL c freetype iconv jpeg m mad mpeg2 ogg png pthread ${LIBECXX}
WANTLIB += theoradec vorbis vorbisfile z

MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=residualvm/}
@@ -29,6 +29,11 @@ LIB_DEPENDS = audio/libmad \
multimedia/libtheora
RUN_DEPENDS = devel/desktop-file-utils \
x11/gtk+3,-guic
+
+# GCC 4.2.1 miscompiles this on at least ppc, so play safe and
+# just use a newer compiler everywhere.
+WANT_CXX = base gcc
+MODGCC4_LANGS = c++

SEPARATE_BUILD = Yes
USE_GMAKE = Yes

No comments:

Post a Comment