CertainLach/jrsonnet

gcmodule: assertion failed: `(left == right)` left: `44`, right: `48` on 32-bit platforms

messense opened this issue · 5 comments

thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `44`,
 right: `48`', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/jrsonnet-gcmodule-0.3.4/src/cc.rs:180:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

https://github.com/CertainLach/gcmodule/blob/91ce25395b630a54d1c3c6ccd620d9bc9ca9b069/src/cc.rs#L180-L183

In release mode, this or something else causes segfault.

On 32-bit Windows: Windows fatal exception: access violation

That's interesting, seems like rustc decided to use some weird alignment on Gc structure

I can't reproduce this issue on either i686-unknown-linux-gnu or i686-pc-windows-gnu using jrsonnet own test suite (cargo test --workspace)
Can you please provide me more context? File, on which jrsonnet fails, or maybe reproducing code?

I think specifying alignment on RawCcBoxWithGcHeader may help:

- #[repr(C)]
+ #[repr(C, align(4))] // Wrapped in #[cfg_attr] for x32
  pub struct RawCcBoxWithGcHeader<T: ?Sized, O: AbstractObjectSpace> {

I think specifying alignment on RawCcBoxWithGcHeader may help:

https://github.com/messense/gcmodule/commit/622f6665dd7fc20d9ec75cd76bbed5a9bd67a1cc

Doesn't seem to work? https://github.com/messense/rjsonnet-py/actions/runs/3966464324/jobs/6797293150#step:5:97

Can you please provide me more context? File, on which jrsonnet fails, or maybe reproducing code?

I'm trying to get a meaningful stack trace, no luck yet.

Edit: I was able to reproduce this issue, and have developed a fix for it.

Thanks! I've verified that most of them are fixed, there is another assertion failure on Windows x86, opened #98.