Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statement assignment assert failing #95

Closed
nchong-at-aws opened this issue Apr 22, 2021 · 3 comments · Fixed by #1205
Closed

Statement assignment assert failing #95

nchong-at-aws opened this issue Apr 22, 2021 · 3 comments · Fixed by #1205
Assignees
Labels
[C] Bug This is a bug. Something isn't working. [F] Soundness Kani failed to detect an issue

Comments

@nchong-at-aws
Copy link
Contributor

There are two cases where the assert in gotoc statement assignment is failing [0]

  1. When the types are wrapped (e.g. in a Cell) array types when one has an explicit length (e.g., [T;N]) and the other is inferred ([T;_]). E.g.: StructTag("tag-std::cell::RefCell<[bool; 16]>") and StructTag("tag-std::cell::RefCell<[bool; _]>")

  2. When the types are closures. E.g., Pointer { typ: StructTag("tag-[closure@file.rs:536:13: 546:14]") } and Pointer { typ: StructTag("tag-[closure@file.rs:503:13: 509:14]") }

The root cause is the naming of these symbol associated with these types.

[0] https://github.com/model-checking/rmc/blob/main-151-2021-04-16/compiler/rustc_codegen_llvm/src/gotoc/cbmc/goto_program/stmt.rs#L153

@nchong-at-aws nchong-at-aws added the [C] Bug This is a bug. Something isn't working. label Apr 22, 2021
nchong-at-aws added a commit that referenced this issue Apr 27, 2021
adpaco-aws added a commit that referenced this issue May 4, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue May 5, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue May 10, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue May 26, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Jun 1, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Jun 7, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Jun 17, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Jun 23, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
@avanhatt avanhatt self-assigned this Jun 29, 2021
adpaco-aws added a commit that referenced this issue Jul 2, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Jul 9, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Jul 15, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Jul 26, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Aug 2, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Aug 6, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Aug 17, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
adpaco-aws added a commit that referenced this issue Aug 24, 2021
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
celinval pushed a commit to celinval/kani-dev that referenced this issue Oct 6, 2021
* Fix count trailing zeroes
* Fix pop count
* Fix bit reverse
celinval pushed a commit to celinval/kani-dev that referenced this issue Nov 16, 2021
@avanhatt
Copy link
Contributor

Is this resolved by #496 ?

@adpaco-aws
Copy link
Contributor

Just tried to enable the type-checking assertion and it fails the standard library test:

Starting RMC codegen for the Rust standard library...

     Created library `std_lib_test` package
Starting cargo build with RMC
   Compiling compiler_builtins v0.1.55
   Compiling core v0.0.0 (/home/ubuntu/rmc-dash/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.108
   Compiling cc v1.0.69
   Compiling memchr v2.4.1
   Compiling std v0.0.0 (/home/ubuntu/rmc-dash/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/std)
   Compiling unwind v0.0.0 (/home/ubuntu/rmc-dash/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/unwind)
   Compiling rustc-std-workspace-core v1.99.0 (/home/ubuntu/rmc-dash/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/ubuntu/rmc-dash/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/alloc)
   Compiling cfg-if v0.1.10
   Compiling adler v0.2.3
   Compiling rustc-demangle v0.1.21
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Pointer { typ: StructTag("tag-_5015814172080081019") }`,
 right: `Pointer { typ: StructTag("tag-_12664537782996255021") }`', compiler/cbmc/src/goto_program/stmt.rs:157:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.59.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z force-unstable-if-unmarked -Z codegen-backend=gotoc -Z trim-diagnostic-paths=no -Z human_readable_cgu_names -C embed-bitcode=no -C debuginfo=2 -C overflow-checks=on --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

[RMC] current codegen item: codegen_function: <rustc_std_workspace_core::iter::Peekable<I> as rustc_std_workspace_core::iter::Iterator>::next
_ZN108_$LT$core..iter..adapters..peekable..Peekable$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$4next17heda63757b9a33924E
[RMC] current codegen location: Loc { file: "/home/ubuntu/rmc-dash/library/core/src/iter/adapters/peekable.rs", function: None, line: 36, col: Some(5) }

RMC unexpectedly panicked during code generation.

If you are seeing this message, please file an issue here instead of on the Rust compiler: https://github.com/model-checking/rmc/issues/new?labels=bug&template=bug_report.md
error: could not compile `rustc-demangle`
warning: build failed, waiting for other jobs to finish...
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `StructTag("tag-_16610526870762658295")`,
 right: `StructTag("tag-_13428073055387301367")`', compiler/cbmc/src/goto_program/stmt.rs:157:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.59.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z force-unstable-if-unmarked -Z codegen-backend=gotoc -Z trim-diagnostic-paths=no -Z human_readable_cgu_names -C embed-bitcode=no -C debuginfo=2 -C overflow-checks=on --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

[RMC] current codegen item: codegen_function: iter::adapters::flatten::FlatMap::<I, U, F>::new
_ZN4core4iter8adapters7flatten24FlatMap$LT$I$C$U$C$F$GT$3new17h5457415d685bef8eE
[RMC] current codegen location: Loc { file: "/home/ubuntu/rmc-dash/library/core/src/iter/adapters/flatten.rs", function: None, line: 17, col: Some(5) }

RMC unexpectedly panicked during code generation.

If you are seeing this message, please file an issue here instead of on the Rust compiler: https://github.com/model-checking/rmc/issues/new?labels=bug&template=bug_report.md
error: build failed
Command exited with non-zero status 101
        Command being timed: "cargo +nightly build -Z build-std --lib --target x86_64-unknown-linux-gnu"
        User time (seconds): 54.99
        System time (seconds): 6.19
        Percent of CPU this job got: 140%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:43.41
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 933320
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 61
        Minor (reclaiming a frame) page faults: 542492
        Voluntary context switches: 3191
        Involuntary context switches: 198
        Swaps: 0
        File system inputs: 0
        File system outputs: 308352
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 101

real    0m43.840s
user    0m55.197s
sys     0m6.363s

@danielsn
Copy link
Contributor

Looks like this is related to the projection issue Celina is looking into

@danielsn danielsn assigned celinval and unassigned avanhatt Mar 24, 2022
@celinval celinval added [F] Soundness Kani failed to detect an issue Status: Mitigated and removed Soundness: Medium labels Apr 20, 2022
tedinski pushed a commit to tedinski/rmc that referenced this issue Apr 22, 2022
)

* Workaround for issue model-checking#95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
tedinski pushed a commit to tedinski/rmc that referenced this issue Apr 25, 2022
)

* Workaround for issue model-checking#95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
tedinski pushed a commit to tedinski/rmc that referenced this issue Apr 26, 2022
)

* Workaround for issue model-checking#95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
tedinski pushed a commit that referenced this issue Apr 27, 2022
* Workaround for issue #95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
danielsn pushed a commit to danielsn/kani that referenced this issue May 11, 2022
)

* Workaround for issue model-checking#95

* Print types in assert statement

Co-authored-by: Nathan Chong <ncchong@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working. [F] Soundness Kani failed to detect an issue
Projects
None yet
6 participants