Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-28 Thread Juan Francisco Cantero Hurtado
On Fri, May 26, 2017 at 03:35:29PM +0100, Stuart Henderson wrote:
> On 2017/05/26 03:07, Donovan Watteau wrote:
> > 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.
> 
> Pretty much OK, one comment:
> 
> > +# 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++
> 
> MODGCC4_LANGS=c++ is the default with WANT_CXX, no need to set it here.
> 
> Any objections?

LGTM. No objection.

> 
> 
> Index: scummvm/Makefile
> ===
> RCS file: /cvs/ports/games/scummvm/Makefile,v
> retrieving revision 1.68
> diff -u -p -r1.68 Makefile
> --- scummvm/Makefile  10 Apr 2017 11:46:19 -  1.68
> +++ scummvm/Makefile  26 May 2017 13:50:28 -
> @@ -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,16 @@ MAINTAINER=   Jonathan Gray   # 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
>  
>  RUN_DEPENDS= devel/desktop-file-utils
>  LIB_DEPENDS= audio/libmad \
> Index: scummvm/patches/patch-engines_mads_palette_cpp
> ===
> RCS file: scummvm/patches/patch-engines_mads_palette_cpp
> diff -N scummvm/patches/patch-engines_mads_palette_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ scummvm/patches/patch-engines_mads_palette_cpp26 May 2017 13:50:28 
> -
> @@ -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];
> + }
> + }
> Index: residualvm/Makefile
> ===
> RCS file: /cvs/ports/games/residualvm/Makefile,v
> retrieving revision 1.7
> diff -u -p -r1.7 Makefile
> --- residualvm/Makefile   10 Apr 2017 11:46:19 -  1.7
> +++ residualvm/Makefile   26 May 2017 13:50:28 -
> @@ -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,10 @@ LIB_DEPENDS =  audio/libmad \
>   multimedia/libtheora
>  RUN_DEPENDS =devel/desktop-file-utils \
> 

Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-26 Thread Stuart Henderson
On 2017/05/26 03:07, Donovan Watteau wrote:
> 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.

Pretty much OK, one comment:

> +# 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++

MODGCC4_LANGS=c++ is the default with WANT_CXX, no need to set it here.

Any objections?


Index: scummvm/Makefile
===
RCS file: /cvs/ports/games/scummvm/Makefile,v
retrieving revision 1.68
diff -u -p -r1.68 Makefile
--- scummvm/Makefile10 Apr 2017 11:46:19 -  1.68
+++ scummvm/Makefile26 May 2017 13:50:28 -
@@ -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,16 @@ MAINTAINER= Jonathan Gray  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];
+   }
+   }
Index: residualvm/Makefile
===
RCS file: /cvs/ports/games/residualvm/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- residualvm/Makefile 10 Apr 2017 11:46:19 -  1.7
+++ residualvm/Makefile 26 May 2017 13:50:28 -
@@ -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,10 @@ 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
 
 SEPARATE_BUILD =   Yes
 USE_GMAKE =Yes



Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-26 Thread Donovan Watteau
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
--- Makefile10 Apr 2017 11:46:19 -  1.68
+++ Makefile26 May 2017 13:20:44 -
@@ -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  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
--- Makefile10 Apr 2017 11:46:19 -  1.7
+++ Makefile26 May 2017 13:20:49 -
@@ -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



Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-09 Thread Marc Espie
gcc4 is wildly incompatible with base clang. More precisely the C++
library.

So, yeah, MODGCC4 on aarch64 ? not that useful.



Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-09 Thread Donovan Watteau
Thanks everyone for your valuable suggestions!

A new diff follows...

On Tue, 9 May 2017, Stuart Henderson wrote:
> On 2017/05/09 12:25, Juan Francisco Cantero Hurtado wrote:
> > On Tue, May 09, 2017 at 11:24:27AM +1000, Jonathan Gray wrote:
> > > On Mon, May 08, 2017 at 10:47:56PM +0200, Donovan Watteau wrote:
> > > > Hi,
> > > > 
> > > > ScummVM and ResidualVM share some code, and it looks like they 
> > > > trigger an old bug with GCC 4.2.1 on ppc.
> > > > 
> > > > All the games having voices crash at startup on macppc, with what
> > > > looks like some miscompiled code in audio/decoders/voc.cpp for
> > > > ScummVM, and common/stream.cpp for ResidualVM.
> > > > 
> > > > After some trial and error, it looks like this is a bug with
> > > > -funit-at-a-time on GCC 4.2.1.  I see this problem on macppc,
> > > > but it could also happen on arm, judging by the following
> > > > similar reports:
> > > > http://www.smartmontools.org/ticket/219
> > > > https://gcc.gnu.org/ml/gcc-help/2010-11/msg00038.html
> > > 
> > > I think you should only do this for powerpc for now, as
> > > otherwise aarch64 has no chance of building.
> > > 
> > 
> > With MODGCC4_ARCHS=${GCC3_ARCHS} ${GCC4_ARCHS}, the port will use clang
> > on aarch64.
> 
> But if you just change that, WANTLIB will be missing the c++ libs.

IMHO, it should be MODGCC4's job to "fix" your current ${LIBCXX} for
archs where the module is enabled...

Other MODGCC4 C++ ports don't have any ${LIBCXX} (and probably miss
aarch64), and other ports have both stdc++ and estdc++.  I think the
latter is the "best" trade-off at the moment.

games/scummvm:

Index: Makefile
===
RCS file: /cvs/ports/games/scummvm/Makefile,v
retrieving revision 1.68
diff -u -p -r1.68 Makefile
--- Makefile10 Apr 2017 11:46:19 -  1.68
+++ Makefile9 May 2017 18:20:50 -
@@ -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}/
@@ -19,6 +20,12 @@ 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.
+MODULES=   gcc4
+MODGCC4_ARCHS= ${GCC3_ARCHS} ${GCC4_ARCHS}
+MODGCC4_LANGS= c++
 
 RUN_DEPENDS=   devel/desktop-file-utils
 LIB_DEPENDS=   audio/libmad \

games/residualvm:

Index: Makefile
===
RCS file: /cvs/ports/games/residualvm/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile10 Apr 2017 11:46:19 -  1.7
+++ Makefile9 May 2017 18:22:45 -
@@ -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
 
@@ -29,6 +29,12 @@ 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.
+MODULES =  gcc4
+MODGCC4_ARCHS =${GCC3_ARCHS} ${GCC4_ARCHS}
+MODGCC4_LANGS =c++
 
 SEPARATE_BUILD =   Yes
 USE_GMAKE =Yes



Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-09 Thread Stuart Henderson
On 2017/05/09 12:25, Juan Francisco Cantero Hurtado wrote:
> On Tue, May 09, 2017 at 11:24:27AM +1000, Jonathan Gray wrote:
> > On Mon, May 08, 2017 at 10:47:56PM +0200, Donovan Watteau wrote:
> > > Hi,
> > > 
> > > ScummVM and ResidualVM share some code, and it looks like they 
> > > trigger an old bug with GCC 4.2.1 on ppc.
> > > 
> > > All the games having voices crash at startup on macppc, with what
> > > looks like some miscompiled code in audio/decoders/voc.cpp for
> > > ScummVM, and common/stream.cpp for ResidualVM.
> > > 
> > > After some trial and error, it looks like this is a bug with
> > > -funit-at-a-time on GCC 4.2.1.  I see this problem on macppc,
> > > but it could also happen on arm, judging by the following
> > > similar reports:
> > > http://www.smartmontools.org/ticket/219
> > > https://gcc.gnu.org/ml/gcc-help/2010-11/msg00038.html
> > 
> > I think you should only do this for powerpc for now, as
> > otherwise aarch64 has no chance of building.
> > 
> 
> With MODGCC4_ARCHS=${GCC3_ARCHS} ${GCC4_ARCHS}, the port will use clang
> on aarch64.

But if you just change that, WANTLIB will be missing the c++ libs.

> > > 
> > > So, using -fno-unit-at-a-time could be an option and works, but
> > > it looks like a complex and random bug in GCC 4.2, so I think it's
> > > probably safer to compile ScummVM and ResidualVM with a newer
> > > compiler that doesn't miscompile this in the first place.
> > > 
> > > The crashes disappear on macppc when compiling with GCC 4.9.
> > > 
> > > Switch to .tar.xz distfiles while there, as this was debugged
> > > on an extremely poor link where saving a bit of bandwidth helped.
> > > 
> > > 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 -  1.68
> > > +++ Makefile  8 May 2017 20:24:55 -
> > > @@ -5,6 +5,8 @@ V=1.9.0
> > >  DISTNAME=scummvm-${V}
> > >  CATEGORIES=  games x11 emulators
> > >  MASTER_SITES=http://www.scummvm.org/frs/scummvm/${V}/
> > > +EXTRACT_SUFX=.tar.xz
> > > +REVISION=0
> > >  
> > >  HOMEPAGE=http://www.scummvm.org/
> > >  
> > > @@ -13,12 +15,18 @@ MAINTAINER=   Jonathan Gray  > >  # 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 pthread sndio
> > >  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.
> > > +MODULES= gcc4
> > > +MODGCC4_ARCHS=   *
> > > +MODGCC4_LANGS=   c++
> > >  
> > >  RUN_DEPENDS= devel/desktop-file-utils
> > >  LIB_DEPENDS= audio/libmad \
> > > Index: distinfo
> > > ===
> > > RCS file: /cvs/ports/games/scummvm/distinfo,v
> > > retrieving revision 1.34
> > > diff -u -p -r1.34 distinfo
> > > --- distinfo  1 Nov 2016 13:03:14 -   1.34
> > > +++ distinfo  8 May 2017 20:24:55 -
> > > @@ -1,2 +1,2 @@
> > > -SHA256 (scummvm-1.9.0.tar.gz) = 
> > > tfDO8sSds8UhjPhe9xhUi3Ctj6Wks20h3ywGcVBVgfU=
> > > -SIZE (scummvm-1.9.0.tar.gz) = 33252122
> > > +SHA256 (scummvm-1.9.0.tar.xz) = 
> > > JBftyxrVHKBagXxYru5hC8bbVEKYTozyjopf2RTorgU=
> > > +SIZE (scummvm-1.9.0.tar.xz) = 22020384
> > > 
> > > 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 -  1.7
> > > +++ Makefile  8 May 2017 20:24:58 -
> > > @@ -5,7 +5,7 @@ COMMENT = interpreter for some LucasArt
> > >  V =  0.2.1
> > >  DISTNAME =   residualvm-${V}-sources
> > >  PKGNAME =residualvm-${V}
> > > -REVISION =   1
> > > +REVISION =   2
> > >  
> > >  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
> > >  WANTLIB += theoradec vorbis vorbisfile z
> > >  
> > >  MASTER_SITES =   ${MASTER_SITE_SOURCEFORGE:=residualvm/}
> > > @@ -29,6 +29,12 @@ LIB_DEPENDS =  audio/libmad \
> > >   multimedia/libtheora
> > >  RUN_DEPENDS =devel/desktop-file-utils \
> > >   x11/gtk+3,-guic
> > > +
> > > +# GCC 

Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-09 Thread Stuart Henderson
On 2017/05/09 11:24, Jonathan Gray wrote:
> On Mon, May 08, 2017 at 10:47:56PM +0200, Donovan Watteau wrote:
> > Hi,
> > 
> > ScummVM and ResidualVM share some code, and it looks like they 
> > trigger an old bug with GCC 4.2.1 on ppc.
> > 
> > All the games having voices crash at startup on macppc, with what
> > looks like some miscompiled code in audio/decoders/voc.cpp for
> > ScummVM, and common/stream.cpp for ResidualVM.
> > 
> > After some trial and error, it looks like this is a bug with
> > -funit-at-a-time on GCC 4.2.1.  I see this problem on macppc,
> > but it could also happen on arm, judging by the following
> > similar reports:
> > http://www.smartmontools.org/ticket/219
> > https://gcc.gnu.org/ml/gcc-help/2010-11/msg00038.html
> 
> I think you should only do this for powerpc for now, as
> otherwise aarch64 has no chance of building.

I agree. Leave the WANTLIB as they were, don't worry about the "Extra"
line you get from lib-depends-check on ppc.

> > --- Makefile10 Apr 2017 11:46:19 -  1.68
> > +++ Makefile8 May 2017 20:24:55 -
> > @@ -5,6 +5,8 @@ V=  1.9.0
> >  DISTNAME=  scummvm-${V}
> >  CATEGORIES=games x11 emulators
> >  MASTER_SITES=  http://www.scummvm.org/frs/scummvm/${V}/
> > +EXTRACT_SUFX=  .tar.xz
> > +REVISION=  0

+1 for juanfra's point about position of the REVISION line.

> > @@ -1,2 +1,2 @@
> > -SHA256 (scummvm-1.9.0.tar.gz) = 
> > tfDO8sSds8UhjPhe9xhUi3Ctj6Wks20h3ywGcVBVgfU=
> > -SIZE (scummvm-1.9.0.tar.gz) = 33252122
> > +SHA256 (scummvm-1.9.0.tar.xz) = 
> > JBftyxrVHKBagXxYru5hC8bbVEKYTozyjopf2RTorgU=
> > +SIZE (scummvm-1.9.0.tar.xz) = 22020384

So now people who already have scummvm-1.9.0.tar.gz need to download and store 
an
extra file... I think this part should be left out, but consider switching to a
tar.xz for the next update.



Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-09 Thread Juan Francisco Cantero Hurtado
On Tue, May 09, 2017 at 11:24:27AM +1000, Jonathan Gray wrote:
> On Mon, May 08, 2017 at 10:47:56PM +0200, Donovan Watteau wrote:
> > Hi,
> > 
> > ScummVM and ResidualVM share some code, and it looks like they 
> > trigger an old bug with GCC 4.2.1 on ppc.
> > 
> > All the games having voices crash at startup on macppc, with what
> > looks like some miscompiled code in audio/decoders/voc.cpp for
> > ScummVM, and common/stream.cpp for ResidualVM.
> > 
> > After some trial and error, it looks like this is a bug with
> > -funit-at-a-time on GCC 4.2.1.  I see this problem on macppc,
> > but it could also happen on arm, judging by the following
> > similar reports:
> > http://www.smartmontools.org/ticket/219
> > https://gcc.gnu.org/ml/gcc-help/2010-11/msg00038.html
> 
> I think you should only do this for powerpc for now, as
> otherwise aarch64 has no chance of building.
> 

With MODGCC4_ARCHS=${GCC3_ARCHS} ${GCC4_ARCHS}, the port will use clang
on aarch64.

> > 
> > So, using -fno-unit-at-a-time could be an option and works, but
> > it looks like a complex and random bug in GCC 4.2, so I think it's
> > probably safer to compile ScummVM and ResidualVM with a newer
> > compiler that doesn't miscompile this in the first place.
> > 
> > The crashes disappear on macppc when compiling with GCC 4.9.
> > 
> > Switch to .tar.xz distfiles while there, as this was debugged
> > on an extremely poor link where saving a bit of bandwidth helped.
> > 
> > games/scummvm:
> > 
> > Index: Makefile
> > ===
> > RCS file: /cvs/ports/games/scummvm/Makefile,v
> > retrieving revision 1.68
> > diff -u -p -r1.68 Makefile
> > --- Makefile10 Apr 2017 11:46:19 -  1.68
> > +++ Makefile8 May 2017 20:24:55 -
> > @@ -5,6 +5,8 @@ V=  1.9.0
> >  DISTNAME=  scummvm-${V}
> >  CATEGORIES=games x11 emulators
> >  MASTER_SITES=  http://www.scummvm.org/frs/scummvm/${V}/
> > +EXTRACT_SUFX=  .tar.xz
> > +REVISION=  0
> >  
> >  HOMEPAGE=  http://www.scummvm.org/
> >  
> > @@ -13,12 +15,18 @@ MAINTAINER= Jonathan Gray  >  # 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 pthread sndio
> >  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.
> > +MODULES=   gcc4
> > +MODGCC4_ARCHS= *
> > +MODGCC4_LANGS= c++
> >  
> >  RUN_DEPENDS=   devel/desktop-file-utils
> >  LIB_DEPENDS=   audio/libmad \
> > Index: distinfo
> > ===
> > RCS file: /cvs/ports/games/scummvm/distinfo,v
> > retrieving revision 1.34
> > diff -u -p -r1.34 distinfo
> > --- distinfo1 Nov 2016 13:03:14 -   1.34
> > +++ distinfo8 May 2017 20:24:55 -
> > @@ -1,2 +1,2 @@
> > -SHA256 (scummvm-1.9.0.tar.gz) = 
> > tfDO8sSds8UhjPhe9xhUi3Ctj6Wks20h3ywGcVBVgfU=
> > -SIZE (scummvm-1.9.0.tar.gz) = 33252122
> > +SHA256 (scummvm-1.9.0.tar.xz) = 
> > JBftyxrVHKBagXxYru5hC8bbVEKYTozyjopf2RTorgU=
> > +SIZE (scummvm-1.9.0.tar.xz) = 22020384
> > 
> > games/residualvm:
> > 
> > Index: Makefile
> > ===
> > RCS file: /cvs/ports/games/residualvm/Makefile,v
> > retrieving revision 1.7
> > diff -u -p -r1.7 Makefile
> > --- Makefile10 Apr 2017 11:46:19 -  1.7
> > +++ Makefile8 May 2017 20:24:58 -
> > @@ -5,7 +5,7 @@ COMMENT =   interpreter for some LucasArt
> >  V =0.2.1
> >  DISTNAME = residualvm-${V}-sources
> >  PKGNAME =  residualvm-${V}
> > -REVISION = 1
> > +REVISION = 2
> >  
> >  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
> >  WANTLIB += theoradec vorbis vorbisfile z
> >  
> >  MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=residualvm/}
> > @@ -29,6 +29,12 @@ 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.
> > +MODULES =  gcc4
> > +MODGCC4_ARCHS =*
> > +MODGCC4_LANGS =c++
> >  
> >  SEPARATE_BUILD =   Yes
> >  USE_GMAKE =Yes
> > 
> 

-- 
Juan Francisco Cantero Hurtado http://juanfra.info



Re: [PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-08 Thread Juan Francisco Cantero Hurtado
On Mon, May 08, 2017 at 10:47:56PM +0200, Donovan Watteau wrote:
> Hi,
> 
> ScummVM and ResidualVM share some code, and it looks like they 
> trigger an old bug with GCC 4.2.1 on ppc.
> 
> All the games having voices crash at startup on macppc, with what
> looks like some miscompiled code in audio/decoders/voc.cpp for
> ScummVM, and common/stream.cpp for ResidualVM.
> 
> After some trial and error, it looks like this is a bug with
> -funit-at-a-time on GCC 4.2.1.  I see this problem on macppc,
> but it could also happen on arm, judging by the following
> similar reports:
> http://www.smartmontools.org/ticket/219
> https://gcc.gnu.org/ml/gcc-help/2010-11/msg00038.html
> 
> So, using -fno-unit-at-a-time could be an option and works, but
> it looks like a complex and random bug in GCC 4.2, so I think it's
> probably safer to compile ScummVM and ResidualVM with a newer
> compiler that doesn't miscompile this in the first place.
> 
> The crashes disappear on macppc when compiling with GCC 4.9.
> 
> Switch to .tar.xz distfiles while there, as this was debugged
> on an extremely poor link where saving a bit of bandwidth helped.
> 
> 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 -  1.68
> +++ Makefile  8 May 2017 20:24:55 -
> @@ -5,6 +5,8 @@ V=1.9.0

Move REVISION here. Keep REVISION always close to the version.

>  DISTNAME=scummvm-${V}
>  CATEGORIES=  games x11 emulators
>  MASTER_SITES=http://www.scummvm.org/frs/scummvm/${V}/
> +EXTRACT_SUFX=.tar.xz
> +REVISION=0
>  
>  HOMEPAGE=http://www.scummvm.org/
>  
> @@ -13,12 +15,18 @@ MAINTAINER=   Jonathan Gray   # 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 pthread sndio

Check the binaries with ldd. This change is probably a false positive.

>  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.
> +MODULES= gcc4
> +MODGCC4_ARCHS=   *

Change to MODGCC4_ARCHS=${GCC3_ARCHS} ${GCC4_ARCHS}

That change will help us when the default compiler in base changes to
clang.

> +MODGCC4_LANGS=   c++
>  
>  RUN_DEPENDS= devel/desktop-file-utils
>  LIB_DEPENDS= audio/libmad \
> Index: distinfo
> ===
> RCS file: /cvs/ports/games/scummvm/distinfo,v
> retrieving revision 1.34
> diff -u -p -r1.34 distinfo
> --- distinfo  1 Nov 2016 13:03:14 -   1.34
> +++ distinfo  8 May 2017 20:24:55 -
> @@ -1,2 +1,2 @@
> -SHA256 (scummvm-1.9.0.tar.gz) = tfDO8sSds8UhjPhe9xhUi3Ctj6Wks20h3ywGcVBVgfU=
> -SIZE (scummvm-1.9.0.tar.gz) = 33252122
> +SHA256 (scummvm-1.9.0.tar.xz) = JBftyxrVHKBagXxYru5hC8bbVEKYTozyjopf2RTorgU=
> +SIZE (scummvm-1.9.0.tar.xz) = 22020384
> 
> 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 -  1.7
> +++ Makefile  8 May 2017 20:24:58 -
> @@ -5,7 +5,7 @@ COMMENT = interpreter for some LucasArt
>  V =  0.2.1

Move the REVISION here.

>  DISTNAME =   residualvm-${V}-sources
>  PKGNAME =residualvm-${V}
> -REVISION =   1
> +REVISION =   2
>  
>  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

Check with ldd the change.

>  WANTLIB += theoradec vorbis vorbisfile z
>  
>  MASTER_SITES =   ${MASTER_SITE_SOURCEFORGE:=residualvm/}
> @@ -29,6 +29,12 @@ 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.
> +MODULES =gcc4
> +MODGCC4_ARCHS =  *

Same as the previous port.

> +MODGCC4_LANGS =  c++
>  
>  SEPARATE_BUILD = Yes
>  USE_GMAKE =  Yes
> 

-- 
Juan Francisco Cantero Hurtado http://juanfra.info



[PATCH] scummvm and residualvm GCC 4.2.1 miscompilation

2017-05-08 Thread Donovan Watteau
Hi,

ScummVM and ResidualVM share some code, and it looks like they 
trigger an old bug with GCC 4.2.1 on ppc.

All the games having voices crash at startup on macppc, with what
looks like some miscompiled code in audio/decoders/voc.cpp for
ScummVM, and common/stream.cpp for ResidualVM.

After some trial and error, it looks like this is a bug with
-funit-at-a-time on GCC 4.2.1.  I see this problem on macppc,
but it could also happen on arm, judging by the following
similar reports:
http://www.smartmontools.org/ticket/219
https://gcc.gnu.org/ml/gcc-help/2010-11/msg00038.html

So, using -fno-unit-at-a-time could be an option and works, but
it looks like a complex and random bug in GCC 4.2, so I think it's
probably safer to compile ScummVM and ResidualVM with a newer
compiler that doesn't miscompile this in the first place.

The crashes disappear on macppc when compiling with GCC 4.9.

Switch to .tar.xz distfiles while there, as this was debugged
on an extremely poor link where saving a bit of bandwidth helped.

games/scummvm:

Index: Makefile
===
RCS file: /cvs/ports/games/scummvm/Makefile,v
retrieving revision 1.68
diff -u -p -r1.68 Makefile
--- Makefile10 Apr 2017 11:46:19 -  1.68
+++ Makefile8 May 2017 20:24:55 -
@@ -5,6 +5,8 @@ V=  1.9.0
 DISTNAME=  scummvm-${V}
 CATEGORIES=games x11 emulators
 MASTER_SITES=  http://www.scummvm.org/frs/scummvm/${V}/
+EXTRACT_SUFX=  .tar.xz
+REVISION=  0
 
 HOMEPAGE=  http://www.scummvm.org/
 
@@ -13,12 +15,18 @@ MAINTAINER= Jonathan Gray