binutils 2.20 release (soon)
Tristan Gingold
gingold@adacore.com
Wed Oct 14 08:20:00 GMT 2009
On Oct 13, 2009, at 10:59 PM, Andreas Schwab wrote:
> Tristan Gingold <gingold@adacore.com> writes:
>
>> If you have a reason to delay this release, please speak up now!
>
> The included ld/ldlex.c is broken. It passes a yy_size_t* as the
> second
> argument of yy_input, which expects an int*, with the obvious
> disastrous
> results. Your version of flex appears to have changed this.
I use flex 2.5.35.
Your patch looks correct and more bullet-proof.
Nick/Alan, it is ok for the trunk ?
Tristan.
>
> Tested on powerpc64-suse-linux.
>
> Andreas.
>
> 2009-10-13 Andreas Schwab <schwab@linux-m68k.org>
>
> * ldlex.l (yy_input): Remove second argument and return the value
> instead.
> (YY_INPUT): Adjust.
>
> --- ld/ldlex.l.~1.43.~ 2009-09-04 19:54:32.000000000 +0200
> +++ ld/ldlex.l 2009-10-13 22:47:14.000000000 +0200
> @@ -57,7 +57,7 @@ const char *lex_string = NULL;
> Otherwise, stack elements 0 through `include_stack_ptr - 1' are
> valid. */
>
> #undef YY_INPUT
> -#define YY_INPUT(buf,result,max_size) yy_input (buf, &result,
> max_size)
> +#define YY_INPUT(buf,result,max_size) result = yy_input (buf,
> max_size)
>
> #define YY_NO_UNPUT
>
> @@ -68,7 +68,7 @@ static unsigned int lineno_stack[MAX_INC
> static unsigned int include_stack_ptr = 0;
> static int vers_node_nesting = 0;
>
> -static void yy_input (char *, int *, int);
> +static int yy_input (char *, int);
> static void comment (void);
> static void lex_warn_invalid (char *where, char *what);
>
> @@ -608,22 +608,23 @@ ldlex_popstate (void)
> }
>
>
> -/* Place up to MAX_SIZE characters in BUF and return in *RESULT
> +/* Place up to MAX_SIZE characters in BUF and return
> either the number of characters read, or 0 to indicate EOF. */
>
> -static void
> -yy_input (char *buf, int *result, int max_size)
> +static int
> +yy_input (char *buf, int max_size)
> {
> - *result = 0;
> + int result = 0;
> if (YY_CURRENT_BUFFER->yy_input_file)
> {
> if (yyin)
> {
> - *result = fread (buf, 1, max_size, yyin);
> - if (*result < max_size && ferror (yyin))
> + result = fread (buf, 1, max_size, yyin);
> + if (result < max_size && ferror (yyin))
> einfo ("%F%P: read in flex scanner failed\n");
> }
> }
> + return result;
> }
>
> /* Eat the rest of a C-style comment. */
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276
> 4ED5
> "And now for something completely different."
>
More information about the Binutils
mailing list