Hi ports --

Attached is a band-aid fix to games/armagetronad. It was reported to me some time ago that the game crashes with a segfault when starting a game.

I tracked it down to clang's warning on two source files that look like this: tron/gCycle.cpp:623:16: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to false [-Wtautological-undefined-compare]
        if ( &(*cycle->chatBot_) == 0 )
              ~^~~~~~~~~~~~~~~~~ ~
/usr/include/c++/v1/memory:2048:36: note: 'operator*' returns a reference
    _LIBCPP_INLINE_VISIBILITY _Tp& operator*() const throw()
^

My C++ foo isn't good enough to give this a proper fix but compiling those two specific source files with -O0 prevents the segfault. I'd rather someone smarter than me comes along and provides a proper fix but the band-aid does work at least for me on amd64.

~Brian

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/armagetronad/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- Makefile	24 Oct 2018 14:28:02 -0000	1.12
+++ Makefile	19 Nov 2018 21:15:26 -0000
@@ -4,7 +4,7 @@ COMMENT =		3D light cycle game
 
 DISTNAME =		armagetronad-0.2.8.3.4.src
 PKGNAME =		${DISTNAME:S/.src//}
-REVISION =		2
+REVISION =		3
 
 CATEGORIES =		games
 
Index: patches/patch-src_Makefile_in
===================================================================
RCS file: patches/patch-src_Makefile_in
diff -N patches/patch-src_Makefile_in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_Makefile_in	19 Nov 2018 21:15:26 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+These two must be compiled with -O0 (on clang, at least) otherwise you get a
+segfault.
+
+Index: src/Makefile.in
+--- src/Makefile.in.orig
++++ src/Makefile.in
+@@ -1911,7 +1911,7 @@ libtron_a-gCamera.obj: tron/gCamera.cpp
+ @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtron_a_CXXFLAGS) $(CXXFLAGS) -c -o libtron_a-gCamera.obj `if test -f 'tron/gCamera.cpp'; then $(CYGPATH_W) 'tron/gCamera.cpp'; else $(CYGPATH_W) '$(srcdir)/tron/gCamera.cpp'; fi`
+ 
+ libtron_a-gCycle.o: tron/gCycle.cpp
+-@am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtron_a_CXXFLAGS) $(CXXFLAGS) -MT libtron_a-gCycle.o -MD -MP -MF $(DEPDIR)/libtron_a-gCycle.Tpo -c -o libtron_a-gCycle.o `test -f 'tron/gCycle.cpp' || echo '$(srcdir)/'`tron/gCycle.cpp
++@am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtron_a_CXXFLAGS) $(CXXFLAGS) -O0 -MT libtron_a-gCycle.o -MD -MP -MF $(DEPDIR)/libtron_a-gCycle.Tpo -c -o libtron_a-gCycle.o `test -f 'tron/gCycle.cpp' || echo '$(srcdir)/'`tron/gCycle.cpp
+ @am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libtron_a-gCycle.Tpo $(DEPDIR)/libtron_a-gCycle.Po
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='tron/gCycle.cpp' object='libtron_a-gCycle.o' libtool=no @AMDEPBACKSLASH@
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@@ -1953,7 +1953,7 @@ libtron_a-gExplosion.obj: tron/gExplosion.cpp
+ @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtron_a_CXXFLAGS) $(CXXFLAGS) -c -o libtron_a-gExplosion.obj `if test -f 'tron/gExplosion.cpp'; then $(CYGPATH_W) 'tron/gExplosion.cpp'; else $(CYGPATH_W) '$(srcdir)/tron/gExplosion.cpp'; fi`
+ 
+ libtron_a-gGame.o: tron/gGame.cpp
+-@am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtron_a_CXXFLAGS) $(CXXFLAGS) -MT libtron_a-gGame.o -MD -MP -MF $(DEPDIR)/libtron_a-gGame.Tpo -c -o libtron_a-gGame.o `test -f 'tron/gGame.cpp' || echo '$(srcdir)/'`tron/gGame.cpp
++@am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtron_a_CXXFLAGS) $(CXXFLAGS) -O0 -MT libtron_a-gGame.o -MD -MP -MF $(DEPDIR)/libtron_a-gGame.Tpo -c -o libtron_a-gGame.o `test -f 'tron/gGame.cpp' || echo '$(srcdir)/'`tron/gGame.cpp
+ @am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/libtron_a-gGame.Tpo $(DEPDIR)/libtron_a-gGame.Po
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='tron/gGame.cpp' object='libtron_a-gGame.o' libtool=no @AMDEPBACKSLASH@
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@

Reply via email to