fb39ca4 / picoc

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

"out of memory" and hang on certain errors #144

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compiling code with PicocParse, certain source code errors leads to "out of 
memory" or hang. Examples:
2. Example 1: #define CODE1 "printf("   // out of memory
3. Example 2: #define CODE1 "void f( void) {}; f("   // hang
4: PicocParse( "f.c", CODE1, sizeof( CODE1), TRUE, FALSE, FALSE, FALSE);

As far as I can seem there is no memory loss...

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
Latest from read-only SVN (October 21, 2011)
Compiled with Visual Studio 2010 C++ Express.

Please provide any additional information below.
It looks like the code gets stuck in the do-while loop in expression.c, lines 
1378 to line 1411 ('Token' never gets the value of 'TokenCloseBracket', its 
always 'TokenEOF').

Original issue reported on code.google.com by jjohans...@gmail.com on 31 Oct 2011 at 12:48

GoogleCodeExporter commented 8 years ago
picoc's macros are somewhat limited in their abilities. It's not a full 
preprocessor like in real C, it's more like a function with macro-like 
attributes.

For that reason macros with unmatching brackets won't work properly.

I've decided not to fix this one since it requires making the preprocessor much 
bigger and less pico-like.

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