[comp.lang.c] funny error

edw@IUS1.CS.CMU.EDU (Eddie Wyatt) (03/25/88)

I got an interesting error message today from the SUN compiler:

/bin/cc -I. -I/usr/misc/.matrix/include -f68881 -pipe -I/usr/wyatt/include -g -c net.c
"net.c", line 400: yacc stack overflow
*** Error code 1

Stop.

-------------------------------------------------------------------------

I have the macro def:

#define matinvert(xxx)          do { errno = 0; \
                                     matinvert(xxx); \
                                     if (errno) \
                                         printf("ERROR - in matinvert"); \
                                   } while (0)

Line 400 has the first occurance of this macro.  

Well it seems that I'm not allow to use the macro's name within the 
macro definition (the C compile interprets it as a recusive macro).
However, somehow the above macro sufficiently confused the compiler.
If I use the -E switch the compiler is able to determine that the
definition is recursive.  Oh well, just thought I would share in the
experience.


BTW: Sun's cc is written using yacc, I didn't know that til now.

-- 

Eddie Wyatt 				e-mail: edw@ius1.cs.cmu.edu