Resolving Internal Errors (C++)
Go Up to How To Use the Debugger
Internal Compiler Errors
There are three kinds of errors that the C++ compiler generates and that are considered to be ICEs:
- F1001 Internal code generator error:
F1001 [C++ Fatal Error] <filename>(<line>)
- F1004 Internal compiler error:
F1004 [C++ Fatal Error] <filename>(<line>):
- Internal backend error
All three of these errors result from bugs in the compiler. The <filename> and <line> elements are the point in your source code that the compiler was parsing prior to the error, but they may or may not indicate the source of the problem. The <errorcode> element is a specific information to tell the compiler engineers what the compiler was trying to do when the error occurred.
What to do if you encounter an internal compiler error
- Remember that your code may not be at fault.
- Try a clean build.
- Try a command line build.
- Analyze the source to narrow the problem.
- Submit a bug report.
How to perform a clean build
- Right-click the project in the Project Manager and select clean.
- Check the directory structure to make sure there are no .obj .tds .dcu .#* or .pch files associated with your project.
- Choose Build from the Project menu.
How to do a command line build
- You can copy the command line of the compiler from the Output tab in the messages pane and use that in a command shell or ...
- Choose the "Rad Studio Command Prompt" from your start menu and then type msbuild yourproject.cbproj.
How to analyze the source code
If neither a clean build nor a command line build resolves the problem, you may want to analyze the source code to narrow down the problem.
- Preprocess the file mentioned in the error message. This can be done by right-clicking the file in the Project Manager and choosing preprocess, or by going to the command line and replacing the compiler (such as bcc32.exe) with the preprocessor (cpp32.exe) in the command to compile the file. This will generate a file with no external dependencies for compilation. It might be a very large file.
- Compile the preprocessed file with the -P switch. If this is sufficient to reproduce the problem, you may go straight to step 4.
- If the .i file compiled correctly, you may need additional switches to reproduce the problem. Recompile the .i file adding any switches used for the original command line build until you determine which switches are needed to reproduce the problem.
- This is enough information to file a bug report. If you do not wish to narrow down the problem any further, please go to the instructions to file a bug report.
- You can delete anything after the line where the error occurs and any comments.
- Start to comment out function bodies and other portions of code that may not have anything to do with the problem.
- As you determine portions that are not necessary to reproduce the problem, you may delete those sections from the .i file.
- Once you have narrowed down the code necessary to reproduce the problem, you can then submit a bug report and analyze the type of constructs used to try and find a workaround.
How to file a bug report:
- File a new bug report using Quality Portal at quality.embarcadero.com.
- Choose C++Builder as the project.
- Choose Compiler/C++ as the area.
- Enter the command line needed to reproduce the error in the steps of the bug.
- Attach the .i file.
- Click the check mark button to save the report.