Skip to content

Invalid Memory Reference on --release builds (only) #73

Closed
@jramapuram

Description

@jramapuram

Note: This happens only with cargo run --release

extern crate arrayfire as af;

use af::{Array, Dim4, DType};

pub fn assert_types(v: Vec<&Array>){
  let base_type = v[0].get_type();
  for i in 1..v.len() {
    let cur_type = v[i].get_type();
    assert!(cur_type == base_type
            , "type mismatch detected: {:?} vs {:?}"
            , cur_type, base_type);
  }
}

fn main() {
  for _ in 0..100000 {
    let a = af::constant(3.0f32, Dim4::new(&[128, 128, 1, 1]));
    let b =  af::constant(3.0f32, Dim4::new(&[128, 128, 1, 1]));
    assert_types(vec![&a, &b]);
  }
}

Stack trace:

(lldb) r
Process 71790 launched: '/Users/jramapuram/Dropbox/projects/af_playground/target/release/af_playground' (x86_64)
warning: (x86_64) /usr/local/cuda/lib/libcublas.7.5.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (x86_64) /usr/local/cuda/lib/libcufft.7.5.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (x86_64) /Developer/NVIDIA/CUDA-7.5/nvvm/lib/libnvvm.3.0.0.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (x86_64) /usr/local/cuda/lib/libcusolver.7.5.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 71790 stopped
* thread #1: tid = 0x591924, 0x0000000100001696 af_playground`main::h935482300789cbfaWda + 326, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5effffd7)
    frame #0: 0x0000000100001696 af_playground`main::h935482300789cbfaWda + 326
af_playground`main::h935482300789cbfaWda:
->  0x100001696 <+326>: movb   %r15b, -0x29(%rbp)
    0x10000169a <+330>: movq   0x8(%r14), %rdi
    0x10000169e <+334>: callq  0x1000018c0               ; array::Array::get_type::h6963b010eb7489401ka
    0x1000016a3 <+339>: movb   %al, -0x2a(%rbp)

Multiple runs cause different issues:

➜  af_playground git:(master) ✗ cargo run --release --verbose
       Fresh rustc-serialize v0.3.19
       Fresh lazy_static v0.2.1
       Fresh libc v0.1.12
       Fresh winapi-build v0.1.1
       Fresh winapi v0.2.7
       Fresh semver v0.1.20
       Fresh custom_derive v0.1.5
       Fresh libc v0.2.11
       Fresh num-traits v0.1.32
       Fresh rustc_version v0.1.7
       Fresh conv v0.3.3
       Fresh rand v0.3.14
       Fresh num-integer v0.1.32
       Fresh num-complex v0.1.32
       Fresh num-iter v0.1.32
       Fresh num-bigint v0.1.32
       Fresh kernel32-sys v0.2.2
       Fresh num-rational v0.1.32
       Fresh time v0.1.35
       Fresh num v0.1.32
       Fresh arrayfire v3.3.0
       Fresh af_playground v0.1.0 (file:///Users/jramapuram/Dropbox/projects/af_playground)
     Running `target/release/af_playground`
error: Process didn't exit successfully: `target/release/af_playground` (signal: 11, SIGSEGV: invalid memory reference)
➜  af_playground git:(master) ✗ cargo run --release --verbose
       Fresh custom_derive v0.1.5
       Fresh libc v0.2.11
       Fresh winapi-build v0.1.1
       Fresh num-traits v0.1.32
       Fresh semver v0.1.20
       Fresh rustc-serialize v0.3.19
       Fresh lazy_static v0.2.1
       Fresh winapi v0.2.7
       Fresh conv v0.3.3
       Fresh rand v0.3.14
       Fresh num-integer v0.1.32
       Fresh rustc_version v0.1.7
       Fresh num-complex v0.1.32
       Fresh libc v0.1.12
       Fresh num-iter v0.1.32
       Fresh num-bigint v0.1.32
       Fresh kernel32-sys v0.2.2
       Fresh num-rational v0.1.32
       Fresh time v0.1.35
       Fresh num v0.1.32
       Fresh arrayfire v3.3.0
       Fresh af_playground v0.1.0 (file:///Users/jramapuram/Dropbox/projects/af_playground)
     Running `target/release/af_playground`
thread '<main>' panicked at 'Error message: Unknown Error', /Users/jramapuram/.cargo/registry/src/i.8713187.xyz-88ac128001ac3a9a/arrayfire-3.3.0/src/error.rs:47
note: Run with `RUST_BACKTRACE=1` for a backtrace.
fatal runtime error: Could not unwind stack, error = 5
error: Process didn't exit successfully: `target/release/af_playground` (signal: 4, SIGILL: illegal instruction)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions