maorbernstein / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

Return statement causes a crash in inline mode #154

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reproducing the problem:
1. Start picoc in inline mode (picoc -i).
2. Enter a "return" statement, with or without arguments.

Getting the error:
The program appears to do something for a while and finally ends on a 
segmentation fault.

Operating system:
Mac OS X Lion (10.7.3).

Additional information:
PicoC was compiled using gcc version 4.2.1 (Based on Apple Inc. build 5658) 
(LLVM build 2336.1.00).
Binary output architecture is x86_64.

Original issue reported on code.google.com by andreu.s...@gmail.com on 6 Feb 2012 at 11:47

GoogleCodeExporter commented 9 years ago
Debugging a bit i get this from gdb:

(gdb) run -i
Starting program: /Users/andreu/desarrollo/picoc 2.1/picoc -i
Reading symbols for shared libraries ++......................... done
starting picoc v2.1
picoc> return;

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000040
0x0000000100007a46 in ParseStatement (Parser=0x7fff5fbffa58, 
CheckTrailingSemicolon=1) at parse.c:739
739                 if (TopStackFrame->ReturnValue->Typ->Base != TypeVoid)
(gdb) bt
#0  0x0000000100007a46 in ParseStatement (Parser=0x7fff5fbffa58, 
CheckTrailingSemicolon=1) at parse.c:739
#1  0x000000010000806c in PicocParseInteractive () at parse.c:863
#2  0x0000000100001272 in main (argc=2, argv=0x7fff5fbffaf8) at picoc.c:39
(gdb) 

Original comment by andreu.s...@gmail.com on 6 Feb 2012 at 11:54

GoogleCodeExporter commented 9 years ago
This seems a duplicate of bug 143.

Original comment by christop...@gmail.com on 29 Aug 2012 at 2:48

GoogleCodeExporter commented 9 years ago
Yes, it's a duplicate and was kindly fixed by broscutamaker. Check the latest 
version.

Original comment by zik.sale...@gmail.com on 16 Mar 2013 at 7:46