🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1086

Possible stdarg.h bug on Mips Ultrix?

#1086
From: Paul N. Hilfinger
Date: Tue, 08 Sep 1992 07:46
25 lines
1253 bytes
In gcc 2.2.2, stdarg.h includes va-mips.h, which says

    #define va_arg(AP, mode)						\
      ((mode *)(AP = (char *) (__alignof(mode) > 4			\
				    ? ((int)AP + 2*8 - 1) & -8		\
				    : ((int)AP + 2*4 - 1) & -4)))[-1]


(if !lint).  However, under Ultrix V4.2A (Rev. 47) running on a
DecStation, I find the following:

    #ifdef __host_mips

     ...

	    /* va_arg aligns list and points past data */
    #define va_arg(list, mode) ((mode *)(list =\
     (va_list) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
     (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]

Notice that the va-mips.h code is insensitive to sizeof(mode).  As a
result, passing of sufficiently large structures does not work.  What
is going on?

P. Hilfinger
Technical Details
Message-ID: <9209080747.AA22963@tully.CS.Berkeley.EDU.iliad>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tully.cs.berkeley.edu!hilfingr

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tully.cs.berkeley.edu!hilfingr
From: hilfingr@tully.cs.berkeley.edu (Paul N. Hilfinger)
Subject: Possible stdarg.h bug on Mips Ultrix?
Message-ID: <9209080747.AA22963@tully.CS.Berkeley.EDU.iliad>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 8 Sep 1992 07:46:58 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 26