Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Garrett Wollman
Sun, 12 Apr 1992 19:24
Bug in (sparc) va_start
Author: Garrett Wollman
Date: Sun, 12 Apr 1992 19:24
Date: Sun, 12 Apr 1992 19:24
27 lines
1239 bytes
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
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