This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: divdi3: incomplete fix in db3d848e154b?
- From: Zack Weinberg <zackw at panix dot com>
- To: Alexey Neyman <stilor at att dot net>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Date: Sun, 14 May 2017 09:22:12 -0400
- Subject: Re: divdi3: incomplete fix in db3d848e154b?
- Authentication-results: sourceware.org; auth=none
- References: <e99d6df7-8cb2-282d-ffeb-fcc383db94be@att.net>
On Sun, May 14, 2017 at 2:22 AM, Alexey Neyman <stilor@att.net> wrote:
>
> divdi3.c:
> 90 if (d0 == 0)
> 91 d0 = 1 / d0; /* Divide intentionally by zero. */
>
> Isn't the purpose of this intentional division to generate a SIGFPE, rather
> than SIGILL?
>
> Shouldn't divdi3.c do something else here, e.g. raise(SIGFPE) or be compiled
> with -fno-sanitize=integer-divide-by-zero?
Yes, I think you're right.
We should try to get an actual hardware division by zero if we can;
raise(SIGFPE) will not fill in the siginfo structure exactly the same
way. It might be the best we can do sometimes, though.
zw