summaryrefslogtreecommitdiff
path: root/tests/cell-overflow-results.dts
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-11-21 14:18:44 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2022-11-21 14:18:44 +1100
commit2cd89f862cdb04d91c5d59c5b39647f7d5d5b3b8 (patch)
tree31fc5b4e943cb36db308bd2c3b2eed6e348a1de3 /tests/cell-overflow-results.dts
parent55778a03df61623ddd743b04772ab90ce128db61 (diff)
downloaddevice-tree-compiler-2cd89f862cdb04d91c5d59c5b39647f7d5d5b3b8.tar.gz
dtc: Warning rather than error on possible truncation of cell values
We always evaluate integer values in cell arrays as 64-bit quantities, then truncate to the size of the array cells (32-bit by default). However to detect accidental truncation of meaningful values, we give an error if the truncated portion isn't either all 0 or all 1 bits. However, this can still give counterintuitive errors. For if the user is thinking in 2's complement 32-bit arithmetic (which would be quite natural), then they'd expect the expression (-0xffffffff-2) to evaluate to -1 (0xffffffff). However in 64-bit it evaluates to 0xfffffffeffffffff which does truncate to the expected value but trips this error message. Because of this reduce the error to only a warnings, with a somewhat more helpful message. Fixes: https://github.com/dgibson/dtc/issues/74 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/cell-overflow-results.dts')
-rw-r--r--tests/cell-overflow-results.dts7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/cell-overflow-results.dts b/tests/cell-overflow-results.dts
new file mode 100644
index 0000000..e7f6dad
--- /dev/null
+++ b/tests/cell-overflow-results.dts
@@ -0,0 +1,7 @@
+/dts-v1/;
+
+/ {
+ prop1 = < 0 >;
+ prop2 = < 0xffffffff >;
+ prop3 = < 0 >;
+};