[comp.lang.c] Flex compilation with TC

wsinpp@tuewsd.UUCP (Peter Peters) (06/01/89)

Hello netlanders !

I tried to compile Flex (the lex replacement) on an IBM-PC
using Turbo-C 1.0. The compilation works just fine (a few
warnings) but the resultant executable seems to be corrupt.
Execution of flex produces an empty lex-yy.tab (lex.yy.tab)
file and simply stops the machine. Using ^C gives the message
that something is wrong with memory allocation and that
command.com cannot be loaded, so the machine is dead.
Anyone out there who can enlighten me ?
If this is not the correct newsgroup for this kind of message
I'm sorry..

+---------------------------------------------------------------------------+
| Peter Peters                              | UUCP : wsinpp@tuewsd          |
| Eindhoven University of Technology (TUE)  | SURF : heithe5::wsdcpp        |
| Dept. of Mathematics and Computer Science |                               |
|---------------------------------------------------------------------------|
| It's all very simple, or else it's all  very complex,                     |
| or perhaps it's neither, or both...                                       |
|                                                                           |
| Disclaimer : Who needs my opinion ? :-)                                   |
+---------------------------------------------------------------------------+

gm@romeo.cs.duke.edu (Greg McGary) (06/02/89)

In article <394@tuewsd.UUCP> wsinpp@tuewsd.UUCP (Peter Peters) writes:
>I tried to compile Flex (the lex replacement) on an IBM-PC
>using Turbo-C 1.0. The compilation works just fine (a few
>warnings) but the resultant executable seems to be corrupt.
>Execution of flex produces an empty lex-yy.tab (lex.yy.tab)
>file and simply stops the machine. Using ^C gives the message
>that something is wrong with memory allocation and that
>command.com cannot be loaded, so the machine is dead.
>Anyone out there who can enlighten me ?
>If this is not the correct newsgroup for this kind of message
>I'm sorry..

If you compile flex with `-N' enabling stack-overflow detection, you
will discover that the stack is overflowing.  No matter how big you
make _stklen, this will persist.  The problem is that the time(3) library
function called from gettime() itself calls an internal function called
gettime(), so you get stuck in an infinite double-recursion.  The workaround
is to rename flex's gettime() to get_time() or some such.

Also, be sure to compile with the large-model...

-- Greg McGary
-- 10310 Main Street #354, Fairfax, Virginia 22030    voice: (703) 266-7249
-- {decvax,hplabs,seismo,mcnc}!duke!gm                 data: (703) 266-7258
--                                  gm@cs.duke.edu

Greg.Trotter@p3.f30.n147.z1.FIDONET.ORG (Greg Trotter) (06/07/89)

 In Message <394@tuewsd.UUCP>, wsinpp@tuewsd.UUCP (Peter Peters) writes:

 > I tried to compile Flex (the lex replacement) on an IBM-PC
 > using Turbo-C 1.0. The compilation works just fine (a few
 > warnings) but the resultant executable seems to be corrupt.
 > Execution of flex produces an empty lex-yy.tab (lex.yy.tab)
 > file and simply stops the machine. Using ^C gives the message
 > that something is wrong with memory allocation and that
 > command.com cannot be loaded, so the machine is dead.
 > Anyone out there who can enlighten me ?

I had memory allocation problems using TC 1.0. When I upgraded to 2.0, I never had the problem again. I'd call Borland for an upgrade (it's sonething like $100 with Turbo Assembler and Turbo Debugger).

                                       - greg




--  
Greg Trotter - via FidoNet node 1:147/10
UUCP: ...!uokmax!metnet!30.3!Greg.Trotter
INTERNET: Greg.Trotter@p3.f30.n147.z1.FIDONET.ORG