- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
EXAMPLE :
class BaseA
{
public:
virtual void op(){};
};
class BaseB
{
public:
virtual void op(){};
};
class DerivedA : public BaseA
{
public:
virtual void op(){};
};
class DerivedAAB : public DerivedA, public BaseB
{
public:
virtual void op(){};
};
int main(void)
{
DerivedAAB * DAAB = new DerivedAAB;
DerivedA * DA_DAAB = dynamic_cast(DAAB);
BaseB * BB3 = dynamic_cast(DA_DAAB);
if(BB3)
{
// WITH ICC 6.0.1 BB3 NOT NULL OK
printf("OK! ");
}
else
{
// WITH ICC 7.X BB3 NULL ERROR
printf("OOPS! ");
}
}
class BaseA
{
public:
virtual void op(){};
};
class BaseB
{
public:
virtual void op(){};
};
class DerivedA : public BaseA
{
public:
virtual void op(){};
};
class DerivedAAB : public DerivedA, public BaseB
{
public:
virtual void op(){};
};
int main(void)
{
DerivedAAB * DAAB = new DerivedAAB;
DerivedA * DA_DAAB = dynamic_cast
BaseB * BB3 = dynamic_cast
if(BB3)
{
// WITH ICC 6.0.1 BB3 NOT NULL OK
printf("OK! ");
}
else
{
// WITH ICC 7.X BB3 NULL ERROR
printf("OOPS! ");
}
}
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
gcc v3.2 also has a problem with dynamic_cast as I have discovered.
Check out bug report 9433 of the latest release of gcc (v3.2.2)
http://gcc.gnu.org/cgi-bin/gnatsweb.pl
It appears that the next release of gcc (v3.2.3) should fix this bug and it is due out on April 15th. If you are experiencing a similar bug using icc I wonder if this is due to both compilers using the same library/header . . .
Are you using RedHat 8.0?
Hope this helped
Sean
Check out bug report 9433 of the latest release of gcc (v3.2.2)
http://gcc.gnu.org/cgi-bin/gnatsweb.pl
It appears that the next release of gcc (v3.2.3) should fix this bug and it is due out on April 15th. If you are experiencing a similar bug using icc I wonder if this is due to both compilers using the same library/header . . .
Are you using RedHat 8.0?
Hope this helped
Sean
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an example where a dyamic_cast of a reference type seg-fault, but when rewritten as a cast of a pointer type it apparantly works OK. The crash is in
0x400606fe in __dynamic_cast () from /opt/intel/compiler70/ia32/lib/libcxa.so.3
#include
class Base
{
public:
virtual ~Base() {}
};
class Derived : public Base
{
public:
void foo() const { std::cout << "foo() called "; }
};
Base& obj()
{
static Derived d;
return d;
}
int main()
{
bool ShouldCrash = true; // set to false to get Derived::foo() called with no crash
if (ShouldCrash)
{
dynamic_cast(obj()).foo();
}
else
{
dynamic_cast(&obj())->foo();
}
}
Is anyone from Intel reading this?
0x400606fe in __dynamic_cast () from /opt/intel/compiler70/ia32/lib/libcxa.so.3
#include
class Base
{
public:
virtual ~Base() {}
};
class Derived : public Base
{
public:
void foo() const { std::cout << "foo() called "; }
};
Base& obj()
{
static Derived d;
return d;
}
int main()
{
bool ShouldCrash = true; // set to false to get Derived::foo() called with no crash
if (ShouldCrash)
{
dynamic_cast
}
else
{
dynamic_cast
}
}
Is anyone from Intel reading this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ian - I somehow missed this thread.
Please note that when you find what appears to be an issue in the compiler please dont hesitate to file an issue on the support website premier.intel.com.
Looking at this really briefly, I am not sure I know the cause for the error. Got to debug the runtime.
I am logging this internally and will keep you posted on any updates.
Please note that when you find what appears to be an issue in the compiler please dont hesitate to file an issue on the support website premier.intel.com.
Looking at this really briefly, I am not sure I know the cause for the error. Got to debug the runtime.
I am logging this internally and will keep you posted on any updates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Has any progress been made on uncovering this error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The original issue posted by jonnyfat seems to be fixed
in the latest Intel compiler.
[jain@jaffa jain]$ icpc test1.cpp
[jain@jaffa jain]$ ./a.out
OK!
[jain@jaffa jain]$ icpc -V
Intel C++ Compiler for 32-bit applications, Version 7.1 Build 20030507Z
...
...
CP
in the latest Intel compiler.
[jain@jaffa jain]$ icpc test1.cpp
[jain@jaffa jain]$ ./a.out
OK!
[jain@jaffa jain]$ icpc -V
Intel C++ Compiler for 32-bit applications, Version 7.1 Build 20030507Z
...
...
CP
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page