[DTrace-devel] [PATCH v2 03/14] Promote associative integer arrays to 64 bits when loaded
eugene.loh at oracle.com
eugene.loh at oracle.com
Fri May 5 02:42:09 UTC 2023
From: Eugene Loh <eugene.loh at oracle.com>
In commit 7e9ce1eee475 ("Promote integers to 64 bits when loaded"),
integers were promoted to 64 bits when loaded. Associative arrays
were on a different code path.
Add the promotion to the associative-array code path and add tests
for different variable types.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
---
libdtrace/dt_cg.c | 1 +
test/unittest/arithmetic/tst.cast-add-assoc.d | 97 +++++++++++++++++++
test/unittest/arithmetic/tst.cast-add-assoc.r | 37 +++++++
test/unittest/arithmetic/tst.cast-add-tvar.d | 97 +++++++++++++++++++
test/unittest/arithmetic/tst.cast-add-tvar.r | 37 +++++++
test/unittest/arithmetic/tst.cast-imp-assoc.d | 95 ++++++++++++++++++
test/unittest/arithmetic/tst.cast-imp-assoc.r | 43 ++++++++
test/unittest/arithmetic/tst.cast-imp-tvar.d | 95 ++++++++++++++++++
test/unittest/arithmetic/tst.cast-imp-tvar.r | 43 ++++++++
9 files changed, 545 insertions(+)
create mode 100644 test/unittest/arithmetic/tst.cast-add-assoc.d
create mode 100644 test/unittest/arithmetic/tst.cast-add-assoc.r
create mode 100644 test/unittest/arithmetic/tst.cast-add-tvar.d
create mode 100644 test/unittest/arithmetic/tst.cast-add-tvar.r
create mode 100644 test/unittest/arithmetic/tst.cast-imp-assoc.d
create mode 100644 test/unittest/arithmetic/tst.cast-imp-assoc.r
create mode 100644 test/unittest/arithmetic/tst.cast-imp-tvar.d
create mode 100644 test/unittest/arithmetic/tst.cast-imp-tvar.r
diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
index 8965175a..abdf453f 100644
--- a/libdtrace/dt_cg.c
+++ b/libdtrace/dt_cg.c
@@ -4037,6 +4037,7 @@ dt_cg_assoc_op(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
emit(dlp, BPF_JUMP(lbl_done));
emitl(dlp, lbl_notnull,
BPF_LOAD(ldstw[size], dnp->dn_reg, BPF_REG_0, 0));
+ dt_cg_promote(dnp, size, dlp, drp);
emitl(dlp, lbl_done,
BPF_NOP());
}
diff --git a/test/unittest/arithmetic/tst.cast-add-assoc.d b/test/unittest/arithmetic/tst.cast-add-assoc.d
new file mode 100644
index 00000000..494099cf
--- /dev/null
+++ b/test/unittest/arithmetic/tst.cast-add-assoc.d
@@ -0,0 +1,97 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2022, 2023, 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: Integers are promoted correctly for mixed-type adds
+ * using associative arrays.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ */
+/* @@runtest-opts: -qC */
+
+signed char c[int];
+short s[int];
+int i[int];
+long long l[int];
+unsigned char C[int];
+unsigned short S[int];
+unsigned int I[int];
+unsigned long long L[int];
+
+#define FMT " %d"
+#define USE_FMT(f)
+
+#define TEST(x, y) \
+ x[0] = -2; y[0] = -3; printf(FMT, x[0] + y[0]); printf(FMT, y[0] + x[0]); \
+ x[0] = -2; y[0] = +3; printf(FMT, x[0] + y[0]); printf(FMT, y[0] + x[0]); \
+ x[0] = +2; y[0] = -3; printf(FMT, x[0] + y[0]); printf(FMT, y[0] + x[0]); \
+ x[0] = +2; y[0] = +3; printf(FMT, x[0] + y[0]); printf(FMT, y[0] + x[0]); printf("\n");
+
+BEGIN
+{
+ /* cast to signed char */
+ USE_FMT(" %hhd");
+ TEST(c, c)
+
+ /* cast to unsigned char */
+ USE_FMT(" %hhu");
+ TEST(C, c)
+ TEST(C, C)
+
+ /* cast to short */
+ USE_FMT(" %hd");
+ TEST(s, c)
+ TEST(s, C)
+ TEST(s, s)
+
+ /* cast to unsigned short */
+ USE_FMT(" %hu");
+ TEST(S, c)
+ TEST(S, C)
+ TEST(S, s)
+ TEST(S, S)
+
+ /* cast to int */
+ USE_FMT(" %d");
+ TEST(i, c)
+ TEST(i, C)
+ TEST(i, s)
+ TEST(i, S)
+ TEST(i, i)
+
+ /* cast to unsigned int */
+ USE_FMT(" %u");
+ TEST(I, c)
+ TEST(I, C)
+ TEST(I, s)
+ TEST(I, S)
+ TEST(I, i)
+ TEST(I, I)
+
+ /* cast to long long */
+ USE_FMT(" %lld");
+ TEST(l, c)
+ TEST(l, C)
+ TEST(l, s)
+ TEST(l, S)
+ TEST(l, i)
+ TEST(l, I)
+ TEST(l, l)
+
+ /* cast to unsigned long long */
+ USE_FMT(" %llu");
+ TEST(L, c)
+ TEST(L, C)
+ TEST(L, s)
+ TEST(L, S)
+ TEST(L, i)
+ TEST(L, I)
+ TEST(L, l)
+ TEST(L, L)
+
+ exit (0);
+}
diff --git a/test/unittest/arithmetic/tst.cast-add-assoc.r b/test/unittest/arithmetic/tst.cast-add-assoc.r
new file mode 100644
index 00000000..778b88e0
--- /dev/null
+++ b/test/unittest/arithmetic/tst.cast-add-assoc.r
@@ -0,0 +1,37 @@
+ -6 -6 6 6 -6 -6 6 6
+ 251 251 1 1 255 255 5 5
+ 250 250 6 6 250 250 6 6
+ -5 -5 1 1 -1 -1 5 5
+ 251 251 1 1 255 255 5 5
+ -6 -6 6 6 -6 -6 6 6
+ 65531 65531 1 1 65535 65535 5 5
+ 251 251 1 1 255 255 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ 65530 65530 6 6 65530 65530 6 6
+ -5 -5 1 1 -1 -1 5 5
+ 251 251 1 1 255 255 5 5
+ -5 -5 1 1 -1 -1 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ -6 -6 6 6 -6 -6 6 6
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ 251 251 1 1 255 255 5 5
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ 4294967290 4294967290 6 6 4294967290 4294967290 6 6
+ -5 -5 1 1 -1 -1 5 5
+ 251 251 1 1 255 255 5 5
+ -5 -5 1 1 -1 -1 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ -5 -5 1 1 -1 -1 5 5
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ -6 -6 6 6 -6 -6 6 6
+ 18446744073709551611 18446744073709551611 1 1 18446744073709551615 18446744073709551615 5 5
+ 251 251 1 1 255 255 5 5
+ 18446744073709551611 18446744073709551611 1 1 18446744073709551615 18446744073709551615 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ 18446744073709551611 18446744073709551611 1 1 18446744073709551615 18446744073709551615 5 5
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ 18446744073709551611 18446744073709551611 1 1 18446744073709551615 18446744073709551615 5 5
+ 18446744073709551610 18446744073709551610 6 6 18446744073709551610 18446744073709551610 6 6
+
diff --git a/test/unittest/arithmetic/tst.cast-add-tvar.d b/test/unittest/arithmetic/tst.cast-add-tvar.d
new file mode 100644
index 00000000..d79bc60f
--- /dev/null
+++ b/test/unittest/arithmetic/tst.cast-add-tvar.d
@@ -0,0 +1,97 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2023, 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: Integers are promoted correctly for mixed-type adds
+ * when using thread-local variables.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ */
+/* @@runtest-opts: -qC */
+
+self signed char c;
+self short s;
+self int i;
+self long long l;
+self unsigned char C;
+self unsigned short S;
+self unsigned int I;
+self unsigned long long L;
+
+#define FMT " %d"
+#define USE_FMT(f)
+
+#define TEST(x, y) \
+ self->x = -2; self->y = -3; printf(FMT, self->x + self->y); printf(FMT, self->y + self->x); \
+ self->x = -2; self->y = +3; printf(FMT, self->x + self->y); printf(FMT, self->y + self->x); \
+ self->x = +2; self->y = -3; printf(FMT, self->x + self->y); printf(FMT, self->y + self->x); \
+ self->x = +2; self->y = +3; printf(FMT, self->x + self->y); printf(FMT, self->y + self->x); printf("\n");
+
+BEGIN
+{
+ /* cast to signed char */
+ USE_FMT(" %hhd");
+ TEST(c, c)
+
+ /* cast to unsigned char */
+ USE_FMT(" %hhu");
+ TEST(C, c)
+ TEST(C, C)
+
+ /* cast to short */
+ USE_FMT(" %hd");
+ TEST(s, c)
+ TEST(s, C)
+ TEST(s, s)
+
+ /* cast to unsigned short */
+ USE_FMT(" %hu");
+ TEST(S, c)
+ TEST(S, C)
+ TEST(S, s)
+ TEST(S, S)
+
+ /* cast to int */
+ USE_FMT(" %d");
+ TEST(i, c)
+ TEST(i, C)
+ TEST(i, s)
+ TEST(i, S)
+ TEST(i, i)
+
+ /* cast to unsigned int */
+ USE_FMT(" %u");
+ TEST(I, c)
+ TEST(I, C)
+ TEST(I, s)
+ TEST(I, S)
+ TEST(I, i)
+ TEST(I, I)
+
+ /* cast to long long */
+ USE_FMT(" %lld");
+ TEST(l, c)
+ TEST(l, C)
+ TEST(l, s)
+ TEST(l, S)
+ TEST(l, i)
+ TEST(l, I)
+ TEST(l, l)
+
+ /* cast to unsigned long long */
+ USE_FMT(" %llu");
+ TEST(L, c)
+ TEST(L, C)
+ TEST(L, s)
+ TEST(L, S)
+ TEST(L, i)
+ TEST(L, I)
+ TEST(L, l)
+ TEST(L, L)
+
+ exit (0);
+}
diff --git a/test/unittest/arithmetic/tst.cast-add-tvar.r b/test/unittest/arithmetic/tst.cast-add-tvar.r
new file mode 100644
index 00000000..778b88e0
--- /dev/null
+++ b/test/unittest/arithmetic/tst.cast-add-tvar.r
@@ -0,0 +1,37 @@
+ -6 -6 6 6 -6 -6 6 6
+ 251 251 1 1 255 255 5 5
+ 250 250 6 6 250 250 6 6
+ -5 -5 1 1 -1 -1 5 5
+ 251 251 1 1 255 255 5 5
+ -6 -6 6 6 -6 -6 6 6
+ 65531 65531 1 1 65535 65535 5 5
+ 251 251 1 1 255 255 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ 65530 65530 6 6 65530 65530 6 6
+ -5 -5 1 1 -1 -1 5 5
+ 251 251 1 1 255 255 5 5
+ -5 -5 1 1 -1 -1 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ -6 -6 6 6 -6 -6 6 6
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ 251 251 1 1 255 255 5 5
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ 4294967290 4294967290 6 6 4294967290 4294967290 6 6
+ -5 -5 1 1 -1 -1 5 5
+ 251 251 1 1 255 255 5 5
+ -5 -5 1 1 -1 -1 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ -5 -5 1 1 -1 -1 5 5
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ -6 -6 6 6 -6 -6 6 6
+ 18446744073709551611 18446744073709551611 1 1 18446744073709551615 18446744073709551615 5 5
+ 251 251 1 1 255 255 5 5
+ 18446744073709551611 18446744073709551611 1 1 18446744073709551615 18446744073709551615 5 5
+ 65531 65531 1 1 65535 65535 5 5
+ 18446744073709551611 18446744073709551611 1 1 18446744073709551615 18446744073709551615 5 5
+ 4294967291 4294967291 1 1 4294967295 4294967295 5 5
+ 18446744073709551611 18446744073709551611 1 1 18446744073709551615 18446744073709551615 5 5
+ 18446744073709551610 18446744073709551610 6 6 18446744073709551610 18446744073709551610 6 6
+
diff --git a/test/unittest/arithmetic/tst.cast-imp-assoc.d b/test/unittest/arithmetic/tst.cast-imp-assoc.d
new file mode 100644
index 00000000..8b0cc24f
--- /dev/null
+++ b/test/unittest/arithmetic/tst.cast-imp-assoc.d
@@ -0,0 +1,95 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2022, 2023, 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: Integers are typecast correctly (implicit)
+ * when using associative arrays.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ */
+/* @@runtest-opts: -qC */
+
+signed char c[int], c0[int];
+short s[int], s0[int];
+int i[int], i0[int];
+long long l[int], l0[int];
+unsigned char C[int], C0[int];
+unsigned short S[int], S0[int];
+unsigned int I[int], I0[int];
+unsigned long long L[int], L0[int];
+
+#define FMT "%d %d %d %d %d %d %d %d\n"
+
+#define TEST(x) \
+ c[0] = (x); s[0] = (x); i[0] = (x); l[0] = (x); \
+ C[0] = (x); S[0] = (x); I[0] = (x); L[0] = (x); \
+ printf(FMT, c[0], s[0], i[0], l[0], C[0], S[0], I[0], L[0])
+
+BEGIN
+{
+ /* from scalar */
+ TEST(-2);
+ TEST(0xfffffffffffffffe);
+ TEST(0xfffffffe);
+ TEST(0xfffe);
+ TEST(0xfe);
+ TEST(2);
+ TEST(0x55);
+ TEST(0x5555);
+ TEST(0x55555555);
+ TEST(0x5555555555555555);
+
+ /* from signed char */
+ c0[0] = -2; TEST(c0[0]);
+ c0[0] = 0xfe; TEST(c0[0]);
+ c0[0] = 2; TEST(c0[0]);
+ c0[0] = 0x55; TEST(c0[0]);
+
+ /* from short */
+ s0[0] = -2; TEST(s0[0]);
+ s0[0] = 0xfffe; TEST(s0[0]);
+ s0[0] = 2; TEST(s0[0]);
+ s0[0] = 0x5555; TEST(s0[0]);
+
+ /* from int */
+ i0[0] = -2; TEST(i0[0]);
+ i0[0] = 0xfffffffe; TEST(i0[0]);
+ i0[0] = 2; TEST(i0[0]);
+ i0[0] = 0x55555555; TEST(i0[0]);
+
+ /* from long long */
+ l0[0] = -2; TEST(l0[0]);
+ l0[0] = 0xfffffffffffffffe; TEST(l0[0]);
+ l0[0] = 2; TEST(l0[0]);
+ l0[0] = 0x5555555555555555; TEST(l0[0]);
+
+ /* from unsigned char */
+ C0[0] = -2; TEST(C0[0]);
+ C0[0] = 0xfe; TEST(C0[0]);
+ C0[0] = 2; TEST(C0[0]);
+ C0[0] = 0x55; TEST(C0[0]);
+
+ /* from unsigned short */
+ S0[0] = -2; TEST(S0[0]);
+ S0[0] = 0xfffe; TEST(S0[0]);
+ S0[0] = 2; TEST(S0[0]);
+ S0[0] = 0x5555; TEST(S0[0]);
+
+ /* from unsigned int */
+ I0[0] = -2; TEST(I0[0]);
+ I0[0] = 0xfffffffe; TEST(I0[0]);
+ I0[0] = 2; TEST(I0[0]);
+ I0[0] = 0x55555555; TEST(I0[0]);
+
+ /* from unsigned long long */
+ L0[0] = -2; TEST(L0[0]);
+ L0[0] = 0xfffffffffffffffe; TEST(L0[0]);
+ L0[0] = 2; TEST(L0[0]);
+ L0[0] = 0x5555555555555555; TEST(L0[0]);
+
+ exit (0);
+}
diff --git a/test/unittest/arithmetic/tst.cast-imp-assoc.r b/test/unittest/arithmetic/tst.cast-imp-assoc.r
new file mode 100644
index 00000000..0ae3e3f1
--- /dev/null
+++ b/test/unittest/arithmetic/tst.cast-imp-assoc.r
@@ -0,0 +1,43 @@
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 4294967294 254 65534 4294967294 4294967294
+-2 -2 65534 65534 254 65534 65534 65534
+-2 254 254 254 254 254 254 254
+2 2 2 2 2 2 2 2
+85 85 85 85 85 85 85 85
+85 21845 21845 21845 85 21845 21845 21845
+85 21845 1431655765 1431655765 85 21845 1431655765 1431655765
+85 21845 1431655765 6148914691236517205 85 21845 1431655765 6148914691236517205
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 85 85 85 85 85 85 85
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 21845 21845 21845 85 21845 21845 21845
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 21845 1431655765 1431655765 85 21845 1431655765 1431655765
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 21845 1431655765 6148914691236517205 85 21845 1431655765 6148914691236517205
+-2 254 254 254 254 254 254 254
+-2 254 254 254 254 254 254 254
+2 2 2 2 2 2 2 2
+85 85 85 85 85 85 85 85
+-2 -2 65534 65534 254 65534 65534 65534
+-2 -2 65534 65534 254 65534 65534 65534
+2 2 2 2 2 2 2 2
+85 21845 21845 21845 85 21845 21845 21845
+-2 -2 -2 4294967294 254 65534 4294967294 4294967294
+-2 -2 -2 4294967294 254 65534 4294967294 4294967294
+2 2 2 2 2 2 2 2
+85 21845 1431655765 1431655765 85 21845 1431655765 1431655765
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 21845 1431655765 6148914691236517205 85 21845 1431655765 6148914691236517205
+
diff --git a/test/unittest/arithmetic/tst.cast-imp-tvar.d b/test/unittest/arithmetic/tst.cast-imp-tvar.d
new file mode 100644
index 00000000..e16f2e02
--- /dev/null
+++ b/test/unittest/arithmetic/tst.cast-imp-tvar.d
@@ -0,0 +1,95 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2022, 2023, 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: Integers are typecast correctly (implicit)
+ * when using thread-local variables.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ */
+/* @@runtest-opts: -qC -DUSE_AS_D_SCRIPT */
+
+self signed char c, c0;
+self short s, s0;
+self int i, i0;
+self long long l, l0;
+self unsigned char C, C0;
+self unsigned short S, S0;
+self unsigned int I, I0;
+self unsigned long long L, L0;
+
+#define FMT "%d %d %d %d %d %d %d %d\n"
+
+#define TEST(x) \
+ self->c = (x); self->s = (x); self->i = (x); self->l = (x); \
+ self->C = (x); self->S = (x); self->I = (x); self->L = (x); \
+ printf(FMT, self->c, self->s, self->i, self->l, self->C, self->S, self->I, self->L)
+
+BEGIN
+{
+ /* from scalar */
+ TEST(-2);
+ TEST(0xfffffffffffffffe);
+ TEST(0xfffffffe);
+ TEST(0xfffe);
+ TEST(0xfe);
+ TEST(2);
+ TEST(0x55);
+ TEST(0x5555);
+ TEST(0x55555555);
+ TEST(0x5555555555555555);
+
+ /* from signed char */
+ self->c0 = -2; TEST(self->c0);
+ self->c0 = 0xfe; TEST(self->c0);
+ self->c0 = 2; TEST(self->c0);
+ self->c0 = 0x55; TEST(self->c0);
+
+ /* from short */
+ self->s0 = -2; TEST(self->s0);
+ self->s0 = 0xfffe; TEST(self->s0);
+ self->s0 = 2; TEST(self->s0);
+ self->s0 = 0x5555; TEST(self->s0);
+
+ /* from int */
+ self->i0 = -2; TEST(self->i0);
+ self->i0 = 0xfffffffe; TEST(self->i0);
+ self->i0 = 2; TEST(self->i0);
+ self->i0 = 0x55555555; TEST(self->i0);
+
+ /* from long long */
+ self->l0 = -2; TEST(self->l0);
+ self->l0 = 0xfffffffffffffffe; TEST(self->l0);
+ self->l0 = 2; TEST(self->l0);
+ self->l0 = 0x5555555555555555; TEST(self->l0);
+
+ /* from unsigned char */
+ self->C0 = -2; TEST(self->C0);
+ self->C0 = 0xfe; TEST(self->C0);
+ self->C0 = 2; TEST(self->C0);
+ self->C0 = 0x55; TEST(self->C0);
+
+ /* from unsigned short */
+ self->S0 = -2; TEST(self->S0);
+ self->S0 = 0xfffe; TEST(self->S0);
+ self->S0 = 2; TEST(self->S0);
+ self->S0 = 0x5555; TEST(self->S0);
+
+ /* from unsigned int */
+ self->I0 = -2; TEST(self->I0);
+ self->I0 = 0xfffffffe; TEST(self->I0);
+ self->I0 = 2; TEST(self->I0);
+ self->I0 = 0x55555555; TEST(self->I0);
+
+ /* from unsigned long long */
+ self->L0 = -2; TEST(self->L0);
+ self->L0 = 0xfffffffffffffffe; TEST(self->L0);
+ self->L0 = 2; TEST(self->L0);
+ self->L0 = 0x5555555555555555; TEST(self->L0);
+
+ exit (0);
+}
diff --git a/test/unittest/arithmetic/tst.cast-imp-tvar.r b/test/unittest/arithmetic/tst.cast-imp-tvar.r
new file mode 100644
index 00000000..0ae3e3f1
--- /dev/null
+++ b/test/unittest/arithmetic/tst.cast-imp-tvar.r
@@ -0,0 +1,43 @@
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 4294967294 254 65534 4294967294 4294967294
+-2 -2 65534 65534 254 65534 65534 65534
+-2 254 254 254 254 254 254 254
+2 2 2 2 2 2 2 2
+85 85 85 85 85 85 85 85
+85 21845 21845 21845 85 21845 21845 21845
+85 21845 1431655765 1431655765 85 21845 1431655765 1431655765
+85 21845 1431655765 6148914691236517205 85 21845 1431655765 6148914691236517205
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 85 85 85 85 85 85 85
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 21845 21845 21845 85 21845 21845 21845
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 21845 1431655765 1431655765 85 21845 1431655765 1431655765
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 21845 1431655765 6148914691236517205 85 21845 1431655765 6148914691236517205
+-2 254 254 254 254 254 254 254
+-2 254 254 254 254 254 254 254
+2 2 2 2 2 2 2 2
+85 85 85 85 85 85 85 85
+-2 -2 65534 65534 254 65534 65534 65534
+-2 -2 65534 65534 254 65534 65534 65534
+2 2 2 2 2 2 2 2
+85 21845 21845 21845 85 21845 21845 21845
+-2 -2 -2 4294967294 254 65534 4294967294 4294967294
+-2 -2 -2 4294967294 254 65534 4294967294 4294967294
+2 2 2 2 2 2 2 2
+85 21845 1431655765 1431655765 85 21845 1431655765 1431655765
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+-2 -2 -2 -2 254 65534 4294967294 18446744073709551614
+2 2 2 2 2 2 2 2
+85 21845 1431655765 6148914691236517205 85 21845 1431655765 6148914691236517205
+
--
2.18.4
More information about the DTrace-devel
mailing list