|
Message-ID: <20220322160400.GC7074@brightrain.aerifal.cx> Date: Tue, 22 Mar 2022 12:04:00 -0400 From: Rich Felker <dalias@...c.org> To: Jeffrey Walton <noloader@...il.com> Cc: musl@...ts.openwall.com Subject: Re: add loongarch64 port On Tue, Mar 22, 2022 at 11:06:41AM -0400, Jeffrey Walton wrote: > On Tue, Mar 22, 2022 at 8:59 AM Rich Felker <dalias@...c.org> wrote: > > On Tue, Mar 22, 2022 at 11:52:35AM +0800, 王洪亮 wrote: > .... > > > +++ b/arch/loongarch64/bits/signal.h > > > @@ -0,0 +1,79 @@ > > > +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ > > > + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) > > > + > > > +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) > > > +#define MINSIGSTKSZ 4096 > > > +#define SIGSTKSZ 16384 > > > +#endif > > > + > > > +typedef unsigned long greg_t, gregset_t[32]; > > > + > > > +typedef struct sigcontext { > > > + unsigned long pc; > > > + gregset_t gregs; > > > + unsigned int flags; > > > + unsigned long extcontext[0] __attribute__((__aligned__(16))); > > > +}mcontext_t; > > > > [0] is not valid, and having a flexible array member here is possibly > > not even useful since I don't think it would be valid to access it via > > uc->uc_mcontext.extcontext[] since the instance of mcontext_t inside > > the ucontext struct does not have FAM space belonging to it, even if > > additional space was allocated past the end of the ucontext_t. In > > other words, I think compilers would be justified in treating attempts > > to access it this way as UB and optimizing them out. > > I believe zero-length arrays are legal in C99. I'm not sure how well > it applies here or to Musl on some (older?) platforms. No, those are flexible array members and are declared with [] not [0].
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.