This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Another GLIBC build error with GCC6
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: Andreas Schwab <schwab at suse dot de>, Roland McGrath <roland at hack dot frob dot com>, Jeff Law <law at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 22 Jul 2015 14:08:19 -0700
- Subject: Re: Another GLIBC build error with GCC6
- Authentication-results: sourceware.org; auth=none
- References: <1437496279 dot 19674 dot 126 dot camel at ubuntu-sellcey> <1437507995 dot 19674 dot 136 dot camel at ubuntu-sellcey> <55AEA71B dot 2020405 at redhat dot com> <1437509796 dot 19674 dot 138 dot camel at ubuntu-sellcey> <55AEB7FF dot 1000405 at redhat dot com> <1437518197 dot 19674 dot 152 dot camel at ubuntu-sellcey> <20150721224637 dot 1E0102C3B32 at topped-with-meat dot com> <55AF30A1 dot 2030402 at cs dot ucla dot edu> <1437578812 dot 19674 dot 161 dot camel at ubuntu-sellcey> <mvmzj2o9nse dot fsf at hawking dot suse dot de> <1437581957 dot 19674 dot 167 dot camel at ubuntu-sellcey> <87pp3kf942 dot fsf at igel dot home> <1437582979 dot 19674 dot 168 dot camel at ubuntu-sellcey> <55AFCCD9 dot 3040805 at cs dot ucla dot edu> <1437585792 dot 19674 dot 172 dot camel at ubuntu-sellcey> <55AFFF99 dot 8080307 at cs dot ucla dot edu>
- Reply-to: <sellcey at imgtec dot com>
On Wed, 2015-07-22 at 13:39 -0700, Paul Eggert wrote:
> Steve Ellcey wrote:
> > the macro isn't going to result in the
> > same results for all inputs.
>
> Why not? For which input would the patch change behavior? I don't see how it
> could happen. The same pattern already works for DT_VERSIONTAGIDX and for
> DT_VALTAGIDX, which suggests it shouldn't be a problem for DT_EXTRATAGIDX.
It looks like it works for any value where the most significant bit is
set to 1. Otherwise it gives a different value. I don't know if we can
count on that bit always being set or not.
Steve Ellcey
#include <stdint.h>
#include <stdio.h>
typedef uint32_t Elf32_Word;
typedef int32_t Elf32_Sword;
#define DT_AUXILIARY 0x7ffffffd
#define DT_FILTER 0x7fffffff
#define DT_EXTRATAGIDX_OLD(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
#define DT_EXTRATAGIDX_NEW(tag) ((Elf32_Sword) (DT_FILTER - (tag)))
inputs[] = {DT_AUXILIARY, DT_FILTER, 0x70000000, 0x70001000, 0x7fffff00,
0, 1, 99, 100000, -1, -99, -100000};
int main()
{
int i;
for (i = 0; i < sizeof(inputs)/sizeof(int); i++)
printf("%d %d %d\n", inputs[i], DT_EXTRATAGIDX_OLD(inputs[i]), DT_EXTRATAGIDX
_NEW(inputs[i]));
}
% gcc x.c -o x
% ./x
2147483645 2 2
2147483647 0 0
1879048192 268435455 268435455
1879052288 268431359 268431359
2147483392 255 255
0 -1 2147483647
1 -2 2147483646
99 -100 2147483548
100000 -100001 2147383647
-1 0 -2147483648
-99 98 -2147483550
-100000 99999 -2147383649