[PATCH] string: Fix string/tst-memmove-overflow to compile with GCC 7

Carlos O'Donell carlos@redhat.com
Thu May 14 16:06:38 GMT 2020


On 5/14/20 6:39 AM, Florian Weimer via Libc-alpha wrote:
> GCC 8 relaxed what kind of expressions can be used in initializers,
> and the previous use of static const variables relied on that.  Switch
> to wide (non-int) enum constants instead, which is another GCC
> extension that is more widely implemented.
> 

This is not a user visible bug.

OK for master.

Clean on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  string/tst-memmove-overflow.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/string/tst-memmove-overflow.c b/string/tst-memmove-overflow.c
> index 77d693d0dd..ffbcd04308 100644
> --- a/string/tst-memmove-overflow.c
> +++ b/string/tst-memmove-overflow.c
> @@ -42,11 +42,11 @@ IMPL (memmove, 1)
>  
>  /* Size of the part of the allocation which is not shared, at the
>     start and the end of the overall allocation.  4 MiB.  */
> -static const size_t unshared_size = 4U << 20;
> +enum { unshared_size = (size_t) 4U << 20 };

OK.

>  
>  /* The allocation is 2 GiB plus 8 MiB.  This should work with all page
>     sizes that occur in practice.  */
> -static const size_t allocation_size = (2U << 30) + 2 * unshared_size;
> +enum { allocation_size = ((size_t) 2U << 30) + 2 * unshared_size };

OK.

>  
>  /* Compute the expected byte at the given index.  This is used to
>     produce a non-repeating pattern.  */
> 


-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list