This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: divdi3: incomplete fix in db3d848e154b?


On Sun, May 14, 2017 at 10:18 AM, Jeff Law <law@redhat.com> wrote:
> On 05/14/2017 07:22 AM, Zack Weinberg wrote:
>> 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?
>>
>>
>> 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.
>
> Note that GCC will detect this as a division by zero and try to turn it into
> a trap on architectures that have trap instructions.

Right, that's the problem. Callers reasonably expect to get SIGFPE
rather than SIGILL, and also apparently it turns into a call to
abort() which may not always be available.  I don't fully understand
Alexey's situation, though.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]