Bug 181 - stdarg or gcc broken to handle non-int sized start arg
Summary: stdarg or gcc broken to handle non-int sized start arg
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: gnu (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1995-01-24 03:30 UTC by ache
Modified: 1995-01-24 03:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ache 1995-01-24 03:30:01 UTC
Try to run following example, it _must_ print 1234 and print
in all systems expect FreeBSD. Arg length is fatal: when commented
and uncommented lines flipped, it works, i.e. it works for
int-sized first argument. stdarg.h have some code to handle non-int
args in va_start, but it doesn't help here.

Fix: 

Don't known. Probably stdarg.h promote macro needs to be fixed.
How-To-Repeat: 
#include <stdarg.h>

void f(unsigned char l, ...)
/*void f(int l, ...)*/
{
	va_list a;
	va_start(a, l);
	printf("%d\n", va_arg(a, int));
}
main() {
	f(0,1234);
}
Comment 1 Andrey A. Chernov freebsd_committer freebsd_triage 1995-01-24 16:59:33 UTC
State Changed
From-To: open->closed

stdarg.h fixed