Article View: gnu.gcc.bug
Article #1146(none)
From: Sean Quinlan
Date: Mon, 14 Sep 1992 16:28
Date: Mon, 14 Sep 1992 16:28
70 lines
1536 bytes
1536 bytes
I think I have found a bug with the mips stdarg header.
The following program was run on a DEC 500 running
ULTRIX V4.2A (Rev. 47) and compiled with gcc version 2.2.2
The sample program is supposed to cycle through three structures
printing them out. The correct output is
1 2
13 12
123 456
when compiled with gcc I get
3 3
3 1
1 2
After playing with it a while, it looks like the macro va_arg
does not take a big enough step for each structure. In fact the macro
in va-mips.h does not even take the size of the object that is to be
returned and thus it is not possible to step the correct amount.
I hope you can fix the problem!
thanks
sean quinlan
---------
#include <stdarg.h>
typedef struct Obj {
int p0;
int p1;
} Obj;
Obj
convert(int n, ...)
{
va_list ap;
Obj o;
int i;
va_start(ap, n);
for (i = 0; i < n; i++) {
o = va_arg(ap, Obj);
printf("%d %d\n", o.p0, o.p1);
}
va_end(ap);
return o;
}
main()
{
Obj a, b, c, d;
a.p0 = 1;
a.p1 = 2;
b.p0 = 13;
b.p1 = 12;
c.p0 = 123;
c.p1 = 456;
d = convert(3, a, b, c);
}
Technical Details
Message-ID:
<9209150628.AA00101@bittern.Stanford.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!flamingo.stanford.edu!seanShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!flamingo.stanford.edu!sean From: sean@flamingo.stanford.edu (Sean Quinlan) Subject: (none) Message-ID: <9209150628.AA00101@bittern.Stanford.EDU> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Mon, 14 Sep 1992 16:28:36 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 72