Bug 96289

Summary: all OpenGL application with feenableexcept(FE_DIVBYZERO|FE_OVERFLOW|FE_INVALID) raise SIGFPE
Product: Mesa Reporter: Jan Bertran <joanbe>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED DUPLICATE QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: pinguin255
Version: 11.2   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: gdb backtrace

Description Jan Bertran 2016-05-31 11:06:22 UTC
Created attachment 124210 [details]
gdb backtrace

After Ubuntu upgraded to Mesa 11.2 all OpenGL applications with floating point exceptions enabled (FE_INVALID) raise a SIGFPE signal at the first drawing command.
Oibaf Mesa 11.3-git ppa as of (31-may-2016) also shows this behavior.

To test it's necessary to patch glxgears.
---
--- glxgears.c	2016-05-31 12:18:57.175490491 +0200
+++ glxgears_fpe.c	2016-05-31 12:28:30.854798058 +0200
@@ -37,6 +37,9 @@
 #include <GL/glx.h>
 #include <GL/glxext.h>
 
+#define __USE_GNU
+#include <fenv.h>
+
 #ifndef GLX_MESA_swap_control
 #define GLX_MESA_swap_control 1
 typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
@@ -731,6 +734,8 @@
    VisualID visId;
    int i;
 
+   feenableexcept(FE_DIVBYZERO | FE_OVERFLOW | FE_INVALID);
+
    for (i = 1; i < argc; i++) {
       if (strcmp(argv[i], "-display") == 0) {
          dpyName = argv[i+1];
---

My guess
line 301/302 has a 0 by 0 division
unsigned hs_additional = (unsigned)
round(hs_wants * (((double) remaining_space) / total_wants));

Probably it's really uncommon to enable exceptions as neither glxgears, tux racer, xonotic or web browsers or plasma desktop have this problem.

But until now (Mesa 11.1), neither mesa-radeon or mesa-intel or nvidia-proprietary-blob had this issue.
Comment 1 Matt Turner 2016-05-31 17:00:46 UTC
Thanks. This is a known issue that I need to get back to.

*** This bug has been marked as a duplicate of bug 95419 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.