[pdftex] Bug in pdflatex

Reinhard Kotucha reinhard.kotucha at web.de
Mon Feb 10 21:44:01 CET 2014


On 2014-02-09 at 23:58:23 +0100, Armin Fügenschuh wrote:

 >there seems to be a bug in pdflatex (using Mac OS10.7.5, further
 >version details below). Try to run the attached tex source with this
 >command, and it will not stop:
 >
 >pdflatex -interaction=nonstopmode endlessloop.tex
 >
 >(In line 24, there is an additional } after n_2 that needs to be deleted.)

Dear Armin,
the "problem" is that TeX can't know that there is an endless loop
unless a stack overflow occurs.

TeX supports "tail recursion", that means that a macro can be called
recusively without leaving anything on the stack.  This is on purpose,
of course, because nobody likes stack overflows.

It's not a bug and the behavior is not specific to pdfTeX.  You'll
encounter the same behavior with Knuth's TeX too.

It's not even specific to TeX, all programming languages which support
proper tail calls or goto statements can run into endless
loops/recursions which cannot be detected.  And it's rather a feature
than a bug.

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------



More information about the pdftex mailing list