🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #903

GCC 1.36 does not promote float return values with -ftraditional

#903
From: cmills
Date: Sat, 20 Jan 1990 22:21
75 lines
1945 bytes
As I understand it, K&R C is supposed to convert declarations of the form
'float foo()' to 'double foo()'.  GCC 1.36 does not seem to do this, even with
the -ftraditional flag.  For the input

float bar();
double foo() {
  float a=1.0;
  return bar(a);
}

I get these results (with config.gcc sun3):

Script started on Sat Jan 20 14:06:22 1990
wyse:cmills:/uss/cmills (21) gcc -S -ftraditional foo.c
wyse:cmills:/uss/cmills (22) cat foo.s
#NO_APP
gcc_compiled.:
.text
	.even
LC0:
	.single 0r1.00000000000000000000e+00
	.even
.globl _foo
_foo:
	link a6,#-4
	movel LC0,a6@(-4)
	fmoves a6@(-4),fp0
	fmoved fp0,sp@-
	movel sp@+,d0
	movel sp@+,d1
	movel d1,sp@-
	movel d0,sp@-
	jbsr _bar
	movel d0,d0
	fmoves d0,fp0		<- bar's return value (which should be double)
	fmoved fp0,sp@-		<- is coerced to double for foo's return.
	movel sp@+,d0
	movel sp@+,d1
	jra L1
L1:
	unlk a6
	rts
wyse:cmills:/uss/cmills (23) cc -S -f68881 foo.c
wyse:cmills:/uss/cmills (24) cat foo.s
LL0:
	.data
	.text
|#PROC# 07
	.globl	_foo
_foo:
|#PROLOGUE# 0
	link	a6,#0
	addl	#-LF13,sp
	moveml	#LS13,sp@
	fmovem	#LSS13,a6@(-LFF13:l)
|#PROLOGUE# 1
	movl	#0x3f800000,a6@(-0x4)
	fmoves	a6@(-0x4),fp0
	fmoved	fp0,sp@-
	jbsr	_bar		<- bar's return value is double, no coercion
	addqw	#0x8,sp
	jra	LE13
LE13:
	unlk	a6
	rts
	LF13 = 4
	LS13 = 0x0
	LFF13 = 4
	LSS13 = 0x0
	LP13 =	0xc
	.data
	.globl	f68881_used
wyse:cmills:/uss/cmills (25) exit
wyse:cmills:/uss/cmills (26) 
script done on Sat Jan 20 14:07:30 1990
Technical Details
Message-ID: <2586@wyse.wyse.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!vsi1!wyse!wyse.wyse.com!cmills

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!vsi1!wyse!wyse.wyse.com!cmills
From: cmills@wyse.wyse.com
Newsgroups: gnu.gcc.bug
Subject: GCC 1.36 does not promote float return values with -ftraditional
Message-ID: <2586@wyse.wyse.com>
Date: 20 Jan 90 22:21:20 GMT
Sender: news@wyse.wyse.com
Reply-To: cmills@wyse.wyse.com ()
Organization: Wyse Technology
Lines: 75