[gnu.gcc.bug] gcc 1.35 bug in cpp with ##

luik@UUNET.UU.NET (Andreas Luik) (09/26/89)

gcc version:

    gcc version 1.35

File cpp.c:

    #define A(B)    ##B

    void main ()
    {
	char *cp = A(umu);
    }


Compile with:

    gcc -c cpp.c

Compiler output:

    gcc: Program cpp got fatal signal 6.

Configuration:

    config.gcc  sun3-os4

System:

    Sun 3/60 with SunOS 4.0.3

Error description:

    The line "#define A(B)    ##B" should of course read as
    "#define A(B)    #B". But gcc-ccp should not abort with a
    signal 6 but should complain with an useful error message.

Thanks,

-- 
Andreas Luik
I S A  GmbH - Informationssysteme fuer computerintegrierte Automatisierung
Azenbergstr. 35, D-7000 Stuttgart 1, West-Germany, Phone: +49-711/22769-44

Domain: luik@isaak.isa.de  BITNET: luik%isaak.uucp@unido.bitnet
UUCP:   luik@isaak.uucp    Bang:   ...{uunet!unido,pyramid!iaoobel}!isaak!luik

wood@dg-rtp.dg.com (Tom Wood) (09/29/89)

The preprocessor fails to deal with constraints on the ## operator in
general:

	3.8.3.3 The ## operator 

	Constraints

	   A ## preprocessing token shall not occur at the beginning
	or at the end of a replacement list for either form of macro
	definition.

In other contexts, these invalid cases are silently ignored and do not
produce the requisite error message.  Maybe its fixed in 1.36 ;-).
			Tom Wood	(919) 248-6067
			Data General, Research Triangle Park, NC
			{the known world}!rti!xyzzy!wood