Re: undefined behavior in hol_append()

2011-11-29 Thread Bruno Haible
Paul Eggert wrote: > > Do you know of any platforms where sizeof (ptrdiff_t) < sizeof (void *) ? > > The standard operating mode for ILE C/C++ (for IBM i) > has 16-byte pointers; I expect that sizeof (ptrdiff_t) > is 8 and sizeof (void *) is 16 on such platforms, though > I don't have a short cita

Re: undefined behavior in hol_append()

2011-11-28 Thread Paul Eggert
On 11/28/11 15:39, Bruno Haible wrote: > Do you know of any platforms where sizeof (ptrdiff_t) < sizeof (void *) ? The standard operating mode for ILE C/C++ (for IBM i) has 16-byte pointers; I expect that sizeof (ptrdiff_t) is 8 and sizeof (void *) is 16 on such platforms, though I don't have a sh

Re: undefined behavior in hol_append()

2011-11-28 Thread Eric Blake
On 11/28/2011 04:39 PM, Bruno Haible wrote: > Hi Matthew, > >> e->short_options += (short_options - hol->short_options); >> >> subtracts two pointers that do not point to the same memory object. >> Something like: >> >> e->short_options = short_options + (e->short_options - hol->short_options); >>

Re: undefined behavior in hol_append()

2011-11-28 Thread Bruno Haible
Hi Matthew, > e->short_options += (short_options - hol->short_options); > > subtracts two pointers that do not point to the same memory object. > Something like: > > e->short_options = short_options + (e->short_options - hol->short_options); > > does the intended operation with legal pointer ar

Re: undefined behavior in hol_append()

2011-11-28 Thread Matthew Wala
Hi: On Mon, Nov 28, 2011 at 2:52 PM, Matthew Wala wrote: > Hello: > > The function hol_append() in lib/argp-parse.c exhibits undefined behavior. > Specifically, the expression in line 894: > Sorry, I meant lib/argp-help.c Matt

undefined behavior in hol_append()

2011-11-28 Thread Matthew Wala
Hello: The function hol_append() in lib/argp-parse.c exhibits undefined behavior. Specifically, the expression in line 894: e->short_options += (short_options - hol->short_options); subtracts two pointers that do not point to the same memory object. Something like: e->short_options = short_opti