🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Paul Eggert Mon, 02 Nov 1992 23:54
typo in fold-const.c prevents GCC 2.3.1 from catching some overflows
#49
Author: Paul Eggert
Date: Mon, 02 Nov 1992 23:54
36 lines
1850 bytes
GCC 2.3.1 (sparc, SunOS 4.1.2) doesn't warn about the integer overflow
in the program:

	long long x = 9223372036854775807LL + 1;

due to a parenthesization typo (of mine, sorry!) in fold-const.c.
Here is a patch.

Mon Nov  2 23:51:14 1992  Paul Eggert  (eggert@twinsun.com)

	* fold-const.c (same_sign): Fix parenthesization typo.

===================================================================
RCS file: fold-const.c,v
retrieving revision 2.3
retrieving revision 2.3.1.1
diff -c -r2.3 -r2.3.1.1
*** fold-const.c	1992/10/21 21:14:52	2.3
--- fold-const.c	1992/11/02 23:51:14	2.3.1.1
***************
*** 62,68 ****
  #define left_shift_overflows(a, b)  ((a)  !=  ((a) << (b)) >> (b))
  
  /* Yield nonzero if A and B have the same sign.  */
! #define same_sign(a, b) ((a) ^ (b) >= 0)
  
  /* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow.
     Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1.
--- 62,68 ----
  #define left_shift_overflows(a, b)  ((a)  !=  ((a) << (b)) >> (b))
  
  /* Yield nonzero if A and B have the same sign.  */
! #define same_sign(a, b) (((a) ^ (b)) >= 0)
  
  /* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow.
     Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1.
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