🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #370

Bug in (sparc) va_start

#370
From: Garrett Wollman
Date: Sun, 12 Apr 1992 19:24
27 lines
1239 bytes
Imagine you have a function like this...

void foo(uchar a,uchar b,...) {
  va_list args;

  va_start(args,b);
  do_something_with(va_arg(args,int));
  va_end(args)
}

On the Sparc, at any rate, such a function will be struck dead with a
wand of bus error.  &b turns out to be an odd address, and so va_start
initializes args to be (effectively) &b + 4, which is also an odd
address.  Bleah.

Now don't ask me how &b turns out to be odd..

The temporary work-around to this is to put an int argument first, and
va_start off of that, which then breaks ANSI compliance.

-GAWollman

-- 
[Y]ou can be pretty sure that if it isn't Usenet now it will be once
it's been in contact with Usenet for long enough. - Ed Vielmetti emv@msen.com
------------------------------
Garrett A. Wollman - wollman@uvm.edu - uvm-gen!wollman
Technical Details
Message-ID: <1992Apr12.192417.7268@uvm.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!uvm.edu!wollman

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!uvm.edu!wollman
From: wollman@uvm.edu (Garrett Wollman)
Subject: Bug in (sparc) va_start
Message-ID: <1992Apr12.192417.7268@uvm.edu>
Sender: gnulists@ai.mit.edu
Organization: University of Vermont, EMBA Computer Facility
Distribution: gnu
Date: Sun, 12 Apr 1992 19:24:17 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 28