diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-08-14 23:14:38 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-08-14 23:14:38 +0200 |
| commit | 33ae72a3c73f6219be86715e8da71ed345f6077c (patch) | |
| tree | 1c6c98be816508e9231fa1ada3f79ec940ab1cf1 /boot/materialization.cc | |
| parent | d696abc97143061bf2abb05922188e12b59306c1 (diff) | |
| download | elna-33ae72a3c73f6219be86715e8da71ed345f6077c.tar.gz | |
Map Int and Word to hardware word sizes
Diffstat (limited to 'boot/materialization.cc')
| -rw-r--r-- | boot/materialization.cc | 20 |
1 files changed, 18 insertions, 2 deletions
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<materialization_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<materialization_error>(literal->position()); } break; + } case _unsigned: + if (!literal->has_explicit_size + && !literal->value.fit_into(false, target.word_properties.front().size)) + { + add_error<materialization_error>(literal->position()); + } break; } } |
