phillipstanleymarbell / Noisy-lang-compiler

Noisy language compiler
MIT License
17 stars 1 forks source link

Segmentation fault in `irPassLLVMIRDimensionCheck` #608

Open PeiMu opened 2 years ago

PeiMu commented 2 years ago

Hi, I got such error info while trying with ./newton-linux-EN --llvm-ir=../../applications/newton/llvm-ir/e_exp.ll --llvm-ir-liveness-check ../../applications/newton/sensors/test.nt.

Through the gdb tool to backtrace it, such info has shown:

GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from newton-linux-EN...done.
[New LWP 5335]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./newton-linux-EN --llvm-ir=../../applications/newton/llvm-ir/e_exp.ll --llvm-i'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000430dee in std::vector<PhysicsInfo*, std::allocator<PhysicsInfo*> >::size (this=0x8) at /usr/include/c++/5/bits/stl_vector.h:655
655           { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
(gdb) bt
#0  0x0000000000430dee in std::vector<PhysicsInfo*, std::allocator<PhysicsInfo*> >::size (this=0x8) at /usr/include/c++/5/bits/stl_vector.h:655
#1  0x000000000042fab8 in std::vector<PhysicsInfo*, std::allocator<PhysicsInfo*> >::vector (this=0x7ffc15601200,
    __x=<error reading variable: Cannot access memory at address 0x10>) at /usr/include/c++/5/bits/stl_vector.h:320
#2  0x000000000042eeb9 in PhysicsInfo::get_members (this=0x0) at newton-irPass-LLVMIR-dimension-check.cpp:94
#3  0x000000000042d6ee in dimensionalityCheck (llvmIrFunction=..., N=0xcde030) at newton-irPass-LLVMIR-dimension-check.cpp:458
#4  0x000000000042dc1f in irPassLLVMIRDimensionCheck (N=0xcde030) at newton-irPass-LLVMIR-dimension-check.cpp:594
#5  0x00000000004052ed in processNewtonFile (N=0xcde030, filename=0x7ffc15603669 "../../applications/newton/sensors/test.nt") at newton.c:199
#6  0x0000000000404d61 in main (argc=4, argv=0x7ffc156015b8) at main.c:515

Through the information, it seems to get a segmentation fault in this line:

physicsInfo = structurePointerPhysicsInfo->get_members()[index];

Please find the e_exp.ll and test.nt files in error_supported_file.zip attached. Please let me know if further information is needed. Thanks!

PeiMu commented 2 years ago

error_supported_file.zip