Re: [GXemul-devel] NetBSD/hpcmips install fails under GXemul 0.6.1
Status: Alpha
Brought to you by:
gavare
From: Andreas G. <gs...@gs...> - 2019-06-06 13:53:55
|
Anders Gavare wrote: > > Looks like the code has undefined behavior: init_bootpath is set to > > point to the local variable bootpath[], but by the time init_bootpath > > is used as the source in strlcpy(), bootpath[] has already gone out of > > scope. > > Horrible and embarrassing. :-| > > But interesting at the same time. It feels like the compiler took the > opportunity to optimize away the undefined code. Yes, that's what it looks like to me, too. > It would have been nice to > get a warning from the compiler though, something like "taking the address > to a temporary stack variable and using it after it has gone out of scope" > etc. Indeed. > Moving bootpath to the top of the function should work then: > https://pastebin.com/FXMKvCQC Yes, that works. -- Andreas Gustafsson, gs...@gs... |