ICE: Internal compiler error: 0 @ 00000000 in C++ builder when using the exprtk.hpp library

250 views Asked by At

I get this error every time I try to create an exprtk::parser<double> object. This is the only object that causes this error when I create it, and I have no idea why.

Screenshot of the failed execution

I just want the project to compile, which it does when I instantiate exprtk::symbol_table<double> and exprtk::expression<double>, but throws an error with exprtk::parse<double>.

2

There are 2 answers

0
ExprTk Developer On

bcc32c is generally not considered a standards conforming compiler. Missing features of the bcc32c compiler on a per standards version can be viewed here:

https://en.cppreference.com/w/cpp/compiler_support

Your best solution might be to use the packaged clang compiler that comes with your Builder installation.

Similar issues but this time related to the bundled standard library:

Can't find erf, erff, etc. compiling under 10.2

0
Spektre On

ICE is a nuisance and hard to deal with as the problem lies inside compiler itself. Usual way is to isolate problem to part of code that does the problem and then rewrite the code using different style of coding... Sometimes helps to place empty line at the right place of code or swap few lines of code (especially #include) ... Sometimes helps if you move the #pragma hrdstop few lines...

Over the years I had quite a few of ICEs and here is what I did to overcome them:

For really big projects (>5 MByte of source code) sometimes helps if you compile twice (hit F9 ... after ICE hit F9 again and second recompile usually works as should. This kind of ICE emerges in projects that has ben rewriten to be compatibile (compilable) with both older BCB/BDS and new RAD style IDES/compilers. Recently I managed to narrow it a bit more and the cause (for some of my projects) was code in Form *.h file where I have something like this:

#include <some VCL autogenerated stuff>
#include "some my *.h stuff containing data structs/classes and enums no major code at all"

enum some_enum
   {
   token1,
   token2,
   token3,
   token4,
   ...
   };

class TForm1 : public TForm
   {
   normal VCL autogenerated form header stuff...
   };

On some unknown circumstances (not related to code but probably to state of IDE) compiler throw either occasionaly ICE F1004 or allways if the enum contains more tokens (maybe ~20). By swapping the enum with custom includes looks like no ICE is thrown anymore (fingers crossed :))

#include <some VCL autogenerated stuff>

enum some_enum
   {
   token1,
   token2,
   token3,
   token4,
   ...
   };

#include "some my *.h stuff containing data structs/classes and enums no major code at all"

class TForm1 : public TForm
   {
   normal VCL autogenerated form header stuff...
   };

Another ICE was sometimes created by this (inside big projects):

if (ptr==NULL){ ... }
if (ptr!=NULL){ ... }

rewriting to this:

if (!ptr){ ... }
if ( ptr){ ... }

"should solve" the problem however not always after some trial and error I found out its related to debugging info getting too large and turning off this:

Project->Options->Debugging - Inline function expansion (-vi)

got rid of the problem completely (without any change in source code)

Another (sometimes even IDE BSOD fatal) problem cause is a thypo:

for(;;;)

in some versions of BCB this creates ICE in some it BSOD in some it freezes IDE in some its just syntax error as it should be.

Older versions BCB6 and BDS2006 have a problem with struct/class default constructors/destructors causing many issues from runtime to compiler errors. Replacing them with own ones solve a tons of issues see (I do not even remember them all):