iwillspeak / ullage

A statically-typed compiled language defined by a simple grammar
http://willspeak.me/ullage/
Other
23 stars 1 forks source link

Memory Errors on Linux #32

Closed iwillspeak closed 5 years ago

iwillspeak commented 5 years ago

The CI branch #31 currenlty fails to compile cleanly. Failures seem to be aborts or segfaults during lowering.

valgrind --tool=memcheck target/debug/ullage spec/modulus.ulg 
==801== Memcheck, a memory error detector
==801== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==801== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==801== Command: target/debug/ullage spec/modulus.ulg
==801== 
==801== Invalid read of size 1
==801==    at 0x13E0961: LLVMBuildCall (in /ullage/target/debug/ullage)
==801==    by 0x55C536: ullage::low_loader::builder::Builder::build_named_call (builder.rs:104)
==801==    by 0x55C3CF: ullage::low_loader::builder::Builder::build_call (builder.rs:88)
==801==    by 0x537901: ullage::compile::lower::lower_internal (lower.rs:204)
==801==    by 0x5395C6: ullage::compile::lower::lower_internal (lower.rs:298)
==801==    by 0x53B396: ullage::compile::lower::lower_internal (lower.rs:292)
==801==    by 0x5354D7: ullage::compile::lower::lower_expression (lower.rs:82)
==801==    by 0x535125: ullage::compile::lower::lower_as_main (lower.rs:49)
==801==    by 0x56819D: ullage::compile::Compilation::emit (compile.rs:107)
==801==    by 0x52B08A: ullage::main (main.rs:220)
==801==    by 0x5599BF: std::rt::lang_start::{{closure}} (rt.rs:64)
==801==    by 0x1DA66F2: {{closure}} (rt.rs:49)
==801==    by 0x1DA66F2: std::panicking::try::do_call (panicking.rs:293)
==801==  Address 0x6bb1ae0 is 0 bytes inside a block of size 5 free'd
==801==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==801==    by 0x1D667B2: alloc::alloc::dealloc (alloc.rs:93)
==801==    by 0x1D668A9: alloc::alloc::box_free (alloc.rs:203)
==801==    by 0x59F57F: core::ptr::real_drop_in_place (ptr.rs:193)
==801==    by 0x59F76D: core::ptr::real_drop_in_place (ptr.rs:193)
==801==    by 0x56AF6B: ullage::low_loader::builder::Builder::build_named_call::{{closure}} (builder.rs:109)
==801==    by 0x53171E: core::option::Option<T>::map_or (option.rs:435)
==801==    by 0x55C506: ullage::low_loader::builder::Builder::build_named_call (builder.rs:109)
==801==    by 0x55C3CF: ullage::low_loader::builder::Builder::build_call (builder.rs:88)
==801==    by 0x537901: ullage::compile::lower::lower_internal (lower.rs:204)
==801==    by 0x5395C6: ullage::compile::lower::lower_internal (lower.rs:298)
==801==    by 0x53B396: ullage::compile::lower::lower_internal (lower.rs:292)
==801==  Block was alloc'd at
==801==    at 0x4C31D2F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==801==    by 0x1D9C0F4: realloc (alloc.rs:111)
==801==    by 0x1D9C0F4: realloc (alloc.rs:166)
==801==    by 0x1D9C0F4: reserve_internal<u8,alloc::alloc::Global> (raw_vec.rs:666)
==801==    by 0x1D9C0F4: reserve_exact<u8,alloc::alloc::Global> (raw_vec.rs:411)
==801==    by 0x1D9C0F4: reserve_exact<u8> (vec.rs:482)
==801==    by 0x1D9C0F4: std::ffi::c_str::CString::from_vec_unchecked (c_str.rs:353)
==801==    by 0x1D9C08C: std::ffi::c_str::CString::_new (c_str.rs:328)
==801==    by 0x55F050: std::ffi::c_str::CString::new (c_str.rs:322)
==801==    by 0x56AEE1: ullage::low_loader::builder::Builder::build_named_call::{{closure}} (builder.rs:103)
==801==    by 0x52E9C2: core::option::Option<T>::map (option.rs:414)
==801==    by 0x55C42B: ullage::low_loader::builder::Builder::build_named_call (builder.rs:103)
==801==    by 0x55C3CF: ullage::low_loader::builder::Builder::build_call (builder.rs:88)
==801==    by 0x537901: ullage::compile::lower::lower_internal (lower.rs:204)
==801==    by 0x5395C6: ullage::compile::lower::lower_internal (lower.rs:298)
==801==    by 0x53B396: ullage::compile::lower::lower_internal (lower.rs:292)
==801==    by 0x5354D7: ullage::compile::lower::lower_expression (lower.rs:82)
==801== 
==801== Invalid read of size 1
==801==    at 0x13E0961: LLVMBuildCall (in /ullage/target/debug/ullage)
==801==    by 0x55C536: ullage::low_loader::builder::Builder::build_named_call (builder.rs:104)
==801==    by 0x55C3CF: ullage::low_loader::builder::Builder::build_call (builder.rs:88)
==801==    by 0x53C78A: ullage::compile::lower::fmt (lower.rs:407)
==801==    by 0x539955: ullage::compile::lower::lower_internal (lower.rs:312)
==801==    by 0x53B396: ullage::compile::lower::lower_internal (lower.rs:292)
==801==    by 0x5354D7: ullage::compile::lower::lower_expression (lower.rs:82)
==801==    by 0x535125: ullage::compile::lower::lower_as_main (lower.rs:49)
==801==    by 0x56819D: ullage::compile::Compilation::emit (compile.rs:107)
==801==    by 0x52B08A: ullage::main (main.rs:220)
==801==    by 0x5599BF: std::rt::lang_start::{{closure}} (rt.rs:64)
==801==    by 0x1DA66F2: {{closure}} (rt.rs:49)
==801==    by 0x1DA66F2: std::panicking::try::do_call (panicking.rs:293)
==801==  Address 0x6bb2260 is 0 bytes inside a block of size 5 free'd
==801==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==801==    by 0x1D667B2: alloc::alloc::dealloc (alloc.rs:93)
==801==    by 0x1D668A9: alloc::alloc::box_free (alloc.rs:203)
==801==    by 0x59F57F: core::ptr::real_drop_in_place (ptr.rs:193)
==801==    by 0x59F76D: core::ptr::real_drop_in_place (ptr.rs:193)
==801==    by 0x56AF6B: ullage::low_loader::builder::Builder::build_named_call::{{closure}} (builder.rs:109)
==801==    by 0x53171E: core::option::Option<T>::map_or (option.rs:435)
==801==    by 0x55C506: ullage::low_loader::builder::Builder::build_named_call (builder.rs:109)
==801==    by 0x55C3CF: ullage::low_loader::builder::Builder::build_call (builder.rs:88)
==801==    by 0x53C78A: ullage::compile::lower::fmt (lower.rs:407)
==801==    by 0x539955: ullage::compile::lower::lower_internal (lower.rs:312)
==801==    by 0x53B396: ullage::compile::lower::lower_internal (lower.rs:292)
==801==  Block was alloc'd at
==801==    at 0x4C31D2F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==801==    by 0x1D9C0F4: realloc (alloc.rs:111)
==801==    by 0x1D9C0F4: realloc (alloc.rs:166)
==801==    by 0x1D9C0F4: reserve_internal<u8,alloc::alloc::Global> (raw_vec.rs:666)
==801==    by 0x1D9C0F4: reserve_exact<u8,alloc::alloc::Global> (raw_vec.rs:411)
==801==    by 0x1D9C0F4: reserve_exact<u8> (vec.rs:482)
==801==    by 0x1D9C0F4: std::ffi::c_str::CString::from_vec_unchecked (c_str.rs:353)
==801==    by 0x1D9C08C: std::ffi::c_str::CString::_new (c_str.rs:328)
==801==    by 0x55F050: std::ffi::c_str::CString::new (c_str.rs:322)
==801==    by 0x56AEE1: ullage::low_loader::builder::Builder::build_named_call::{{closure}} (builder.rs:103)
==801==    by 0x52E9C2: core::option::Option<T>::map (option.rs:414)
==801==    by 0x55C42B: ullage::low_loader::builder::Builder::build_named_call (builder.rs:103)
==801==    by 0x55C3CF: ullage::low_loader::builder::Builder::build_call (builder.rs:88)
==801==    by 0x53C78A: ullage::compile::lower::fmt (lower.rs:407)
==801==    by 0x539955: ullage::compile::lower::lower_internal (lower.rs:312)
==801==    by 0x53B396: ullage::compile::lower::lower_internal (lower.rs:292)
==801==    by 0x5354D7: ullage::compile::lower::lower_expression (lower.rs:82)
==801== 
==801== 
==801== HEAP SUMMARY:
==801==     in use at exit: 1,307,118 bytes in 2,901 blocks
==801==   total heap usage: 8,680 allocs, 5,779 frees, 5,545,820 bytes allocated
==801== 
==801== LEAK SUMMARY:
==801==    definitely lost: 40 bytes in 2 blocks
==801==    indirectly lost: 0 bytes in 0 blocks
==801==      possibly lost: 0 bytes in 0 blocks
==801==    still reachable: 1,307,078 bytes in 2,899 blocks
==801==         suppressed: 0 bytes in 0 blocks
==801== Rerun with --leak-check=full to see details of leaked memory
==801== 
==801== For counts of detected and suppressed errors, rerun with: -v
==801== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
iwillspeak commented 5 years ago

Fixed by #31