This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
divdi3: incomplete fix in db3d848e154b?
- From: Alexey Neyman <stilor at att dot net>
- To: libc-alpha at sourceware dot org, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Date: Sat, 13 May 2017 23:22:47 -0700
- Subject: divdi3: incomplete fix in db3d848e154b?
- Authentication-results: sourceware.org; auth=none
Hi,
I was compiling glibc (2.25 + d40dbe722f004) for sh4-unknown-linux-gnu
and the build failed due to rtld pulling abort.os again. This has been
"fixed" in master in db3d848e154b - which made divdi3 built only for
certain architectures. However, I think this just masks the real issue
that GCC7 inserts a trap where it knows something gets divided by zero.
Here is a fragment of generated code for i686-unknown-linux:
objdump -dlr csu/divdi3.os:
/home/avn/work/ctng/crosstool-ng/.build/src/glibc-2.25/csu/../sysdeps/wordsize-32/divdi3.c:91
d0: 85 db test %ebx,%ebx
d2: 75 0c jne e0 <__udivmoddi4+0xe0>
d4: 0f 0b ud2
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?
Regards,
Alexey.