[comp.lang.pascal] many nested WHILEs in TPas

CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) (09/15/90)

In article <Sep.12.22.00.00.1990.5525@remus.rutgers.edu>,
  Chris Long <clong@remus.rutgers.edu> writes

>I've encountered another bug in Turbo Pascal 5.5.  The program in
>question was well withn TP's weenie memory requirements, and to be sure
>I broke it up into three units (the main unit was under 10k!). The
>problem:  when compiled, TP gives me a strange error (like "line or and
>pos funct" file not found) and then proceeds to remove my program from
>memory.  Apparently TP5.5 doesn't like the fact that I'm doing 40 or so
>nested while-do loops; perhaps it has some type of stack which keeps
>track of this nesting and which gets so large that it offs a chunk of
>memory (which the main unit is in!).

The error is a compile-time error (which wasn't completely clear to me
from the initial report). The exact error appears to depend on overall
system state, suggesting that something in the compiler's memory is
being overwritten. Compiling Chris' code as a single file (no units), I
get a different error--and the exact error depends on whether I'm using
the IDE or TPC. Also, I can create the same type of error compiling a
large number of empty WHILE loops (while true do while true do ...).

I was interested to note that TurboPower Software's PF program was
unable to format Chris' code--but it gave an intelligent error message
indicating that its stack had overflowed.

Thanks for sharing this information, Chris. I'd encourage you to pass it
on to Borland. You might get the dubious pleasure of beta testing 6.0 or
6.5 or something. ;) In the meantime, I doubt that this bug represents
any threat to code which manages to compile--but I do have something of
an uneasy feeling about it. What if it overwrote just a bit less of the
compiler's memory? Or overwrote it with just the "right" contents to
complete compilation of the wrong code? Just to be sure, maybe you'd
better rework that code and find a way around all of the nested
WHILEs...

+-------------------------------------------------------------------------+
| Karl Brendel                                Centers for Disease Control |
| phone 404/639-2709                          Epidemiology Program Office |
| fts       236-2709                          Atlanta, GA                 |
|                                                                         |
|                        Home of Epi Info 5.0                             |
+-------------------------------------------------------------------------+