Bug 15142 - [3.4/4.0 Regression] Internal compiler error when passing a string where a char* is expecteted in a throw statement
|
Bug#:
15142
|
Product: gcc
|
Version: 3.4.0
|
|
Host:
|
Target:
|
Build:
|
|
Status: RESOLVED
|
Severity: normal
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: jason@redhat.com
|
Reported By: micis@gmx.de
|
|
Component: c++
|
Target Milestone: 3.4.1
|
|
Summary: [3.4/4.0 Regression] Internal compiler error when passing a string where a char* is expecteted in a throw statement
|
|
Keywords: ice-on-valid-code
|
|
Opened: 2004-04-26 08:45
|
|
Description:
|
Last confirmed: 2004-04-26 13:54
|
Opened: 2004-04-26 08:45
|
when compiling this small (and silly) program I get an internal compiler error:
bug34.cpp: In function `void SillyFunc()':
bug34.cpp:12: warning: cannot pass objects of non-POD type `struct std::string'
through `...'; call will abort at runtime
bug34.cpp:12: internal compiler error: in cp_expr_size, at cp/cp-lang.c:347
Please submit a full bug report,
#include <string>
class Err
{
public: Err(char *aErrText,...) {}
};
void SillyFunc()
{
std::string fullname;
throw Err("failed %s",fullname);
}
Confirmed but not yet reduced.
Here we go:
-----------------
struct B {
B() throw() { }
B(const B&) throw() { }
};
struct X {
B a;
X& operator=(const X&);
};
struct S { S(...); };
void SillyFunc() {
throw S(X());
}
---------------------
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc
x.cc: In function `void SillyFunc()':
x.cc:14: warning: cannot pass objects of non-POD type `struct X' through
`...';
call will abort at runtime
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void SillyFunc()':
x.cc:14: warning: cannot pass objects of non-POD type `struct X' through
`...';
call will abort at runtime
x.cc:14: internal compiler error: in cp_expr_size, at cp/cp-lang.c:347
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc
x.cc: In function `void SillyFunc()':
x.cc:14: warning: cannot pass objects of non-POD type `struct X' through
`...';
call will abort at runtime
x.cc:14: internal compiler error: in cp_expr_size, at cp/cp-lang.c:347
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
W.
This looks similar to bug 11971 which was fixed for 3.4.0.
Except that this one isn't.
W.
Jason --
This is caused by the call_builtin_trap() stuff that you added; that function
wants to make a TARGET_EXPR and the backend wants to copy stuff around. Instead
of making a TARGET_EXPR, why not dereference a NULL pointer?
(I think I'd rather that we just issue an error, but maybe a careful reading of
the standard does not permit an error here?)
In any case, please fix this regression.
Thanks,
-- Mark