[DTrace-devel] [PATCH] alloca: fix subtraction of two alloca pointers
Kris Van Hees
kris.van.hees at oracle.com
Thu Sep 11 20:42:54 UTC 2025
On Mon, Sep 01, 2025 at 01:13:49PM -0400, Eugene Loh wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
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);
> > +}
More information about the DTrace-devel
mailing list