[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#916779: libc6-armhf-cross: strerror(-3) sets errno to ENOMEM



control: clone 916779 -1
control: reassign -1 gcc-8
control: retitle -1 gcc-8: --fno-math-errno causes GCC to consider that malloc does not set errno
control: submitted -1 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88576

On 2018-12-22 13:37, Aurelien Jarno wrote:
> This is not what happens, errno is not set to ENOMEM in strerror_() but
> in strerror(). The problem is that the malloc implementation when run
> under QEMU sets errno to ENOMEM, despite successfully allocating the
> memory. errno is supposed to be saved around the malloc call:
> 
>   saved_errno = errno;
>   if (buf == NULL) 
>     buf = malloc (1024);
>   __set_errno (saved_errno); 
> 
> That said, when compiled with -fno-math-errno, GCC optimizes out
> saving and restoring errno around the malloc call. I am not sure if this
> is a GCC bug or a bug in the GCC documentation.

This has been confirmed to be a GCC bug, here is the upstream bug
report:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88576

As this bug is likely going to be workarounded in glibc, I am cloning
this bug and reassigning the clone to the gcc-8 package. I'll close the
glibc one when adding the workaround or a bumped build-dependency on
gcc-8.

Regards,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

Attachment: signature.asc
Description: PGP signature


Reply to: