Bug 15142 - [3.4/4.0 Regression] Internal compiler error when passing a string where a char* is expecteted in a throw statement
[3.4/4.0 Regression] Internal compiler error when passing a string where a ch...
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
3.4.0
: P2 normal
: 3.4.1
Assigned To: Jason Merrill
: ice-on-valid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-04-26 08:45 UTC by Michael Cieslinski
Modified: 2004-10-30 21:11 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3 3.3.4
Known to fail: 3.4.0 4.0.0
Last reconfirmed: 2004-04-26 13:54:09


Attachments
preprocessed source (391.24 KB, text/plain)
2004-04-26 08:46 UTC, Michael Cieslinski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Cieslinski 2004-04-26 08:45:05 UTC
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);
}
Comment 1 Michael Cieslinski 2004-04-26 08:46:36 UTC
Created attachment 6164 [details]
preprocessed source
Comment 2 Andrew Pinski 2004-04-26 11:24:32 UTC
Confirmed but not yet reduced.
Comment 3 Wolfgang Bangerth 2004-04-26 13:54:07 UTC
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. 
Comment 4 Andrew Pinski 2004-04-26 15:01:41 UTC
This looks similar to bug 11971 which was fixed for 3.4.0.
Comment 5 Wolfgang Bangerth 2004-04-26 15:37:44 UTC
Except that this one isn't. 
W. 
Comment 6 Mark Mitchell 2004-05-31 21:39:12 UTC
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
Comment 7 CVS Commits 2004-06-01 20:28:28 UTC
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

Comment 8 CVS Commits 2004-06-01 20:28:40 UTC
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

Comment 9 CVS Commits 2004-06-02 20:30:50 UTC
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

Comment 10 Jason Merrill 2004-06-02 20:31:24 UTC
fixed