I was writing a program that evaluates an operator tree with variables constants and operators. Rather than recursively iterate the tree many times for different variable values to evaluate it.. I printed the tree into a source file, compiled it as a shared library with gcc and dynamically linked it and call the function. In my case this is a much faster solution.. unless the tree is too big:
$ /usr/bin/gcc -shared -o libevaleqn.so evaleqn.c evaleqn.c:2:9: warning: null character(s) ignored gcc: Internal error: Segmentation fault (program cc1) Please submit a full bug report. See <URL:http://bugs.gentoo.org/> for instructions. For smaller sizes it compiles fine. I'm guessing this is a limitation on the length of expressions supported by gcc. I tested this on x86_64 (gcc 3.4.4) and i686 (gcc 3.4.4 and 3.3.6) and the results are the same. -- Summary: gcc segfaults compiling very long expressions Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: geckosenator at gmail dot com GCC build triplet: i686-pc-linux GCC host triplet: i686-pc-linux GCC target triplet: i686-pc-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25491