David Dean

What is an Internal Compiler Error?

The documentation team recently asked me to look over a help topic about Internal Compiler Errors. The content included no information for C++ users, so I wrote this quick draft. I hope they’ll do a better job than I did, but since this topic comes up often enough in the newsgroups, I figured posting it in my blog would be a good point of reference when the topic does come up

There are three kinds of errors that the C++ compiler generates that we group together as ICEs:

F1001
[C++ Fatal Error] (): F1001 Internal code generator error

F1004
[C++ Fatal Error] (): F1004 Internal compiler error

internal backend error

All three of these result from bugs in the compiler. The and elements are the point in your source code that the compiler was parsing prior to the error, but may or may not indicate the source of the problem. The element is 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 on the project in the project manager and select "clean"
2. check the directory structure to make sure there are no .obj .tds .dcu .#* .pch or .csm files associated with your project
3. Choose Build from the project menu.

How to do a command line build:

1. You can copy the compiler’s command line 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

If neither a clean build nor a command line build resolves the problem, you may want to analyze the source code to narrow the problem down.

1. Preprocess the file which is mentioned in the error message. This can be done by either right clicking on the file in the project manager and choosing preprocess, or by going to the command line and replacing the compiler (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 and may 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, there may be additional switched needed to reproduce the problem. recompile the .i file adding any switched 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 for filing 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 which may not have anything to do with the problem.

7. as you determine portions which are not necessary to reproduce the problem, you may delete those sections from the .i file.

8. Once you have narrowed down the elements of 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. Choose Quality Central from the Tools menu in the IDE.
2. Click on the ‘+’ button to create a new report
3. Choose C++Builder as the project
4. Choose Compiler/C++ as the area
5. Enter the command line needed to reproduce the error in the steps of the bug
6. attach the .i file
7. click the check mark button to save the report.

Posted by David Dean on February 13th, 2009 under C++Builder 2007, C++Builder 2009, Quality Central | 14 Comments »


Call for sysops [Update]

The QC stats link (which I posted in this earlier entry asking for sysop volunteers) isn’t working, so I thought I’d update it with a manual query:

Delphi Delphi Prism C++
1/19/2009 3249 0 88
10/10/2007 4008 N/A 107

I don’t have a reliable method of verifying this, but when I first started as a sysop C++ had over 400 reports that hadn’t been moved out of the "reported" status.

You can help. Please let me know. The quality of Delphi will only get better as more sysops help focus in on this backlog.

Posted by David Dean on January 19th, 2009 under Uncategorized | 2 Comments »


Type Traits

One of the newest features we’ve implemented in C++Builder 2009 seems to have been overlooked. I’ve mentioned it in the forums a few times, but it seems that this is surprising news to many folks.

Type trait functions are intrinsic functions that accept a type at compile time and deliver a compile
time constant expression as a result, typically of type bool. Type trait functions accept only named
types, not arbitrary expressions. 

List of type functions supported in C++Builder 2009:

bool __is_lvalue_expr(typename T)
bool __is_rvalue_expr(typename T)
bool __is_complete_type(typename T)
bool __is_void(typename T)
bool __is_integral(typename T)
bool __is_floating_point(typename T)
bool __is_array(typename T)
bool __is_enum(typename T)
bool __is_union(typename T)
bool __is_class(typename T)
bool __is_function(typename T)
bool __is_reference(typename T)
bool __is_lvalue_reference(typename T)
bool __is_rvalue_reference(typename T)
bool __is_arithmetic(typename T)
bool __is_fundamental(typename T)
bool __is_object(typename T)
bool __is_scalar(typename T)
bool __is_compound(typename T)
bool __is_pointer(typename T)
bool __is_member_object_pointer(typename T)
bool __is_member_function_pointer(typename T)
bool __is_member_pointer(typename T)
bool __is_const (typename T)
bool __is_volatile(typename T)
bool __is_empty(typename T)
bool __is_polymorphic(typename T)
bool __is_abstract(typename T)
bool __is_trivial(typename T)
bool __is_standard_layout(typename T)
bool __is_pod(typename T)
bool __has_trivial_default_constructor(typename T)
bool __has_trivial_copy_constructor(typename T)
bool __has_trivial_assign(typename T)
bool __has_trivial_destructor(typename T)
bool __has_nothrow_default_constructor(typename T)
bool __has_nothrow_copy_constructor(typename T)
bool __has_nothrow_assign(typename T)
bool __has_virtual_destructor(typename T)
bool __is_signed(typename T)
bool __is_unsigned(typename T)
unsigned int __array_rank(typename T)
unsigned int __array_extent(typename T, unsigned int I)
bool __is_same(typename T, typename U)
bool __is_base_of(typename Base, typename Derived)
bool __is_convertible(typename From, typename To)

These are expected to eventually be part of the C++0x standard library.

Posted by David Dean on January 19th, 2009 under C++0x, C++Builder 2009 | Comment now »


Boost Conference

Alisdair and I will be attending the Boost conference next week. I hope to use the opportunity to evangelize for our compiler and also to show off some of the new C++0x features that we’ve been implementing for Tiburón. I also hope it will give me some time to finally post some of the things I’ve been promising to publish such as boost results for our compilers. Stay tuned next week and I’ll do my best to get you some fun content.

Posted by David Dean on April 28th, 2008 under Boost, C++0x | 5 Comments »


Anniversary

Chris Bensen beat me to it:

http://chrisbensen.blogspot.com/2007/11/codegear-aniversary.html

By a staggering coincidence yesterday marked my first year at this job. (Which means I had only been a Borland employee for a single day when CodeGear was announced.)

Posted by David Dean on November 14th, 2007 under CodeGear | Comment now »


Call for sysops

Why is CodeGear looking for Quality Central sysops?

As of 10/10/07 17:24 PDT, These are the number of reports in Quality Central with a status of "Reported":

Delphi Delphi.Net C++ C#
4008 614 157 107

according to the QC stats here:
http://qc.codegear.com/stats/

82 bug reports have come in in the last week.

Assuming we could tackle reports twice as fast as they are coming in, It would take us almost a year to handle the backlog. We don’t want to wait that long. If you want to help CodeGear, you can become a QC sysop.

What does a QC sysop do?

You can find out here:
http://dn.codegear.com/article/33867

If this sounds like something you want to do, please drop either myself or Chris Pattinson an email to request to become a sysop. Please indicate the area where you think you would be best suited and why you would make a good sysop.

Posted by David Dean on October 11th, 2007 under Quality Central | 3 Comments »


C++Builder 2007 Features - New Dinkumware and iterator debugging

C++Builder 2007 Features - New Dinkumware and iterator debugging<br />

C++Builder 2007 - New Dinkumware and iterator debugging


C++Builder 2007 includes the newest dinkumware runtime libraries. (v5.01)
This should bring a bunch of fixes, but more interesting is the new feature of iterator debugging.
This will help you to detect when you are using iterators incorrectly. Here is an example of using an
iterator after it has become invalid. (due to erasing an element in the container)

//—————————————————————————

#pragma hdrstop
#define _HAS_ITERATOR_DEBUGGING 1
#include <vector>
#include <iostream>

//—————————————————————————
#pragma argsused
int main(int argc, char* argv[])
{
std::vector<int> v ;
v.push_back(1);
v.push_back(3);
v.push_back(7);
v.push_back(15);
std::vector<int>::iterator i = v.begin();
++i;
std::vector<int>::iterator j = v.end();
–j;
std::cout

When you run that from a command line you will see:

C:\Projects\Debug>dereferenced_iterator.exe
15
error: vector iterator not dereferencable, at
c:\program files\codegear\rad studio\5.0\include\dinkumware\vector: 60

Abnormal program termination

Here is another example where two incompatible iterators are compared:

//—————————————————————————

#pragma hdrstop

//—————————————————————————
#define _HAS_ITERATOR_DEBUGGING 1
#include <algorithm>
#include <vector>
using namespace std;

// The function object multiplies an element by a Factor
template <class Type>
class MultValue
{
private:
Type Factor; // The value to multiply by
public:
// Constructor initializes the value to multiply by
MultValue(const Type& val ) : Factor(val) { }

// The function call for the element to be multiplied
void operator()(Type& elem) const
{
elem *= Factor;
}
};

#pragma argsused
int main(int argc, char* argv[])
{
vector<int> v1;
vector<int> v2;

v1.push_back(10);
v1.push_back(20);

v2.push_back(10);
v2.push_back(20);

// This next line will assert because v1 and v2 are
// incompatible.
for_each(v1.begin(), v2.end(), MultValue<int>(-2));
return 0;
}

//—————————————————————————

and the output:

C:\Projects\Debug>incompatible_iterators.exe
error: vector iterators incompatible, at
c:\program files\codegear\rad studio\5.0\include\dinkumware\vector: 179

Update:
Formatting got messed up when transitioned to WordPress

Posted by David Dean on May 23rd, 2007 under C++Builder 2007 | 4 Comments »


BCB 6 Help files are now available for download

The following article tells you how to get the help files which were included with Borland C++ Builder 6
http://dn.codegear.com/article/34064

Posted by David Dean on February 16th, 2007 under Uncategorized | 7 Comments »


Another morsel…

Another delphi.nontech post which may be of interest to the C++ community.
Michael Swindell says:

We will be realigning the editions and the notion of the Studio this year. We will have separate Win32 focused Delphi and C++ releases, then later a studio that includes .NET and Win32. We will also be releasing products on a more frequent basis - smaller releases with focused features and high quality which is going to make studio subscriptions a much more popular and cost effective model for customers. Nick is updating the Roadmap and will be launching it in coordination with some announcements we have coming on.

I’m eager for these announcements to be made, because I’m pretty sure that I cannot comment until they happen.
I’m pretty sure I can say these since Michael did:
  • Separate Win32 C++ release
  • Studio product later
  • Studio subcriptions more valuable because of more frequent product releases.

Go CodeGear!

Posted by David Dean on February 8th, 2007 under Uncategorized | 5 Comments »


Nick Let a cat out of the bag…

Nick Hodges (The Delphi Product Manager) doesn’t usually talk about C++, but he mentioned something that I was eager to talk about.
Those of you who don’t read borland.public.delphi.non-technical (and maybe even some of you who do) could have easily missed a jewel buried in this thread:

<http://groups.google.com/group/borland.public.delphi.non-technical/browse_thread/thread/3898a5f36255b98c/d6e21acf04fbd49#7d6e21acf04fbd49> or
<http://tinyurl.com/yls9ru>

Where Nick says:

>Lance R. wrote:
>> Does Delphi 2006 (BDS) support Pre-build / Post-build event command
>> line actions like VS2005 does?
>
> No, but the next release of Delphi will, as it will use MSBuild as the
> build engine.

and then later in the thread:

> If by "Macros" you mean MSBuild Actions, then since we use MSBuild,
> you’ll be able to use any and all MS Actions in your build.
>
>> I assume this would be for VCL as well as the .NET side?
>
> Yes, even C++, something MS wasn’t able to do.

What does this mean to us C++ developers?

  • A small dig against the competition.
  • Extremely configurable build system.
  • No more messing around with bdsproj2mak/bpr2mak.
  • Identical results when building from IDE and the command line.
  • Much faster builds in the IDE. (IDE sometimes faster than command line)

I’ll blog some more about the above in the future, but I didn’t want you guys to miss hearing about this.

Posted by David Dean on January 15th, 2007 under Uncategorized | 10 Comments »




Server Response from: blogs2.codegear.com