Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Crashes in release mode, runs in debug mode #6

Open
ckaran opened this issue Nov 18, 2020 · 0 comments
Open

Crashes in release mode, runs in debug mode #6

ckaran opened this issue Nov 18, 2020 · 0 comments
Assignees

Comments

@ckaran
Copy link

ckaran commented Nov 18, 2020

I just ran across this library, and threw together a quick test by creating a new project and copying over the code in tests/test.rs. My entire project can be summed up as follows:

Cargo.toml:

[package]
name = "frenetic_experiments"
version = "0.1.0"
authors = ["Cem Karan <[email protected]>"]
edition = "2018"

[dependencies]
frenetic = {version = "0.1.0"}

main.rs

use frenetic::*;

fn basic() {
    #[inline(never)]
    fn inner(cnt: &mut usize, ctx: &mut Context) {
        if ctx.save() {
            *cnt += 1;
            unsafe { ctx.load() }
        } else {
            *cnt += 1;
        }

        Context::wipe();
    }

    let mut ctx = Context::default();
    let mut cnt = 0usize;

    inner(&mut cnt, &mut ctx);
    assert_eq!(cnt, 2);
}

fn main() {
    basic()
}

When I run this with cargo +nightly run, it runs fine, but when I run cargo +nightly run --release, I get the following:

$ cargo +nightly run --release -vvv
   Compiling frenetic v0.1.0
     Running `CARGO=/home/cfkaran2/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=frenetic CARGO_MANIFEST_DIR=/home/cfkaran2/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/frenetic-0.1.0 CARGO_PKG_AUTHORS='Nathaniel McCallum <[email protected]>' CARGO_PKG_DESCRIPTION='Tools for CPU context switching' CARGO_PKG_HOMEPAGE='https://github.com/enarx/frenetic' CARGO_PKG_LICENSE=Apache-2.0 CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=frenetic CARGO_PKG_REPOSITORY='https://github.com/enarx/frenetic' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/cfkaran2/Documents/repositories/experiments/frenetic_experiments/target/release/deps:/home/cfkaran2/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/cfkaran2/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib' rustc --crate-name frenetic --edition=2018 /home/cfkaran2/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/frenetic-0.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=0c9b8dade9b94732 -C extra-filename=-0c9b8dade9b94732 --out-dir /home/cfkaran2/Documents/repositories/experiments/frenetic_experiments/target/release/deps -L dependency=/home/cfkaran2/Documents/repositories/experiments/frenetic_experiments/target/release/deps --cap-lints warn`
error: could not compile `frenetic`

Caused by:
  process didn't exit successfully: `CARGO=/home/cfkaran2/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=frenetic CARGO_MANIFEST_DIR=/home/cfkaran2/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/frenetic-0.1.0 CARGO_PKG_AUTHORS='Nathaniel McCallum <[email protected]>' CARGO_PKG_DESCRIPTION='Tools for CPU context switching' CARGO_PKG_HOMEPAGE='https://github.com/enarx/frenetic' CARGO_PKG_LICENSE=Apache-2.0 CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=frenetic CARGO_PKG_REPOSITORY='https://github.com/enarx/frenetic' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/cfkaran2/Documents/repositories/experiments/frenetic_experiments/target/release/deps:/home/cfkaran2/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/cfkaran2/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib' rustc --crate-name frenetic --edition=2018 /home/cfkaran2/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/frenetic-0.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=0c9b8dade9b94732 -C extra-filename=-0c9b8dade9b94732 --out-dir /home/cfkaran2/Documents/repositories/experiments/frenetic_experiments/target/release/deps -L dependency=/home/cfkaran2/Documents/repositories/experiments/frenetic_experiments/target/release/deps --cap-lints warn` (signal: 11, SIGSEGV: invalid memory reference)

Meta

lsb_release -a:
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic

uname -a:
Linux Hammer 5.4.0-53-generic #59~18.04.1-Ubuntu SMP Wed Oct 21 12:14:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

rustc -vV:
rustc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-unknown-linux-gnu
release: 1.47.0
LLVM version: 11.0

cargo -vV:
cargo 1.47.0 (f3c7e066a 2020-08-28)
release: 1.47.0
commit-hash: f3c7e066ad66e05439cf8eab165a2de580b41aaf
commit-date: 2020-08-28

rustc +beta -vV:
rustc 1.48.0-beta.8 (121901459 2020-11-08)
binary: rustc
commit-hash: 1219014599fd873fcb640b675d8a662150c74e40
commit-date: 2020-11-08
host: x86_64-unknown-linux-gnu
release: 1.48.0-beta.8
LLVM version: 11.0

cargo +beta -vV:
cargo 1.48.0-beta (65cbdd2dc 2020-10-14)
release: 1.48.0
commit-hash: 65cbdd2dc0b7e877577474b98b7d071308d0bb6f
commit-date: 2020-10-14

rustc +nightly -vV:
rustc 1.49.0-nightly (9722952f0 2020-11-12)
binary: rustc
commit-hash: 9722952f0bed5815cb22cb4878be09fb39f92804
commit-date: 2020-11-12
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly

cargo +nightly -vV:
cargo 1.49.0-nightly (d5556aeb8 2020-11-04)
release: 1.49.0
commit-hash: d5556aeb8405b1fe696adb6e297ad7a1f2989b62
commit-date: 2020-11-04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants