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
> > --- Makefile        10 Apr 2017 11:46:19 -0000      1.68
> > +++ Makefile        8 May 2017 20:24:55 -0000
> > @@ -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 <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 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 -0000       1.34
> > +++ distinfo        8 May 2017 20:24:55 -0000
> > @@ -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 -0000      1.7
> > +++ Makefile        8 May 2017 20:24:58 -0000
> > @@ -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

Reply via email to