cpp and compliance to C99

Thomas Pornin Thomas.Pornin@ens.fr
Thu Oct 12 07:25:00 GMT 2000


Hello,

I have downloaded and tried the cpp included in the last egcs snapshot
(egcs-20001009) and I have encountered some problems.

The host/build/target machine is an Alpha ev56 running Linux (RedHat 5.1,
somehow modified). The compiler used is gcc-2.95.2 (but egcs is supposed
to recompile itself, I think), binutils are 2.9.1 (with BFD 2.9.1.0.4),
libc is the GNU libc 2.0.7. The compilation was performed with only
a --prefix as option to configure, and a "make bootstrap" followed by
a "make install" (GNU make 3.76.1).

On the following code:
#define a(x) b
#define b(x) a(x)
a(a)(a)(a)

the cpp gives the following result:
b(a)

which seems wrong to me (it performs one extra macro replacement, which
should not have been done according to the nesting macro rule). It should
have given: a(a)(a)

On the following code:
#define a(x) b(
#define b(x) a(
a(a)x)x)

the cpp gives the following result:
b

which seems equally wrong (it should have given: a(x)).


I might be completely wrong myself about the interpretation of the
standard, but I have also another problem, which is definitely a bug:
on the second example, "cpp -traditional" gives this:

vk.c:4: unterminated macro call
cpp: Internal error: Segmentation fault (program tradcpp0)
Please submit a full bug report.

Please note that this is on a 3-line file, therefore without any line
number 4.


I hope this is usefull information for you.


	--Thomas Pornin


More information about the Gcc-bugs mailing list