Subject: Re: sanity checking arguments to library functions...
To: Simon Burge <simonb@NetBSD.ORG>
From: Brian C. Grayson <email@example.com>
Date: 04/17/1999 11:32:03
On Sat, Apr 17, 1999 at 09:17:39PM +1000, Simon Burge wrote:
> "Brian C. Grayson" wrote:
> > Do you know which NetBSD archs will choke? It looks like it
> > won't work on mips.
> Seems ok on both Ultrix/MIPS and NetBSD/pmax. This on NetBSD/pmax:
> mona:~ 57> cc -o fofo fofo.c
> fofo.c: In function `foo':
> fofo.c:10: warning: unsupported arg to `__builtin_return_address'
> mona:~ 58> ./fofo
> __builtin_return_address(0): 0x00400ebc
> __builtin_frame_address(0): 0x7ffff620
> __builtin_return_address(1): 0x00000000
> __builtin_frame_address(1): 0x004010f0
NOT ok! For values of 1, it prints garbage. According to
something in the gcc code, the location of the previous frame
(and thus previous return address) depends on the prologue
code, or something like that. So it only supports values of 0 --
hence the warning from gcc.
mips will probably need intelligent stuff.