daadaada / gas

40 stars 7 forks source link

Segmentation fault with output arguments #1

Open YangWang92 opened 3 years ago

YangWang92 commented 3 years ago

Hi Yan, I got a segmentation fault when I try to add output arguments of gas,

../../../build/gas benchmark.gas -o benchmark.bin [1] 51430 segmentation fault (core dumped) ../../../build/gas benchmark.gas -o benchmark.bin

And it works well without output arguments.

Here are backtraces of the segment fault.

(gdb) bt

0 __memcpy_avx_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S:245

1 0x000000000047d9b8 in std::cxx11::basic_string<char, std::char_traits, std::allocator >::_M_construct<char*> (this=0x7fffffffd330, beg=0xa7ab40 "",

__end=0x14f5680 <error: Cannot access memory at address 0x14f5680>) at /usr/include/c++/9/bits/basic_string.tcc:225

2 0x000000000045e47b in MyVisitor::visitVar_declaration (this=0x7fffffffd930, ctx=0x94de20) at /home/wy/gas/grammar/visitor.cpp:78

3 0x0000000000447080 in dadaParser::Var_declarationContext::accept (this=0x94de20, visitor=0x7fffffffd930) at /home/wy/gas/grammar/generated/dadaParser.cpp:997

4 0x0000000000410d72 in antlr4::tree::AbstractParseTreeVisitor::visit (this=0x7fffffffd930, tree=0x94de20)

at /home/wy/gas/thirdparty/antlr4-runtime/src/tree/AbstractParseTreeVisitor.h:18

5 0x000000000045e044 in MyVisitor::visitStatement (this=0x7fffffffd930, ctx=0x94ddd0) at /home/wy/gas/grammar/visitor.cpp:60

6 0x0000000000446af6 in dadaParser::StatementContext::accept (this=0x94ddd0, visitor=0x7fffffffd930) at /home/wy/gas/grammar/generated/dadaParser.cpp:912

7 0x0000000000410d72 in antlr4::tree::AbstractParseTreeVisitor::visit (this=0x7fffffffd930, tree=0x94ddd0)

at /home/wy/gas/thirdparty/antlr4-runtime/src/tree/AbstractParseTreeVisitor.h:18

8 0x000000000045deef in MyVisitor::visitCompound_statement (this=0x7fffffffd930, ctx=0x94dc70) at /home/wy/gas/grammar/visitor.cpp:52

9 0x00000000004460d0 in dadaParser::Compound_statementContext::accept (this=0x94dc70, visitor=0x7fffffffd930) at /home/wy/gas/grammar/generated/dadaParser.cpp:668

10 0x0000000000410d72 in antlr4::tree::AbstractParseTreeVisitor::visit (this=0x7fffffffd930, tree=0x94dc70)

at /home/wy/gas/thirdparty/antlr4-runtime/src/tree/AbstractParseTreeVisitor.h:18

11 0x000000000045d7d6 in MyVisitor::visitKernel_defination (this=0x7fffffffd930, ctx=0x94d040) at /home/wy/gas/grammar/visitor.cpp:21

12 0x0000000000448f56 in dadaParser::Kernel_definationContext::accept (this=0x94d040, visitor=0x7fffffffd930) at /home/wy/gas/grammar/generated/dadaParser.cpp:1446

13 0x0000000000410d72 in antlr4::tree::AbstractParseTreeVisitor::visit (this=0x7fffffffd930, tree=0x94d040)

at /home/wy/gas/thirdparty/antlr4-runtime/src/tree/AbstractParseTreeVisitor.h:18

14 0x000000000045d63b in MyVisitor::visitTranslation_unit (this=0x7fffffffd930, ctx=0x91c2c0) at /home/wy/gas/grammar/visitor.cpp:12

15 0x0000000000445bb6 in dadaParser::Translation_unitContext::accept (this=0x91c2c0, visitor=0x7fffffffd930) at /home/wy/gas/grammar/generated/dadaParser.cpp:606

16 0x0000000000410d72 in antlr4::tree::AbstractParseTreeVisitor::visit (this=0x7fffffffd930, tree=0x91c2c0)

at /home/wy/gas/thirdparty/antlr4-runtime/src/tree/AbstractParseTreeVisitor.h:18

17 0x0000000000407ebc in main (argc=4, argv=0x7fffffffe1c8) at /home/wy/gas/main.cpp:58

Env:

gcc-9 (Ubuntu 9.3.0-10ubuntu2~16.04) 9.3.0 g++-9 (Ubuntu 9.3.0-10ubuntu2~16.04) 9.3.0

daadaada commented 3 years ago

Hi,

Thank you for reporting this. However, I cannot reproduce the error :(

Could you please check the value of name before /home/wy/gas/grammar/visitor.cpp:52?

What is the stack size of your environment (you may check with ulimit -a)?