Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

[ICE] crash on multiply in sizeof() #242

Closed
jyn514 opened this issue Feb 4, 2020 · 1 comment · Fixed by #327
Closed

[ICE] crash on multiply in sizeof() #242

jyn514 opened this issue Feb 4, 2020 · 1 comment · Fixed by #327
Labels
bug Something isn't working good first issue Good for newcomers ICE Internal Compiler Error (panic)

Comments

@jyn514
Copy link
Owner

jyn514 commented Feb 4, 2020

Expected behavior
RCC gives an error saying the array is too large.

Actual Behavior
RCC crashes with overflow.

Code

char h[][3U-3827228678929574271][3] = {{4,5,6}};
The application panicked (crashed).
Message:  attempt to multiply with overflow
Backtrace
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                          (6 post panic frames hidden)                          
 6: core::panicking::panic::ha556f2c3753f3759
    at src/libcore/panicking.rs:70
 7: <u64 as core::ops::arith::Mul>::mul::h5181c21b5c178bc2
    at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14/src/libcore/ops/arith.rs:318
 8: <u64 as core::ops::arith::Mul<&u64>>::mul::h1d1276c4c74de715
    at src/lib.rs:1
 9: rcc::arch::<impl rcc::data::types::Type>::sizeof::{{closure}}::hed6dc419ce36a058
    at src/arch/mod.rs:74
10: core::result::Result<T,E>::and_then::haa7997835743a121
    at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14/src/libcore/result.rs:691
11: rcc::arch::<impl rcc::data::types::Type>::sizeof::h82206b81eeb141c1
    at src/arch/mod.rs:74
12: rcc::arch::<impl rcc::data::types::Type>::sizeof::h82206b81eeb141c1
    at src/arch/mod.rs:74
13: rcc::ir::static_init::<impl rcc::ir::Compiler>::store_static::had90360549edd56e
    at src/ir/static_init.rs:77
14: rcc::ir::compile::haeb8251a574ff20c
    at src/ir/mod.rs:89
15: rcc::compile::h87633814d689a39f
    at src/lib.rs:98
16: rcc::real_main::h1dd2cb989e6fa0d8
    at src/main.rs:101
17: rcc::main::h396b827397690aa0
    at src/main.rs:169
                        (10 runtime init frames hidden)
@jyn514 jyn514 added bug Something isn't working ICE Internal Compiler Error (panic) labels Feb 4, 2020
@jyn514
Copy link
Owner Author

jyn514 commented Feb 26, 2020

Instructions:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers ICE Internal Compiler Error (panic)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant