cpp /usr/include/threads.h fails; modfl segfaults

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Tue Sep 1 17:28:51 GMT 2020


On 2020-08-31 13:41, Corinna Vinschen wrote:
> On Aug 31 13:24, Brian Inglis wrote:
>> On 2020-08-31 12:45, Corinna Vinschen wrote:
>>> On Aug 31 09:37, Brian Inglis wrote:
>>>> On 2020-08-31 01:35, Corinna Vinschen wrote:
>>>>> On Aug 30 14:39, Brian Inglis wrote:
>>>>>> On 2020-08-30 07:00, Corinna Vinschen wrote:
>>>>>>> On Aug 29 08:52, airplanemath via Cygwin wrote:
>>>>>>>> I have two reports.  A brief description of the system:
>>>>>>>> $ uname -a | sed "s/${HOSTNAME}/\${HOSTNAME}/g"
>>>>>>>> CYGWIN_NT-10.0 ${HOSTNAME} 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin
>>>>>> ...
>>>>>>>> $ cat test.c
>>>>>>>> #include <math.h>
>>>>>>>> #include <stdio.h>
>>>>>>>> #include <stdlib.h>
>>>>>>>>
>>>>>>>> int main(int argc, char *argv[]) {
>>>>>>>>   long double a, b, c;
>>>>>>>>   char *num_end = NULL;
>>>>>>>>   a = b = c = 0.0L;
>>>>>>>>   if (argc != 2) {
>>>>>>>>     fprintf(stderr, "Usage: %s NUMBER\n", argv[0]);
>>>>>>>>     exit(1);
>>>>>>>>   }
>>>>>>>>   a = strtold(argv[1], &num_end);
>>>>>>>>   b = modfl(a, &c);
>>>>>>>>   printf("%Lf %Lf %Lf\n", a, b, c);
>>>>>>>>   return 0;
>>>>>>>> }
>>>>>>>
>>>>>>> This is a bug in the assembler code taken from Mingw-w64.  The bug has
>>>>>>> been fixed upstream, so I just pulled in the upstream fixes.
>>>>>>
>>>>>> The 64 bit fix doesn't pop eax but *now* flags eax as clobbered, whereas the 32
>>>>>> bit fix both pops and *now* flags eax as clobbered, which it really doesn't need
>>>>>> to do. Is this inconsistent treatment correct?
>>>>>
>>>>> You may be right that this is not necessary on i686, but it doesn't
>>>>> hurt either and I'd like to stick to the upstream code if possible.
>>>>
>>>> The upstream patch changed only amd64/x86_64 code sequences for multiple modules
>>>> including modfl, and left i386/x86 untouched for those modules.
>>
>> Just pointing out that they only modify their amd64/x86_64 code which doesn't
>> push/pop rax/eax:
> 
> Where are you looking at?  As you could see from my output, I was
> looking at the master branch of the upstream repo.

Sorry I didn't see your point there as I wasn't aware there were SF repos.

> This lengthy discussion for a minor asm snippet doesn't make any sense.
> If you think this is wrong, send patches to cygwin-patches and explain
> where you got it from, preferrably as a git patch from the upstream
> repo.

Sorry for wasting your time.
I was looking at the bug/patch content and didn't realize someone later added a
bogus clobber on their x86 code path.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in IEC units and prefixes, physical quantities in SI.]


More information about the Cygwin mailing list