LCC (CPP) preprocessor bug

  • Follow


/
*****************************************************************************

  The LCC preprocessor has a bug which apparently creates an infinite
loop
  causing the compiler to hang (never finishes compiling).

  Lennie

*****************************************************************************/

#define F1(a,b)         ((a) + (b))
#define STEP(f,a,b)     b = f(a,b)

int main(int argc, char* argv[])
{
    int x,y;
    STEP(F1,x,y);
    return 0;
}

0
Reply lennie 11/24/2008 5:02:00 PM

I reposted since I can't seem to "Reply" to old messages.  I think the
following is a fix for the CPP preprocessor bug.

cpp.h (patch):

114c114
< void	expand(Tokenrow *, Nlist *);
---
> int	expand(Tokenrow *, Nlist *);

macro.c (patch)

165c165,166
< 			expand(trp, np);
---
> 			if (expand(trp, np) < 0)
> 				break;
178c179
< void
---
> int
194c195
< 			return;
---
> 			return narg;
200c201
< 			return;
---
> 			return narg;
222c223
< 	return;
---
> 	return narg;


Can anyone else verify?

0
Reply lennie 11/24/2008 5:06:05 PM


lennie wrote:
> /
> *****************************************************************************
> 
>   The LCC preprocessor has a bug which apparently creates an infinite
> loop
>   causing the compiler to hang (never finishes compiling).
> 
>   Lennie
> 
> *****************************************************************************/
> 
> #define F1(a,b)         ((a) + (b))
> #define STEP(f,a,b)     b = f(a,b)
> 
> int main(int argc, char* argv[])
> {
>     int x,y;
>     STEP(F1,x,y);
>     return 0;
> }
> 

This doesn't happen with lcc-win.


-- 
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
0
Reply jacob 11/25/2008 7:27:36 AM

2 Replies
222 Views

(page loaded in 0.258 seconds)

Similiar Articles:






7/22/2012 4:40:09 PM


Reply: