From 33ae72a3c73f6219be86715e8da71ed345f6077c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 14 Aug 2026 23:14:38 +0200 Subject: Map Int and Word to hardware word sizes --- boot/materialization.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'boot/materialization.cc') diff --git a/boot/materialization.cc b/boot/materialization.cc index e055dfd..8c436b3 100644 --- a/boot/materialization.cc +++ b/boot/materialization.cc @@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see namespace elna::boot { materialization_error::materialization_error(const source_position position) - : error(position) + : diagnostic(position) { } @@ -43,6 +43,11 @@ namespace elna::boot if (auto negated_literal = literal->value.negate()) { literal->value = negated_literal.value(); + if (!literal->has_explicit_size + && !literal->value.fit_into(true, target.int_properties.front().size)) + { + add_error(literal->position()); + } } else { @@ -50,12 +55,23 @@ namespace elna::boot } break; case unmarked: - if (!literal->value.fit_into(true, literal->value.size())) + { + const auto target_size = literal->has_explicit_size + ? literal->value.size() + : target.int_properties.front().size; + + if (!literal->value.fit_into(true, target_size)) { add_error(literal->position()); } break; + } case _unsigned: + if (!literal->has_explicit_size + && !literal->value.fit_into(false, target.word_properties.front().size)) + { + add_error(literal->position()); + } break; } } -- cgit v1.2.3