Dear Maintainer,
I just tried to reproduce the issue.
This segfault in GL_shadow happens here:
Thread 1 "gl_shadow" received signal SIGSEGV, Segmentation fault.
0x79f6 in LoadTexture (tex_name=0x7fffe120 "tex.png") at
src/benchmarks/GL_shadow/object.c:196
196 if ((tex_img->format)->Amask)
(gdb) bt
#0 0x55909d0d59f6 in LoadTexture (tex_name=0x7ffd0d909650 "tex.png")
at src/benchmarks/GL_shadow/object.c:196
#1 0x55909d0d528c in LoadObject (objfile=0x55909d0d8076 "cube.obj") at
src/benchmarks/GL_shadow/object.c:83
#2 0x55909d0d5ed8 in InitObject (objfile=0x55909d0d8076 "cube.obj") at
src/benchmarks/GL_shadow/object.c:268
#3 0x55909d0d4a89 in main (argc=4, argv=0x7ffd0d909ad8) at
src/benchmarks/GL_shadow/main.c:121
This looks like another case of truncated pointer because of
implicit prototypes, which unfortunately on amd64 default
to int (4 bytes) and therefore fail when a pointer (8 bytes) is
returned by a function.
This warning seems to be contained in the build logs:
gcc -o src/benchmarks/GL_shadow/object.o -c -g -D_GNU_SOURCE=1 -D_REENTRANT
-I/usr/include/SDL src/benchmarks/GL_shadow/object.c
src/benchmarks/GL_shadow/object.c: In function 'LoadTexture':
src/benchmarks/GL_shadow/object.c:192:31: warning: implicit declaration of
function 'IMG_Load' [-Wimplicit-function-declaration]
if(tex_img = (SDL_Surface *) IMG_Load(tex_name)) {
^~~~
src/benchmarks/GL_shadow/object.c:192:15: warning: cast to pointer from
integer of different size [-Wint-to-pointer-cast]
if(tex_img = (SDL_Surface *) IMG_Load(tex_name)) {
^
Attached patch adds compiler flags and includes to avoid
implicit prototypes.
Kind regards,
Bernhard
> gdb run is not very helpful due lack of debugging symbols.
PS. @Witold Baryluk:
Also a failing stack can be of some use when the issue
is tried to be reproduced.
And the debug symbols are stored in a different repository.
You find some information at https://wiki.debian.org/HowToGetABacktrace
Description: Force prototypes
---
Author: Bernhard Ãbelacker
Bug-Debian: https://bugs.debian.org/913174
Forwarded: no
Last-Update: 2018-11-09
--- globs-0.2.0~svn50.orig/src/benchmarks/GLSL_parallax/extra.c
+++ globs-0.2.0~svn50/src/benchmarks/GLSL_parallax/extra.c
@@ -17,6 +17,8 @@
*/
+#define GL_GLEXT_PROTOTYPES
+
#include
#include
#include
@@ -26,6 +28,7 @@
#include
#include "init.h"
+#include "extra.h"
void UpdateLight(struct Light *l)
{
--- globs-0.2.0~svn50.orig/src/benchmarks/GLSL_parallax/init.c
+++ globs-0.2.0~svn50/src/benchmarks/GLSL_parallax/init.c
@@ -17,15 +17,19 @@
*/
+#define GL_GLEXT_PROTOTYPES
+
#include
#include
#include
+#include
#include
#include
#include "init.h"
#include "textfile.h"
+#include "extra.h"
void InitLighting(struct Light *l, struct Material *m)
--- globs-0.2.0~svn50.orig/src/benchmarks/GLSL_parallax/main.c
+++ globs-0.2.0~svn50/src/benchmarks/GLSL_parallax/main.c
@@ -16,6 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define GL_GLEXT_PROTOTYPES
#include
#include
--- globs-0.2.0~svn50.orig/src/benchmarks/GLSL_parallax/textfile.c
+++ globs-0.2.0~svn50/src/benchmarks/GLSL_parallax/textfile.c
@@ -16,6 +16,7 @@
#include
#include
#include
+#include "textfile.h"
char *textFileRead(char *fn) {
--- globs-0.2.0~svn50.orig/src/benchmarks/GL_shadow/object.c
+++ globs-0.2.0~svn50/src/benchmarks/GL_shadow/object.c
@@ -8,6 +8,7 @@
#include
#include
#include
+#include
#include
#include "object.h"
--- globs-0.2.0~svn50.orig/src/benchmarks/GL_smoke/particle.c
+++ globs-0.2.0~svn50/src/benchmarks/GL_smoke/particle.c
@@ -4,6 +4,7 @@
#include
#include
+#include
#include
#include "particle.h"
--- globs-0.2.0~svn50.orig/src/benchmarks/SConstruct
+++ globs-0.2.0~svn50/src/benchmarks/SConstruct
@@ -13,7 +13,7 @@ except SCons.Errors.UserError:
install_dir = os.path.join(root, prefix, 'share/globs/benchmarks')
# create build environment
-env = Environment(CCFLAGS = '-g')
+env = Environment(CCFLAGS = '-g -Werror=missing-prototypes -Werror=implicit-function-declaration')
# determine compiler and linker flags for SDL
env.ParseConfig('sdl-config --cflags')
--- globs-0.2.0~svn50.orig/src/benchmarks/check_time.c
+++ globs-0.2.0~svn50/src/benchmarks/check_time.c
@@ -1,5 +1,6 @@
#include
#include
+#include "check_time.h"
long int check_time(int time)
{
--- globs-0.2.0~svn50.orig/src/benchmarks/get_options.c
+++ globs-0.2.0~svn50/src/benchmarks/get_options.c
@@ -1,3 +1,4 @@
+#include
#include
#include "get_options.h"
apt update
apt install dpkg-dev devscripts xserver-xorg lightdm openbox xterm
systemd-coredump gdb mc mesa-utils globs globs-dbgsym libsdl-image1.2-dbgsym
apt build-dep globs
systemctl start lightdm
mkdir globs/orig -p
cdglobs/orig
apt