🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Paul Eggert Sat, 29 Aug 1992 08:32
GCC 2.2.2 incorrectly multiplies some long long constants by 3
#1013
Author: Paul Eggert
Date: Sat, 29 Aug 1992 08:32
33 lines
1458 bytes
GCC 2.2.2 (Sparc, SunOS 4.1.2) incorrectly multiplies some long long
constants by 3.  In the following example program, GCC miscomputes c3's
initial value to be 4294967294 instead of the correct value 8589934590,
so the program incorrectly exits with status 1.

	#define C 2863311530LL
	long long int c = C;
	long long int c3 = C * 3;

	main() { return c*3 != c3; }

Here is a workaround.

===================================================================
RCS file: fold-const.c,v
retrieving revision 2.2.2.3
diff -c -r2.2.2.3 fold-const.c
*** fold-const.c	1992/08/11 04:23:35	2.2.2.3
--- fold-const.c	1992/08/29 08:21:30
***************
*** 1045,1055 ****
  		  int2h = int2h * 2 + (temp < int2l);
  		  t = build_int_2 (temp, int2h);
  		  goto got_it;
- 		case 3:
- 		  temp = int2l + int2l + int2l;
- 		  int2h = int2h * 3 + (temp < int2l);
- 		  t = build_int_2 (temp, int2h);
- 		  goto got_it;
  		case 4:
  		  temp = int2l + int2l;
  		  int2h = int2h * 4 + ((temp < int2l) << 1);
--- 1045,1050 ----
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