Re: [PATCH] alloca: fix subtraction of two alloca pointers
Kris Van Hees <[email protected]>
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Sep 01, 2025 at 01:13:49PM -0400, Eugene Loh wrote: > Reviewed-by: Eugene Loh <[email protected]> Thanks. > though... > > On 8/30/25 01:55, Kris Van Hees wrote: > > diff --git a/test/unittest/funcs/alloca/tst.alloca-arith.d b/test/unittest/funcs/alloca/tst.alloca-arith.d > > @@ -0,0 +1,29 @@ > > +BEGIN > > +{ > > + x = (char *)alloca(1); > > This is okay, but is it dead, vestigial code? No, it is part of the logic used here and in other tests to ensure that the alloca mgmt code ensures proper alignment. > > > + x = (char *)alloca(10); > > + y = (char *)alloca(1); > > + z = y - x; > > + z /= 8; > > This is okay, but how about skipping the /8 and just testing for 16? If > you're worried about padding changes in the future(?), then the x alloca() > could become alloca(16). Same as above... part of the logic to also verify that alignment is done right. In this case, it matters in terms of the pointer subtraction code which uses the base type size to make the subtraction give the number of element between the two pointers rather than just bytes. > > + exit(z == 2 ? 0 : 1); > > +}