🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1277

cpp doesn't diagnose '\^X' (GCC 2.3.1)

#1277
From: Paul Eggert
Date: Fri, 06 Nov 1992 01:38
37 lines
1416 bytes
GCC 2.3.1 (sparc, SunOS 4.1.2) does not diagnose the syntax error in the first
line of the following program:

	#if '\^X'
	main() { return 0; }
	#endif

cc1 rejects '\^X', so the simplest fix is to have cpp reject it too:


Fri Nov  6 01:29:53 1992  Paul Eggert  (eggert@twinsun.com)

	* cexp.y (parse_escape): Don't accept '\^X'.

===================================================================
RCS file: cexp.y,v
retrieving revision 2.3
retrieving revision 2.3.1.1
diff -c -r2.3 -r2.3.1.1
*** cexp.y	1992/10/21 06:53:52	2.3
--- cexp.y	1992/11/06 01:29:53	2.3.1.1
***************
*** 764,776 ****
      case 0:
        (*string_ptr)--;
        return 0;
-     case '^':
-       c = *(*string_ptr)++;
-       if (c == '\\')
- 	c = parse_escape (string_ptr);
-       if (c == '?')
- 	return 0177;
-       return (c & 0200) | (c & 037);
        
      case '0':
      case '1':
--- 764,769 ----
Technical Details
Message-ID: <9211060138.AA03142@farside.twinsun.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!eggert

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!eggert
From: eggert@twinsun.COM (Paul Eggert)
Subject: cpp doesn't diagnose '\^X' (GCC 2.3.1)
Message-ID: <9211060138.AA03142@farside.twinsun.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 6 Nov 1992 01:38:10 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 38