Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!mips!servitude!rogerk From: rogerk@mips.COM (Roger B.A. Klorese) Newsgroups: comp.sys.mips Subject: Re: Varargs is broken Message-ID: <39254@mips.mips.COM> Date: 8 Jun 90 00:14:48 GMT References: <1990Jun8.000213.5271@smsc.sony.com> Sender: news@mips.COM Reply-To: rogerk@mips.COM (Roger B.A. Klorese) Organization: MIPS Computer Systems, Inc. Lines: 37 In article <1990Jun8.000213.5271@smsc.sony.com> allan@smsc.Sony.COM (Allan McNaughton) writes: >Mister Mips: Oh, you flatter me. Oh, you meant *Mash*?! *snif* >Varargs appears to be broken. We are running a M2000 with RISC/OS 4.5b >and the 2.0 version of the C compiler. > >Your call/return standard says that if the first argument is a float, then >the argument will be passed in one of the fp registers. Works just fine, >except when you want to pass it to a function that is expecting a varargs >list. Varargs, assumes all arguments are on the stack and forces them to >be by saving a0...a3 to the stack. However, it knows nothing about the fp >registers at all. > >How could this have ever worked? What has been done to fix the problem? >This failure was found because System V.4 SVVS tests use it all over the >place. Never did, (probably) never will. Quoting from the Mips-C release 2.10 and 2.11 release notes (2.11 is the release that will be shipped with RISC/os 4.50 -- 2.10 is the version that contains most of the same fixes but is compatible only with 4.0-thru-4.30, and is available by special order from the Customer Response Center for contract customers): "MIPS version of 'varargs' does not work when the first argument is a double. Since the MIPS compiler is migrating to ANSI, stdarg should be used which fixes the problem. 'stdarg.h' use is fully supported by the 2.10 compiler. The caller needs the prototype to be visible (a requirement of ANSI for 'stdarg' calls)" -- ROGER B.A. KLORESE MIPS Computer Systems, Inc. phone: +1 408 720-2939 MS 4-02 950 DeGuigne Dr. Sunnyvale, CA 94086 voicemail: +1 408 524-7421 rogerk@mips.COM {ames,decwrl,pyramid}!mips!rogerk "I'm the NLA" "Maybe this world is another planet's hell." -- Aldous Huxley