Subject: egcs-1.1: i386 stdcall function codegen bug
From: [email-masked] (Mumit Khan)

28 Oct 1998 16:20:32 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="1915750185-1360710587-909549652=:28077"
To: [email-masked], [email-masked]

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to [email-masked] for more info.

--1915750185-1360710587-909549652=:28077
Content-Type: TEXT/PLAIN; charset=US-ASCII

egcs version : release and mainline
binutils     : 2.9.1 and 980830 snapshots

There seems to be a i386 codegen bug that affects "stdcall" functions
returning anything larger than an integer.

For the following function,

  double __attribute__((stdcall))
  foo_local1 (double f) {
    return f;
  }

The assembly created (using -O2 -fomit-frame-pointer to cut noise), we
get the following. This causes the return value to be garbage unless
I comment out the "fstp" instruction. 

  .globl _foo_local1@8
  _foo_local1@8:
	  fldl 4(%esp)
	  fstp %st(0)		## <<<< offending instruction
	  ret $8

Interestingly, for a "cdecl" function, the fstp instruction is missing
and everything works as expected.

  double 
  foo_local2 (double f) {
    return f;
  }

  .globl _foo_local2
  _foo_local2:
	  fldl 4(%esp)		## <<<< no fstp instruction
	  ret

I'm attaching a trivial, but complete, test program that shows the 
problem.

Regards,
Mumit

--1915750185-1360710587-909549652=:28077
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="stdcall-bug.c"
Content-Transfer-Encoding: BASE64
Content-ID: <[email-masked]>
Content-Description: bug test case

--1915750185-1360710587-909549652=:28077--
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".