[Mesa-dev] [Bug 83570] Glyphy demo throws unhandled Integer division by zero exception

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Sep 8 13:07:09 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=83570

--- Comment #11 from Roland Scheidegger <sroland at vmware.com> ---
(In reply to comment #10)
> Could be totally borked, but this is what I have at the moment:
> 
>    if (type.floating) {
>       return LLVMBuildFDiv(builder, a, b, "");
>    }
>    else {
>       //The spec says divide by zero is undefined, but shouldn't throw an
> exception
>       LLVMValueRef zeromask = lp_build_cmp(bld,
>                                            PIPE_FUNC_EQUAL,
>                                            b,
>                                            lp_build_zero(bld->gallivm,type));
>       if (type.sign) {
>          return lp_build_select(bld,
>                                 zeromask,
>                                 bld->undef,
>                                 LLVMBuildSDiv(builder, a, b, ""));
>       }
>       else {
>          return lp_build_select(bld,
>                                 zeromask,
>                                 bld->undef,
>                                 LLVMBuildUDiv(builder, a, b, ""));
>       }
>    }
> 
> I'll take a look at udiv_emit_cpu

Hmm that can't quite work since you still do the division by zero, you just
don't use the result in the end.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140908/722c1f08/attachment.html>


More information about the mesa-dev mailing list