Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Sean Quinlan
Mon, 14 Sep 1992 16:28
(none)
Author: 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);
}
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