[PATCH] cg, agg: fix alignment of key components

Kris Van Hees <[email protected]>
Newsgroups dev.linux.lists.dtrace
Message-ID <SJ0PR10MB5672C0C0B5FEB048DF0CF23CC2E6A@SJ0PR10MB5672.namprd10.prod.outlook.com>
Reported-by: Ruud van der Pas <[email protected]>
Signed-off-by: Kris Van Hees <[email protected]>
---
 libdtrace/dt_cg.c                      |  2 +-
 test/unittest/aggs/tst.chararray-key.d | 25 +++++++++++++++++++++++++
 test/unittest/aggs/tst.chararray-key.r |  2 ++
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 test/unittest/aggs/tst.chararray-key.d
 create mode 100644 test/unittest/aggs/tst.chararray-key.r

diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
index 1f120e1d..33435226 100644
--- a/libdtrace/dt_cg.c
+++ b/libdtrace/dt_cg.c
@@ -8734,7 +8734,7 @@ dt_cg_agg(dt_pcb_t *pcb, dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
 
 				dt_node_diftype(dtp, knp, &t);
 				size = t.dtdt_size;
-				alignment = size;
+				alignment = t.dtdt_align;
 			}
 
 			dt_aggid_rec_add(dtp, aid->di_id, kind, size, alignment, arg);
diff --git a/test/unittest/aggs/tst.chararray-key.d b/test/unittest/aggs/tst.chararray-key.d
new file mode 100644
index 00000000..af45d4a5
--- /dev/null
+++ b/test/unittest/aggs/tst.chararray-key.d
@@ -0,0 +1,25 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Licensed under the Universal Permissive License v 1.0 as shown at
+ * http://oss.oracle.com/licenses/upl.
+ */
+
+/*
+ * ASSERTION: Char arrays can be used a key components.
+ *
+ * SECTION: Aggregations/Aggregations
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@[curpsinfo->pr_fname] = count();
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/test/unittest/aggs/tst.chararray-key.r b/test/unittest/aggs/tst.chararray-key.r
new file mode 100644
index 00000000..a2dcbc2d
--- /dev/null
+++ b/test/unittest/aggs/tst.chararray-key.r
@@ -0,0 +1,2 @@
+
+  dtrace                                                            1
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.