Compiler Error: var_stack_offs

Hi folks,

I am running into a compiler and have difficulties reproducing a smaller example. In the meantime I am posting this error if anyone already knows what’s the problem:

thread 'main' panicked at 'assertion failed: var_stack_offs <= compiler_constants::TWELVE_BITS', sway-core/src/asm_generation/fuel/functions.rs:700:13
stack backtrace:
   0:        0x1019cf5ac - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3c406a4521928e59
   1:        0x1019ebdf8 - core::fmt::write::hc60df9bae744c40c
   2:        0x1019cb800 - <std::io::Guard as core::ops::drop::Drop>::drop::hd1119ab4bcc45dfd
   3:        0x1019cf3c0 - std::time::SystemTime::checked_add::h63ee564337d5d7b7
   4:        0x1019d0bd8 - std::panicking::default_hook::hd2988fbcc86fdc46
   5:        0x1019d0930 - std::panicking::default_hook::hd2988fbcc86fdc46
   6:        0x1019d11fc - std::panicking::rust_panic_with_hook::h01730ad11d62092c
   7:        0x1019d0fdc - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h978adec8182eb460
   8:        0x1019cfa14 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3c406a4521928e59
   9:        0x1019d0d78 - _rust_begin_unwind
  10:        0x101a434d4 - core::panicking::panic_fmt::hf1070b3fc33229fa
  11:        0x101a43544 - core::panicking::panic::h5140de40daf56c24
  12:        0x1016a9a84 - <sway_core::asm_generation::fuel::fuel_asm_builder::FuelAsmBuilder as sway_core::asm_generation::asm_builder::AsmBuilder>::finalize::h4a7a8eb8c460c20c
  13:        0x10139f2a4 - sway_core::asm_generation::from_ir::compile_ir_to_asm::h1b03f7dd558d7f07
  14:        0x101576948 - sway_core::ast_to_asm::h72e623870c0add8f
  15:        0x1010f310c - forc_pkg::pkg::compile::h952c98da1c3fb9ba
  16:        0x1010f7a50 - forc_pkg::pkg::build::h4eb29cb96f711f17
  17:        0x1010f5260 - forc_pkg::pkg::build_with_options::h8c0a662cc281c6bb
  18:        0x100f6f448 - forc::ops::forc_build::build::h323a8cfeeca20de4
  19:        0x100fa0e74 - forc::cli::commands::build::exec::h3a2fe952e4a0950b
  20:        0x100f2aca8 - __mh_execute_header
  21:        0x100f34680 - __mh_execute_header
  22:        0x100f33134 - __mh_execute_header
  23:        0x100f331b8 - __mh_execute_header
  24:        0x1019c4f8c - std::rt::lang_start_internal::h24d09c16ec322e75
  25:        0x100f3489c - _main

Here is the line return the error in the Sway repo: sway/functions.rs at 59919b440eb1c861579cf0b021eaa7fa04341e25 · FuelLabs/sway · GitHub

forc: 0.37.1 and running RUST_BACKTRACE=full forc build

2 Likes

To reproduce:

1 Like

Do tell if you can find a smaller example. In the meantime it’s already being investigated here: Compiler panics with compiler_constants::TWELVE_BITS · Issue #4450 · FuelLabs/sway · GitHub

1 Like

hello there,

i got this issue when input ur contract

Error: Response errors; InputInvalidSignature { index: 0 }

This looks to be fixed in 0.38.0, I can no longer reproduce this error.

1 Like

i can’t compile the contract. but, when i remove ‘let val = storage.my_storagemap.get(key1).unwrap();’
remove unwrap only, it worked. but, i can invalid signature error

1 Like

getting this error
21 | let key1: b256 = key2 >> 8;
22 | let val = storage.my_storagemap.get(key1).unwrap();
| ^^^^^^ No method named “unwrap” found for type “StorageKey”.

Alright, now it should be fixed with this: Allow more than 12b (up to 18b now) stack offsets for local initialization by vaivaswatha · Pull Request #4515 · FuelLabs/sway · GitHub which will be in the next release.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.