Subject: port-m68k/1193: wrong va_start in m68k/stdarg.h
To: None <gnats-admin@sun-lamp.pc.cs.cmu.edu>
From: Bernd Ernesti <bernd@arresum.inka.de>
List: netbsd-bugs
Date: 07/04/1995 06:50:05
>Number:         1193
>Category:       port-m68k
>Synopsis:       wrong va_start in m68k/stdarg.h
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul  4 06:50:04 1995
>Originator:     Bernd Ernesti
>Organization:
	
>Release:        NetBSD-current 03-Jul-95
>Environment:
	
System: NetBSD arresum 1.0A NetBSD 1.0A (VEEGO) #148: Mon Jul 3 15:33:35 MET DST 1995 bernd@arresum:/src/sys/arch/amiga/compile/VEEGO amiga


>Description:
The original description was in German and came from Markus Wild (mw@eunet.ch).

The above patch should be used, because when you use this:

int
foo (char last, ...)

and you use &last then you are 1 byte before of ..., and not 4 bytes as you are
under little-endian.

>How-To-Repeat:
	
>Fix:

*** sys/arch/m68k/include/stdarg.h-orig	Mon Mar 27 14:00:29 1995
--- sys/arch/m68k/include/stdarg.h	Tue Jul  4 09:40:30 1995
***************
*** 46,52 ****
  	(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
  
  #define	va_start(ap, last) \
! 	(ap = ((char *)&(last) + __va_promote(last)))
  
  #ifdef _KERNEL
  #define	va_arg(ap, type) \
--- 46,52 ----
  	(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
  
  #define	va_start(ap, last) \
! 	(ap = ((char *)&(last) + sizeof(last)))
  
  #ifdef _KERNEL
  #define	va_arg(ap, type) \

>Audit-Trail:
>Unformatted: