FLEX, was Re: Return value of malloc(0)

Randall Hyde randyhyde at earthlink.net
Thu Jun 29 05:40:32 UTC 2006


> >
>
> Without seeing the code or the actual error message, I'm
> guessing the answer is 42.  Perhaps, some detail might
> be appropriate.

I seriously doubt seeing the code  will do much good.
Here's the offending line:

  YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
   yy_n_chars, num_to_read );


This is from
static int yy_get_next_buffer()

Which is part of the canned code that comes with FLEX.
Compiles just fine under Linux. Linux has a slightly newer version of GCC,
but I've been compiling this code on Windows (Borland and VC++) as well as
Linux for years without a problem (i.e., older versions of GCC).

BTW, if anyone is intrested in the full FLEX source, it's part of the HLA
(High Level Assembler) source package found here:


http://webster.cs.ucr.edu/AsmTools/HLA/HLAv1.84/hlasrc.zip

I compiled the FLEX code with the command line:

flex -8 -i hla.flx

This works fine, then I compile the GCC output with

gcc -DfreeBSD -c -o lex.yy.o lex.yy.c

and it stops with "syntax error before numeric constant".

As this code is in part of the FLEX-supplied C code, I would think that this
problem would be independent of my particular flex code. BTW, I've tried
using both the FLEX I use on Linux under BSD as well as the BSD-supplied
version. I've even taken the FLEX output from freeBSD and compiled it under
Linux (it compiles successfully.

I'm using GCC 3.3.5 under Linux, 3.4.4 under BSD. Any known problems with
3.4.4 that would cause this?

cheers,
Randy Hyde



More information about the freebsd-hackers mailing list