solang icon indicating copy to clipboard operation
solang copied to clipboard

[ICE]: Assigning a function pointer to a function pointer in a struct causes an error.

Open Subway2023 opened this issue 10 months ago • 0 comments

Version: v0.3.3: v0.3.3-70-g32a45ea1 Description: Solc can compile normally. The error location in the source code can be found at the link.

contract Test {
    struct FuncStruct {
        function () external func;
    }

    function test(function() external f) public pure {
        FuncStruct memory s;
        s.func = f;
    }
}
thread 'main' panicked at src/abi/anchor.rs:451:18:
internal error: entered unreachable code: Type should not be in the IDL
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7608018cbdac9e55d0d13529cf43adc33d53efcf/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/7608018cbdac9e55d0d13529cf43adc33d53efcf/library/core/src/panicking.rs:74:14
   2: solang::abi::anchor::TypeManager::convert
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/abi/anchor.rs:451:18
   3: solang::abi::anchor::TypeManager::add_struct_definition
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/abi/anchor.rs:314:21
   4: solang::abi::anchor::TypeManager::convert
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/abi/anchor.rs:421:17
   5: solang::abi::anchor::TypeManager::convert
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/abi/anchor.rs:448:17
   6: solang::abi::anchor::idl_instructions
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/abi/anchor.rs:160:21
   7: solang::abi::anchor::generate_anchor_idl
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/abi/anchor.rs:52:24
   8: solang::abi::generate_abi
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/abi/mod.rs:40:23
   9: solang::contract_results
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/bin/solang.rs:462:13
  10: solang::compile
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/bin/solang.rs:272:17
  11: solang::main
             at /mnt/sdd1/sbw/crossCompilerFuzz/compiler/solang/src/bin/solang.rs:59:13
  12: core::ops::function::FnOnce::call_once
             at /root/.rustup/toolchains/nightly-2024-09-30-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Subway2023 avatar Mar 10 '25 08:03 Subway2023