Resolving Internal Errors (C++)

From RAD Studio
Jump to: navigation, search

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:

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

  1. Remember that your code may not be at fault.
  2. Try a clean build.
  3. Try a command line build.
  4. Analyze the source to narrow the problem.
  5. Submit a bug report.

How to perform a clean build

  1. Right-click the project in the Project Manager and select clean.
  2. Check the directory structure to make sure there are no .obj .tds .dcu .#* or .pch files associated with your project.
  3. Choose Build from the Project menu.

How to do a command line build

  1. 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 ...
  2. 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.

  1. 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.
  2. Compile the preprocessed file with the -P switch. If this is sufficient to reproduce the problem, you may go straight to step 4.
  3. 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.
  4. 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.
  5. You can delete anything after the line where the error occurs and any comments.
  6. Start to comment out function bodies and other portions of code that may not have anything to do with the problem.
  7. As you determine portions that are not necessary to reproduce the problem, you may delete those sections from the .i file.
  8. 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:

  1. File a new bug report using Quality Portal at quality.embarcadero.com.
  2. Choose C++Builder as the project.
  3. Choose Compiler/C++ as the area.
  4. Enter the command line needed to reproduce the error in the steps of the bug.
  5. Attach the .i file.
  6. Click the check mark button to save the report.

See Also