Visual C++ 7.1 INTERNAL COMPILER ERROR -- crossposted clc++ and microsoft.public.vstudio.general

  • Thread starter Alf P. Steinbach
  • Start date
A

Alf P. Steinbach

// As usual the error message directs one to the report the bug.
//
// And as usual there is absolutely no way to do so without paying for
// the privilege...
//
// Or using three or four hours to find the _current_ reporting page...
//
// Since I'm now using much time on reporting this compiler bug, please
// do also fix the __LINE__ macro.
//
// It does not work with some compiler options, which means e.g. Andrei
// Alexandrescu's ScopeGuard does not compile with this compiler.


#include <vector>
#include <iostream>

template< typename T, size_t N >
struct ArrayHolder
{
T elem[N];
};

template< typename T >
class VectorImpl
{
private:
std::vector<T> elem;
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): elem( values, values+N ) {}

T& operator[]( size_t i ){ return elem.at( i ); }
T const& operator[]( size_t i ) const { return elem.at( i ); }
};

template< typename T >
class Vector: public VectorImpl< T >
{
public:
template< size_t N >

// This is a bug. It causes a compiler crash. That is, an ICE.
VectorImpl( T const (&values)[N] ): VectorImpl( values ) {}
};

int main()
{
typedef ArrayHolder<double, 6> DoubleArray6;
static DoubleArray6 const x = { 10, 20, 30, 40, 50, 60 };
static DoubleArray6 const xArray[] = { x };

Vector<DoubleArray6> v( xArray );
for( size_t i = 0; i < 6; ++i )
{
std::cout << v[0].elem << std::endl;
}
}
 
A

Arne Adams

// It does not work with some compiler options, which means e.g. Andrei
// Alexandrescu's ScopeGuard does not compile with this compiler.
I use the __LINE__ Macro a lot as integral constant parameter in my templates
(with VC7.1 as well) hence it is more than just curiosity:
which options do you refer to and which are the effects?

As to syntax errors leading to ICEs in template code - that's nothing new for
VC++.
 
A

Alf P. Steinbach

* "Arne Adams said:
I use the __LINE__ Macro a lot as integral constant parameter in my templates
(with VC7.1 as well) hence it is more than just curiosity:
which options do you refer to

Had to check that. One such option is "/ZI" (uppercase), edit-and-continue,
which is set by default in a Visual Studio project... Don't know others.

and which are the effects?

It does not generate new line numbers as it should; as I recall it does not
even generate line numbers.

For use in e.g. STATIC_ASSERT this is "fixed" by another bug (although not an
ICE), namely that VC allows multiple typedefs of same name as long as the
definitions are the same -- and for all that I know and care to check,
perhaps also when they are different.

For use in ScopeGuard the typedef bug does not "fix" the __LINE__ bug, so two
ScopeGuards or more in the same scope does not compile (I don't care to check
the details here either, perhaps it was that even one does not compile...
;-)). A workaround is to use the non-standard Microsoft __COUNTER__ macro.
But why should one have to special-case this compiler, always?

As to syntax errors leading to ICEs in template code - that's nothing new for
VC++.

If the assumption is that the compiler will only ever be given correct code
then it can be optimized to an extreme degree.
 
A

Alf P. Steinbach

* "Arne Adams said:
As to syntax errors leading to ICEs in template code - that's nothing new for
VC++.

It is a crying shame that Microsoft provides no way to report a compiler
crash (ICE), except by _paying_ them to accept a report, then forgotten.

For the GNU compiler, OTOH., it's real easy: last time I reported an ICE
someone had fixed the bug and reported back within half an hour.

Microsoft: bug? What bug? We don't have any bugs -- to wit, nobody have
reported any bugs, especially not in our compilers (muu haa, evil laughter).
 
M

Mike Wahler

Alf P. Steinbach said:
It is a crying shame that Microsoft provides no way to report a compiler
crash (ICE), except by _paying_ them to accept a report, then forgotten.

For the GNU compiler, OTOH., it's real easy: last time I reported an ICE
someone had fixed the bug and reported back within half an hour.

Microsoft: bug? What bug? We don't have any bugs -- to wit, nobody have
reported any bugs, especially not in our compilers (muu haa, evil
laughter).

Anecdote: When I was doing telephone tech support for
several Microsoft compilers (back in the 80's), we were
prohibited from using the word 'bug' when talking to
customers. We were instructed to use the word 'problem',
and in some cases, 'feature'. :)

-Mike
 
U

Unforgiven

Mike Wahler said:
laughter).

Anecdote: When I was doing telephone tech support for
several Microsoft compilers (back in the 80's), we were
prohibited from using the word 'bug' when talking to
customers. We were instructed to use the word 'problem',
and in some cases, 'feature'. :)


"To bug or not to bug... or is it a feature?
What was the question?"
 
I

Ioannis Vranos

Alf P. Steinbach said:
// As usual the error message directs one to the report the bug.
//
// And as usual there is absolutely no way to do so without paying for
// the privilege...
//
// Or using three or four hours to find the _current_ reporting page...
//
// Since I'm now using much time on reporting this compiler bug, please
// do also fix the __LINE__ macro.
//
// It does not work with some compiler options, which means e.g. Andrei
// Alexandrescu's ScopeGuard does not compile with this compiler.


#include <vector>
#include <iostream>

template< typename T, size_t N >
struct ArrayHolder
{
T elem[N];
};

template< typename T >
class VectorImpl
{
private:
std::vector<T> elem;
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): elem( values, values+N ) {}

T& operator[]( size_t i ){ return elem.at( i ); }
T const& operator[]( size_t i ) const { return elem.at( i ); }
};

template< typename T >
class Vector: public VectorImpl< T >
{
public:
template< size_t N >

// This is a bug. It causes a compiler crash. That is, an ICE.
VectorImpl( T const (&values)[N] ): VectorImpl( values ) {}
};

int main()
{
typedef ArrayHolder<double, 6> DoubleArray6;
static DoubleArray6 const x = { 10, 20, 30, 40, 50, 60 };
static DoubleArray6 const xArray[] = { x };

Vector<DoubleArray6> v( xArray );
for( size_t i = 0; i < 6; ++i )
{
std::cout << v[0].elem << std::endl;
}
}



Your code does not compile under GCC:


Executing: C:\Program Files\ConTEXT\ConExec.exe
"c:\mingw\bin\g++.exe" -std=c++98 -pedantic-errors -O3 -Wall "temp.cpp" -o
temp

temp.cpp:44: error: ISO C++ forbids declaration of `VectorImpl' with no type
temp.cpp: In member function `int Vector<T>::VectorImpl(const T (&)[N])':
temp.cpp:44: error: only constructors take base initializers
temp.cpp:44: error: class `Vector<T>' does not have any field named
`VectorImpl
'
temp.cpp: At global scope:
temp.cpp: In instantiation of `Vector<main()::DoubleArray6>':
temp.cpp:53: instantiated from here
temp.cpp:39: error: base `VectorImpl<main()::DoubleArray6>' with only
non-default constructor in class without a constructor
temp.cpp: In function `int main()':
temp.cpp:53: error: no matching function for call to `
Vector<main()::DoubleArray6>::Vector(const main()::DoubleArray6[1])'
temp.cpp:39: error: candidates are:
Vector<main()::DoubleArray6>::Vector(const
Vector<main()::DoubleArray6>&)

Execution finished.






Regards,

Ioannis Vranos
 
I

Ioannis Vranos

Ioannis Vranos said:
Your code does not compile under GCC:


Executing: C:\Program Files\ConTEXT\ConExec.exe
"c:\mingw\bin\g++.exe" -std=c++98 -pedantic-errors -O3 -Wall "temp.cpp" -o
temp

temp.cpp:44: error: ISO C++ forbids declaration of `VectorImpl' with no type
temp.cpp: In member function `int Vector<T>::VectorImpl(const T (&)[N])':
temp.cpp:44: error: only constructors take base initializers
temp.cpp:44: error: class `Vector<T>' does not have any field named
`VectorImpl
'
temp.cpp: At global scope:
temp.cpp: In instantiation of `Vector<main()::DoubleArray6>':
temp.cpp:53: instantiated from here
temp.cpp:39: error: base `VectorImpl<main()::DoubleArray6>' with only
non-default constructor in class without a constructor
temp.cpp: In function `int main()':
temp.cpp:53: error: no matching function for call to `
Vector<main()::DoubleArray6>::Vector(const main()::DoubleArray6[1])'
temp.cpp:39: error: candidates are:
Vector<main()::DoubleArray6>::Vector(const
Vector<main()::DoubleArray6>&)

Execution finished.



And it indeed causes problem to the VC++ 7.1 compiler:

test.cpp(49): fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more
information



Well you can contact Technical Support on this (also tell them to fix the
Start Page::Online Resources issue (works only for Administrator account in
my PC).






Regards,

Ioannis Vranos
 
A

Alf P. Steinbach

It should not, since it contains a bug at the line that says "bug".


And it indeed causes problem to the VC++ 7.1 compiler:

test.cpp(49): fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more
information
Yep.



Well you can contact Technical Support on this (also tell them to fix the
Start Page::Online Resources issue (works only for Administrator account in
my PC).

It doesn't work at all on one PC.

Seems it has to do with national language support.
 
A

Alf P. Steinbach

* "Ioannis Vranos said:

Meaning I found several pages on the net with supposed fixes, involving
some language setting in Internet Explorer, which didn't work but have
worked for some others. It reminds of the old Class Wizard that only
worked properly with US English (and perhaps French or German) settings.
How is it even _possible_ to bring in an English dependency,
and how is it _possible_ to ignore such blatant bugs for years on end?

Follow-up to set to [microsoft.public.vstudio.general].
 
D

David Lowndes

FWIW, the C1001 ICE doesn't occur when compiled with the Whidbey
compiler - it generates several compiler errors, starting with:

error C2143: syntax error : missing ')' before 'const'"

For this indicated incorrect line:
VectorImpl( T const (&values)[N] ): elem( values, values+N ) {}

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top