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); }
Created attachment 6164 [details] preprocessed source
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
Subject: Bug 15142 CVSROOT: /cvs/gcc Module name: gcc Changes by: jason@gcc.gnu.org 2004-06-01 20:28:26 Modified files: gcc/cp : ChangeLog call.c Log message: PR c++/15142 * call.c (call_builtin_trap): Remove type parm. (convert_arg_to_ellipsis): Change a non-POD argument to integer type. (build_x_va_arg): Dereference a null pointer for a non-POD argument. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4075&r2=1.4076 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.479&r2=1.480
Subject: Bug 15142 CVSROOT: /cvs/gcc Module name: gcc Changes by: jason@gcc.gnu.org 2004-06-01 20:28:38 Added files: gcc/testsuite/g++.dg/overload: ellipsis1.C Log message: PR c++/15142 * call.c (call_builtin_trap): Remove type parm. (convert_arg_to_ellipsis): Change a non-POD argument to integer type. (build_x_va_arg): Dereference a null pointer for a non-POD argument. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/ellipsis1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 15142 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: jason@gcc.gnu.org 2004-06-02 20:30:48 Modified files: gcc/cp : ChangeLog call.c Log message: PR c++/15142 * call.c (call_builtin_trap): Remove type parm. (convert_arg_to_ellipsis): Change a non-POD argument to integer type. (build_x_va_arg): Dereference a null pointer for a non-POD argument. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.113&r2=1.3892.2.114 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.452.2.17&r2=1.452.2.18
fixed