| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:cc:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=bWJ6TqhZxDfpxkFTz7OaZ1sxU+/ltl7aDUPgMrYLByI4rChyxjZub | |
| gJdK/M5/3yZ+YO+oCcf38YhIla/xPU/OM8Ek+ukmF9dIbfdtyt1a+w7enu5d+qOB | |
| ffkHxIJN6WD4lELCrcpkBL+0hwt4sZ/SW71oxDkwwQCyMduNX3rFO8= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:cc:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=MpQnquveWGN5jm2BEXy/H2apYlg=; b=OhUWVlq1qkMQ1tWGyXXFmcxbei1u | |
| 1QrKwASpNpIpuHCL7n0MQREZO/jBEoCmUP2iarWNP1UzZ+DzlV5VGdAOYaaVUGt5 | |
| BWL3qp8yUvwe6paKj+eilRo09ZzYQi8J4lsDmt+z1279kjdm9H4TVZMFyncByC0/ | |
| 7ueuQNnY+6E6j60= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Spam-SWARE-Status: | No, score=-101.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=Attached, fog, screwed, violation |
| X-HELO: | mout.kundenserver.de |
| Date: | Mon, 3 Jun 2019 13:10:57 +0200 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | Agner Fog <agner AT agner DOT org> |
| Cc: | cygwin AT cygwin DOT com |
| Subject: | Re: Bug report. Clang sqrtl(-1) causes access violation |
| Message-ID: | <20190603111057.GE3437@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | Agner Fog <agner AT agner DOT org>, cygwin AT cygwin DOT com |
| References: | <c80240c2-a30e-41b5-7635-cf31f54741d1 AT agner DOT org> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <c80240c2-a30e-41b5-7635-cf31f54741d1@agner.org> |
| User-Agent: | Mutt/1.11.3 (2019-02-01) |
--4zI0WCX1RcnW9Hbu
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On May 10 14:57, Agner Fog wrote:
> Bug description:
>=20
> The sqrtl function under Clang causes an access violation when the argume=
nt
> is negative.
>=20
> This error occurs only under Cygwin.
>=20
> This error occurs only with the sqrtl function, not with sqrt or sqrtf
>=20
> Attached:
>=20
> sqrt.cpp: program to reproduce the error. Compile clang sqrt.cpp and run
> ./a.exe
Thanks for the testcase.
This looks like a bug in clang-5.0. It does not occur when building the
testcase with gcc, nor does it occur when building with clang-4.0.
Looking with GDB, it seems the conversion from float to long double is
screwed up. The sequence converting float to long double prior to
calling sqrtl is very different:
With gcc:
Thread 1 "sqrtl" hit Temporary breakpoint 1, main () at sqrtl.c:6
6 float b =3D sqrtl(a);
(gdb) s
sqrtl (x=3D-1)
at /home/corinna/src/cygwin/vanilla/winsup/cygwin/math/sqrt.def.h:69
69 __FLT_TYPE res =3D __FLT_CST (0.0);
(gdb) n
70 int x_class =3D fpclassify (x);
(gdb) p x
$1 =3D -1
(gdb) x/4x &x
0xffffcaf0: 0x00000000 0x80000000 0x0004bfff 0x00000006
=3D> 0x100401093 <main+19>: lea -0x20(%rbp),%rax
=3D> 0x100401097 <main+23>: fstpt -0x30(%rbp)
=3D> 0x10040109a <main+26>: lea -0x30(%rbp),%rdx
=3D> 0x10040109e <main+30>: mov %rax,%rcx
=3D> 0x1004010a1 <main+33>: callq 0x100401110 <sqrtl>
With clang:
Thread 1 "sqrtl" hit Temporary breakpoint 1, main () at sqrtl.c:6
6 float b =3D sqrtl(a);
(gdb) s
sqrtl (x=3D<invalid float value>)
at /home/corinna/src/cygwin/vanilla/winsup/cygwin/math/sqrt.def.h:69
69 __FLT_TYPE res =3D __FLT_CST (0.0);
(gdb) n
70 int x_class =3D fpclassify (x);
(gdb) p x
$1 =3D <invalid float value>
(gdb) x/4x &x
0xffffcb10: 0x00000000 0x00000000 0x00040524 0x00000006
=3D> 0x100401096 <main+22>: movabs $0x100402010,%rax
=3D> 0x1004010a0 <main+32>: flds (%rax)
=3D> 0x1004010a2 <main+34>: mov %rsp,%rax
=3D> 0x1004010a5 <main+37>: fstpt 0x20(%rax)
=3D> 0x1004010a8 <main+40>: callq 0x100401120 <sqrtl>
Corinna
--=20
Corinna Vinschen
Cygwin Maintainer
--4zI0WCX1RcnW9Hbu
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlz1AEEACgkQ9TYGna5E
T6BBfA//QtSDqyoDJp3CL4bgr+poJYVOyNphVOTjLAJ4rPG4ZU4oxHSUisdnVMqM
xPsUjsQhIHxVw1UKkMr3Q6/1iBPSN642GwXnacRrU/lFCj+0/+ST2eDQP9Itdaa1
d66tVDmhGLq9A6cm3oLdsBM3C5DpGZSMuQsQVE8OZSGgzNwZZGDhYHAm9Ww9Lbul
BWCgwpmyuwU7Ly8IkHR0M2HyL+C3WV13QSVCP/r7FLilHLL8veIjcJTnXf5/8acr
KeeluqyM+m/7JgbX1vIrkI6uifGvYkgaGlKUVZWSr1k1u6HWqgkFTwJ4B9rBAypl
wQPDfkpM/QwIhwuaBLimVVXRzS5gdLq1GcJBe5qgpv14BU6bF/OzKY7spEAqbzFx
ZHvlcsiu+1Yg3vCVRuIUg3H+DlG2wFUlIcMKpaF9d0slWzx/E4PGwGkS6ivxAE6Z
mBiWzeBgxgvLrqYnZ2SItGNsfvNGO0ST0LOf8o29O+x0/vmyqatByX+eUDBIRGsY
o9hHxOf9YkDI62yqqlPz+7H990nd99aWQuTY+E3P6nCyIOll9iTaQ0HwV1YobKUm
q67WFVBwL9/dTj2p53UKtOoS7bGuFB3OhDTdFBy5dgPRSUq0uIsu7onfVGyLJwtd
33Q3t34BZ6CvYfPN51OR7dmwwCePkOCTobU65DlLJk8stvRxS5Y=
=js4F
-----END PGP SIGNATURE-----
--4zI0WCX1RcnW9Hbu--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |