SIGFPE and SDL OpenGL windows

Minimal “hello world” code that creates a GL window:

int main(void)
SDL_Surface *win;
const SDL_VideoInfo *VideoInfo;

if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
	fprintf(stderr, "SDL_Init died: %s", SDL_GetError());

VideoInfo = SDL_GetVideoInfo();

if (VideoInfo == NULL) {
	fprintf(stderr, "SDL_VideoInfo died: %s", SDL_GetError());

win = SDL_SetVideoMode(640, 480, 8, SDL_OPENGL);

if( win == NULL ) {
	fprintf(stderr, "SDL_VideoInfo died: %s", SDL_GetError());

return 0;


Seems to run fine, but generates a SIGFPE under GDB whenever SDL_OPENGL is
passed to SDL_SetVideoMode():

$ gdb a.out
(gdb) run

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread -1212957952 (LWP 23071)]
0xb7ae17a0 in __driUtilCreateScreen ()
from /usr/X11R6/lib/modules/dri/
(gdb) bt

(snipped DRI stuff)

#10 0xb7faf195 in _glthread_SetTSD () from /usr/X11R6/lib/
#11 0xb7faf2ec in glXCreateContext () from /usr/X11R6/lib/
#12 0xb7e776bf in X11_GL_CreateContext () from /usr/lib/
#13 0xb7e7b9da in X11_CheckMouseMode () from /usr/lib/
#14 0xb7e7c0f1 in X11_CheckMouseMode () from /usr/lib/
#15 0xb7e7099a in SDL_SetVideoMode () from /usr/lib/
#16 0x080486ca in main () at main.c:24

This only happens when SDL_OPENGL is passed to SDL_SetVideoMode(). Is this
normal behavior? If so, “why”? Am I supposed to tell GDB to ignore signal
8 everytime I want to debug an SDL application that uses OpenGL?

Every theory is killed sooner or later, but if the theory has good in it,
that good is embodied and continued in the next theory. – Albert Einstein

GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D