Bug 96289 - all OpenGL application with feenableexcept(FE_DIVBYZERO|FE_OVERFLOW|FE_INVALID) raise SIGFPE
Summary: all OpenGL application with feenableexcept(FE_DIVBYZERO|FE_OVERFLOW|FE_INVALI...
Status: RESOLVED DUPLICATE of bug 95419
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: 11.2
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
Depends on:
Reported: 2016-05-31 11:06 UTC by Jan Bertran
Modified: 2016-05-31 17:03 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

gdb backtrace (2.25 KB, text/plain)
2016-05-31 11:06 UTC, Jan Bertran

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
@@ -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.