[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: locale-dependent assertion failure in gawk 3.1.5
From: |
Aharon Robbins |
Subject: |
Re: locale-dependent assertion failure in gawk 3.1.5 |
Date: |
Tue, 18 Jul 2006 22:22:41 +0300 |
I have not yet read all this thread. The intent is that n->wstptr is NOT valid
if the WSTRCUR bit is clear. Or to flip it around, only if the bit is set should
you mess with n->wstptr.
I have cleaned up the WSTRCUR code in my code base, but have not posted diffs.
IF I can steal the time over the next few weeks to clear my backlog of
unapplied patches I will start an alpha cycle. Unfortunately, that's
a rather big "if".
Arnold
> Date: Mon, 10 Jul 2006 08:58:21 -0400
> From: "Andrew J. Schorr" <address@hidden>
> Subject: Re: locale-dependent assertion failure in gawk 3.1.5
> To: address@hidden
> Cc: =?iso-8859-1?Q?J=FCrgen?= Kahrs <address@hidden>
>
> On Fri, Jul 07, 2006 at 06:05:00PM -0400, Andrew J. Schorr wrote:
> > Given that NODE is a union, I'm not clear on whether it's OK to
> > test the wstptr value if the WSTRCUR flag is not set. I guess
> > one has to assume that wstptr may contain random garbage if WSTRCUR
> > is not set; is that the correct approach? Or would it be safe to
> > assume that if STRCUR is set, then
> > (wstptr != NULL) <==> ((flags & WSTRCUR) != 0)?
>
> In particular, I'm not certain that I understand the model implied
> by this code at the top of node.c:str2wstr():
>
> NODE *
> str2wstr(NODE *n, size_t **ptr)
> {
> ...
> if ((n->flags & WSTRCUR) != 0) {
> if (ptr == NULL)
> return n;
> }
>
> if (n->wstptr != NULL) {
> free(n->wstptr);
> n->wstptr = NULL;
> n->wstlen = 0;
> }
>
> Suppose that ((n->flags & WSTRCUR) == 0) (the flag bit is not set). In that
> case, is it valid to access n->wstptr? I had imagined from reviewing other
> parts of the code that we should consider n->wstptr undefined if the WSTRCUR
> flag is not set...
>
> In other words, would it be more correct to write:
>
> if ((n->flags & WSTRCUR) != 0) {
> if (ptr == NULL)
> return n;
>
> assert(n->wstptr != NULL);
> free(n->wstptr);
> /* no need to reset wstptr and wstlen since they will
> be set below */
> }
>
> Or are there some well-defined circumstances under which it is OK to presume
> that the wstptr field is valid even if the WSTRCUR flag is not set? And
> if so, is that concisely expressible in code (or a comment)?
>
> Regards,
> Andy
- Re: locale-dependent assertion failure in gawk 3.1.5, (continued)
- Message not available
- Re: locale-dependent assertion failure in gawk 3.1.5, Jürgen Kahrs, 2006/07/07
- Re: locale-dependent assertion failure in gawk 3.1.5, Andrew J. Schorr, 2006/07/07
- Re: locale-dependent assertion failure in gawk 3.1.5, Andrew J. Schorr, 2006/07/07
- Re: locale-dependent assertion failure in gawk 3.1.5, Andrew J. Schorr, 2006/07/10
- Re: locale-dependent assertion failure in gawk 3.1.5, Andrew J. Schorr, 2006/07/10
- Re: locale-dependent assertion failure in gawk 3.1.5, Andrew J. Schorr, 2006/07/11
- Re: locale-dependent assertion failure in gawk 3.1.5, Andrew J. Schorr, 2006/07/12
- Message not available
- Re: locale-dependent assertion failure in gawk 3.1.5, Jürgen Kahrs, 2006/07/10
Re: locale-dependent assertion failure in gawk 3.1.5,
Aharon Robbins <=
Re: locale-dependent assertion failure in gawk 3.1.5, Aharon Robbins, 2006/07/18
Re: locale-dependent assertion failure in gawk 3.1.5, Aharon Robbins, 2006/07/18