bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: possible infinite loop in m4


From: Eric Blake
Subject: Re: possible infinite loop in m4
Date: Wed, 7 Jul 2010 00:55:53 -0400 (EDT)

----- "Mike Frysinger" <address@hidden> wrote:
> > What you're asking for is a solution to the halting problem.

> you obviously know better than i as ive never looked at the m4
> internals but 
> you cant even use the existing nesting-limit option ?  autoconf
> already runs 
> m4 with --nesting-limit=1024 which means m4 was told in no uncertain
> terms 
> that it should avoid infinite loops.  autoconf has made its intention
> clear.

--nesting-limit=1024 only catches one particular class of loops -
where you have more ( than ).  And that particular loop is caught
because otherwise you would overflow the stack.  But other loops,
like defining a macro to expand to itself, do not consume any
additional stack space or other memory, so the only way you can tell
if it is infinite is to put a time limit on the process, but what
time limit do you put that does not prevent a useful program that
takes a long time but will eventually terminate?

> not saying m4 should be accepting this code, just that when wrong code
> is 
> given, clear diagnostics are expected.

Agreed, when it is possible, but this is one case where I'm not
sure it is possible.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]