c2lang / c2compiler

the c2 programming language
c2lang.org
Apache License 2.0
704 stars 49 forks source link

Segfault when printing AST on module parse error #95

Closed Dandigit closed 5 years ago

Dandigit commented 5 years ago

Currently, when c2c is given this invalid C2 code:

module module;

...and asked to print the AST by providing the -a0 flag:

c2c -f file.c2 -a0

...the error is correctly reported, but when c2c tries to print the AST, it results in a segfault:

module module;
       ^
---- AST (module=) /home/dan/invalid.c2 ----

Segmentation fault (core dumped)

I'm on Ubuntu 18.04.1 LTS.

Dandigit commented 5 years ago

I've provided a quick fix in #96.

bvdberg commented 5 years ago

indeed, merged the fix! Thx