🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Paul Eggert Thu, 27 Aug 1992 01:25
GCC 2.2.2 wrongly warns that '\x000000000' is out of range
#1002
Author: Paul Eggert
Date: Thu, 27 Aug 1992 01:25
81 lines
2275 bytes
Given the program

	char x = '\x000000000';

GCC 2.2.2 (SunOS 4.1.2, Sparc) wrongly complains:

	t.c:1: warning: hex escape out of range

Here is a patch.

Thu Aug 27 01:15:00 1992  Paul Eggert  (eggert@twinsun.com)

	* c-lex.c (readescape): Leading zeros do not contribute to a hex
	escape's size when checking for overflow.

===================================================================
RCS file: c-lex.c,v
retrieving revision 2.2.2.2
diff -c -r2.2.2.2 c-lex.c
*** c-lex.c	1992/07/24 18:54:59	2.2.2.2
--- c-lex.c	1992/08/27 01:15:00
***************
*** 741,747 ****
  {
    register int c = getc (finput);
    register int code;
!   register unsigned count;
    unsigned firstdig;
  
    switch (c)
--- 741,747 ----
  {
    register int c = getc (finput);
    register int code;
!   register int count;
    unsigned firstdig;
  
    switch (c)
***************
*** 754,760 ****
  	return c;
  
        code = 0;
!       count = 0;
        while (1)
  	{
  	  c = getc (finput);
--- 754,760 ----
  	return c;
  
        code = 0;
!       count = -1;
        while (1)
  	{
  	  c = getc (finput);
***************
*** 773,782 ****
  	  if (c >= '0' && c <= '9')
  	    code += c - '0';
  	  if (count == 0)
! 	    firstdig = code;
  	  count++;
  	}
!       if (count == 0)
  	error ("\\x used with no following hex digits");
        else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
  	       || (count > 1
--- 773,785 ----
  	  if (c >= '0' && c <= '9')
  	    code += c - '0';
  	  if (count == 0)
! 	    {
! 	      firstdig = code;
! 	      count = code ? 0 : -1;
! 	    }
  	  count++;
  	}
!       if (count < 0)
  	error ("\\x used with no following hex digits");
        else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
  	       || (count > 1
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads