Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[ICE] crash on nested functions #396

Open
jyn514 opened this issue May 1, 2020 · 0 comments
Open

[ICE] crash on nested functions #396

jyn514 opened this issue May 1, 2020 · 0 comments
Labels
analyzer Issue with semantic analysis fuzz Found via fuzz testing ICE Internal Compiler Error (panic)

Comments

@jyn514
Copy link
Owner

jyn514 commented May 1, 2020

Code

int f(void) {
    typedef unsigned long long int __uint64_t;
    void __bswap_16 (void) { }
    void __bswap_32 (void) {
      return;
    }
    void __bswap_64 (__uint64_t);
}
The application panicked (crashed).
Message:  scope of parser and analyzer should match
Location: src/analyze/mod.rs:386

Expected behavior

This should be a semantic error (can't declare functions except at global scope). gcc decides to make it a gnu extension, though.

Backtrace
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                          (5 post panic frames hidden)                          
 5: core::option::expect_failed::h9a8bff6ff005b30d
    at src/libcore/option.rs:1203
 6: core::option::Option<T>::expect::h1a1f9ace55b0e81d
    at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libcore/option.rs:347
 7: rcc::analyze::Analyzer<I>::parse_specifiers::he3632e7f44645051
    at src/analyze/mod.rs:386
 8: rcc::analyze::Analyzer<I>::parse_type::he103b6aded2e70d2
    at src/analyze/mod.rs:237
 9: rcc::analyze::Analyzer<I>::parse_declarator::h0086950b5f57b0b2
    at src/analyze/mod.rs:876
10: rcc::analyze::Analyzer<I>::parse_declaration::h0ea918c832d82f98
    at src/analyze/mod.rs:154
11: rcc::analyze::Analyzer<I>::parse_external_declaration::h5c5e0e8c54fe0563
    at src/analyze/mod.rs:133
12: <rcc::analyze::Analyzer<T> as core::iter::traits::iterator::Iterator>::next::h16b23d19e6871c02
    at src/analyze/mod.rs:77
13: <&mut I as core::iter::traits::iterator::Iterator>::next::h848395963bfe8aed
    at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libcore/iter/traits/iterator.rs:3234
14: rcc::check_semantics::hd31cdd4033b22724
    at src/lib.rs:193
15: rcc::compile::h7e7691f880c5ebf4
    at /home/joshua/src/rust/rcc/src/lib.rs:218
16: rcc::aot_main::h8def1ca0324b8884
    at src/main.rs:134
17: rcc::real_main::h192812ffe776ee2f
    at src/main.rs:122
18: rcc::main::hc67a23664e8d7b5c
    at src/main.rs:200
                        (12 runtime init frames hidden)  
@jyn514 jyn514 added ICE Internal Compiler Error (panic) analyzer Issue with semantic analysis fuzz Found via fuzz testing labels May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
analyzer Issue with semantic analysis fuzz Found via fuzz testing ICE Internal Compiler Error (panic)
Projects
None yet
Development

No branches or pull requests

1 participant