🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1003

GCC 2.2.2 sometimes thinks DEL is printable

#1003
From: Paul Eggert
Date: Thu, 27 Aug 1992 01:39
90 lines
3245 bytes
For the program

	char x = '\^?';

where ^? stands for a single DEL (0177) character,
GCC 2.2.2 (Sparc, SunOS 4.1.2) outputs the error message

	t.c:1: warning: unknown escape sequence `\^?'

where ^? stands for a single DEL character.
GCC should output something like this instead, since DEL isn't printable:

	t.c:1: warning: unknown escape sequence: `\' followed by char code 0x7f

This problem appears in three places in GCC.  Here is a patch.

Thu Aug 27 01:32:11 1992  Paul Eggert  (eggert@twinsun.com)

	* c-lex.c, cp-lex.c (readescape): DEL isn't printable.
	* c-typeck.c (check_format): Likewise.

===================================================================
RCS file: c-lex.c,v
retrieving revision 2.2.2.3
diff -c -r2.2.2.3 c-lex.c
*** c-lex.c	1992/08/27 01:15:00	2.2.2.3
--- c-lex.c	1992/08/27 01:32:11
***************
*** 852,858 ****
  	pedwarn ("non-ANSI escape sequence `\\%c'", c);
        return c;
      }
!   if (c >= 040 && c <= 0177)
      pedwarn ("unknown escape sequence `\\%c'", c);
    else
      pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
--- 852,858 ----
  	pedwarn ("non-ANSI escape sequence `\\%c'", c);
        return c;
      }
!   if (c >= 040 && c < 0177)
      pedwarn ("unknown escape sequence `\\%c'", c);
    else
      pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
===================================================================
RCS file: c-typeck.c,v
retrieving revision 2.2.2.5
diff -c -r2.2.2.5 c-typeck.c
*** c-typeck.c	1992/08/12 01:23:10	2.2.2.5
--- c-typeck.c	1992/08/27 01:32:11
***************
*** 1627,1633 ****
  	}
        if (fci->format_chars == 0)
  	{
! 	  if (format_char >= 040 && format_char <= 0177)
  	    sprintf (message,
  		     "unknown conversion type character `%c' in format",
  		     format_char);
--- 1627,1633 ----
  	}
        if (fci->format_chars == 0)
  	{
! 	  if (format_char >= 040 && format_char < 0177)
  	    sprintf (message,
  		     "unknown conversion type character `%c' in format",
  		     format_char);
===================================================================
RCS file: cp-lex.c,v
retrieving revision 2.2.2.2
diff -c -r2.2.2.2 cp-lex.c
*** cp-lex.c	1992/07/24 18:55:24	2.2.2.2
--- cp-lex.c	1992/08/27 01:32:11
***************
*** 2235,2241 ****
      case '[':
        return c;
      }
!   if (c >= 040 && c <= 0177)
      warning ("unknown escape sequence `\\%c'", c);
    else
      warning ("unknown escape sequence: `\\' followed by char code 0x%x", c);
--- 2235,2241 ----
      case '[':
        return c;
      }
!   if (c >= 040 && c < 0177)
      warning ("unknown escape sequence `\\%c'", c);
    else
      warning ("unknown escape sequence: `\\' followed by char code 0x%x", c);
Technical Details
Message-ID: <9208270139.AA29570@farside.twinsun.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!twinsun.COM!eggert

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!twinsun.COM!eggert
From: eggert@twinsun.COM (Paul Eggert)
Subject: GCC 2.2.2 sometimes thinks DEL is printable
Message-ID: <9208270139.AA29570@farside.twinsun.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 27 Aug 1992 01:39:15 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 91