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

[ICE] Newline in string #495

Open
pythongirl325 opened this issue Aug 8, 2020 · 0 comments
Open

[ICE] Newline in string #495

pythongirl325 opened this issue Aug 8, 2020 · 0 comments
Labels
fuzz Found via fuzz testing ICE Internal Compiler Error (panic) lexer Issue dealing with parsing the lexical tokens of a program

Comments

@pythongirl325
Copy link
Collaborator

I think you are incorrectly checking how to handle newlines in strings. Should be pretty easy to fix.

Code

a="\\
x"

Expected behavior

Some errors about how the newline is incorrect I think

Backtrace
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/swcc --color=never test.c`
The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: NewlineInString
Location: src/lex/mod.rs:1048

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                              ⋮ 6 frames hidden ⋮                               
 7: core::result::Result<T,E>::unwrap::hd66ef19e0f7f59d8
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/result.rs:1005
 8: saltwater::lex::<impl saltwater::data::lex::LiteralToken>::parse::{{closure}}::h3345e733c5644260
    at /home/gis/code/saltwater/src/lex/mod.rs:1048
 9: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once::h3007bb5ae4c51e14
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:285
10: core::option::Option<T>::map::hab2f436146429123
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/option.rs:456
11: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::next::h942cda433d4d6b2c
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/iter/adapters/mod.rs:805
12: <core::iter::adapters::fuse::Fuse<I> as core::iter::adapters::fuse::FuseImpl<I>>::next::hc1993fad8bcc23ea
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/iter/adapters/fuse.rs:403
13: <core::iter::adapters::fuse::Fuse<I> as core::iter::traits::iterator::Iterator>::next::h17c2084c02c0559a
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/iter/adapters/fuse.rs:69
14: <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::next::hc467cd4edc4a6043
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/iter/adapters/flatten.rs:272
15: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next::h1989ed8ecca54b80
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/iter/adapters/flatten.rs:55
16: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::h78d22dc77c8c11fd
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc/vec.rs:2069
17: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter::h59fb46d0c777f78e
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/liballoc/vec.rs:1981
18: core::iter::traits::iterator::Iterator::collect::h7b04d7e743695669
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/iter/traits/iterator.rs:1660
19: saltwater::lex::<impl saltwater::data::lex::LiteralToken>::parse::h0686bad9d6a474c4
    at /home/gis/code/saltwater/src/lex/mod.rs:1044
20: saltwater::parse::expr::<impl saltwater::parse::Parser<I>>::primary_expr::hcfcc25806583f061
    at /home/gis/code/saltwater/src/parse/expr.rs:264
21: saltwater::parse::expr::<impl saltwater::parse::Parser<I>>::unary_expr::h1c65181a0523844e
    at /home/gis/code/saltwater/src/parse/expr.rs:235
22: saltwater::parse::expr::<impl saltwater::parse::Parser<I>>::custom_expr::hd4946a00c877df06
    at /home/gis/code/saltwater/src/parse/expr.rs:134
23: saltwater::parse::expr::<impl saltwater::parse::Parser<I>>::assignment_expr::hba24ea6d93e799ba
    at /home/gis/code/saltwater/src/parse/expr.rs:127
24: saltwater::parse::decl::<impl saltwater::parse::Parser<I>>::initializer::h3ac02ec66c091314
    at /home/gis/code/saltwater/src/parse/decl.rs:654
25: saltwater::parse::decl::<impl saltwater::parse::Parser<I>>::init_declarator::hd8bbe79dd1104369
    at /home/gis/code/saltwater/src/parse/decl.rs:351
26: saltwater::parse::decl::<impl saltwater::parse::Parser<I>>::external_declaration::h2157a6c70b729e05
    at /home/gis/code/saltwater/src/parse/decl.rs:58
27: <saltwater::parse::Parser<I> as core::iter::traits::iterator::Iterator>::next::h01b34dec7d042a69
    at /home/gis/code/saltwater/src/parse/mod.rs:119
28: <saltwater::analyze::Analyzer<T> as core::iter::traits::iterator::Iterator>::next::hb7aae02eae7cfe74
    at /home/gis/code/saltwater/src/analyze/mod.rs:95
29: <&mut I as core::iter::traits::iterator::Iterator>::next::h6ccd91b5947a96bc
    at /home/gis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/iter/traits/iterator.rs:3258
30: saltwater::check_semantics::ha40a786b537cf457
    at /home/gis/code/saltwater/src/lib.rs:240
31: saltwater::compile::hf9937d5e5682c4bb
    at /home/gis/code/saltwater/src/lib.rs:271
32: swcc::aot_main::h6585910bd9a711ec
    at /home/gis/code/saltwater/src/main.rs:172
33: swcc::real_main::h4a7b3b4b2e8a6631
    at /home/gis/code/saltwater/src/main.rs:161
34: swcc::main::h680d2fa7efb5314a
    at /home/gis/code/saltwater/src/main.rs:273
                              ⋮ 10 frames hidden ⋮                              
@pythongirl325 pythongirl325 added lexer Issue dealing with parsing the lexical tokens of a program ICE Internal Compiler Error (panic) fuzz Found via fuzz testing labels Aug 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fuzz Found via fuzz testing ICE Internal Compiler Error (panic) lexer Issue dealing with parsing the lexical tokens of a program
Projects
None yet
Development

No branches or pull requests

1 participant