Bug 181

Summary: stdarg or gcc broken to handle non-int sized start arg
Product: Base System Reporter: ache <ache>
Component: gnuAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

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