Summary: | [3.3/3.4/4.0 regression] internal compiler error: in c_expand_expr, at c-common.c:4138 | ||
---|---|---|---|
Product: | gcc | Reporter: | Kai-Uwe Bux <jkherciueh> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bangerth, gcc-bugs |
Priority: | P2 | ||
Version: | 3.4.0 | ||
Target Milestone: | 3.4.2 | ||
Host: | Target: | ||
Build: | Known to work: | 2.95.3 | |
Known to fail: | 3.2.3 3.3.3 3.4.0 4.0.0 | Last reconfirmed: | 2004-06-09 13:17:39 |
Bug Depends on: | 15898 | ||
Bug Blocks: |
Description
Kai-Uwe Bux
2004-06-09 12:09:33 UTC
Confirmed. It worked with 2.95, but never since. On active branches we get g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc x.cc: In function `int main()': x.cc:13: internal compiler error: in c_expand_expr, at c-common.c:4341 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.4-pre/bin/c++ -c x.cc x.cc: In function `int main()': x.cc:13: internal compiler error: in c_expand_expr, at c-common.c:4138 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 gimplification failed: <<< Unknown tree: template_decl >>> <template_decl 0x4026e828 operator delete type <function_type 0x40191c3c type <void_type 0x4018ea6c void type_6 VOID align 8 symtab 0 alias set -1 pointer_to_this <pointer_type 0x4018eae0>> QI size <integer_cst 0x4018f198 constant invariant 8> unit size <integer_cst 0x4018f030 constant invariant 1> align 8 symtab 0 alias set -1 arg-types <tree_list 0x4018f798 value <pointer_type 0x4018eae0> chain <tree_list 0x4018f3d8 tree_2 value <void_type 0x4018ea6c void>>> pointer_to_this <pointer_type 0x40270f68>> VOID file x.cc line 5 align 1 arguments <tree_list 0x4026d408 purpose <integer_cst 0x4018f030 1> value <tree_vec 0x4026d3f0 type <template_decl 0x4026e828 operator delete> elt 0 <tree_list 0x4026d3d8>>> result <function_decl 0x4026e7b4 operator delete type <function_type 0x40191c3c> public static decl_5 QI file x.cc line 5 arguments <parm_decl 0x4026e6cc raw type <pointer_type 0x4018eae0> used unsigned SI file x.cc line 5 size <integer_cst 0x4018f048 constant invariant 32> unit size <integer_cst 0x4018f0a8 constant invariant 4> align 32 context <function_decl 0x4026e7b4 operator delete>> result <result_decl 0x4026e89c type <void_type 0x4018ea6c void> VOID file x.cc line 5 align 8 context <function_decl 0x4026e7b4 operator delete>> initial <block 0x401fe2ec> template-info 0x4026d4f8 saved-insns 0x40210600> chain <template_decl 0x4026e414 SmartPtr>> x.cc: In function `int main()': x.cc:13: internal compiler error: in gimplify_expr, at gimplify.c:3626 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. W. The code is invalid, btw: you can't declare operator delete a template this way (how is the compiler supposed to figure out the value of 'T'?). W. > The code is invalid, btw: you can't declare operator delete a template > this way (how is the compiler supposed to figure out the value of 'T'?). > > W. Sure, but if you ditch that "template< typename T >", the error won't show :-) Kai-Uwe ps. I was mistaken about minimality. I forgot to take out the smart pointer template. Thus, this is shorter. It still triggers the internal error: template < typename T > void operator delete ( void* raw ) { delete raw; } class A { }; int main() { A* a = new A; delete a; } > Sure, but if you ditch that "template< typename T >", the error
> won't show :-)
Right :-) This information is only important to us when determining
which bugs need to be fixed first, and which are not that important
because users can work around them by fixing their codes :-)
W.
> > > The code is invalid, btw: you can't declare operator delete a template > > > this way (how is the compiler supposed to figure out the value of 'T'?). > > > > Sure, but if you ditch that "template< typename T >", the error > > won't show :-) > > Right :-) This information is only important to us when determining > which bugs need to be fixed first, and which are not that important > because users can work around them by fixing their codes :-) Fair enough. Then it might be of interest that the following code template < typename T > void operator delete ( void* raw ) {} int main() { void* a = new char; delete a; } compiles without triggering any warnings (I use -Wall -pedantic). And, I have no idea if a is actually being deleted or not. How did the compiler figure out the value of T? Or did it not look at the template at all? Before I forget, many thanks for looking into this and even helping me to understand my own crappy code. That's just great! I am still struggeling hard with the sheer complexity of C++ :-) Best regards Kai-Uwe True, I just opened new PR 15898 for this. However, for this PR, the testcase in comment #3 is the one we're concerned about. W. : Search converges between 2001-05-20-trunk (#20) and 2001-05-27-trunk (#21). Subject: Bug 15890 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2004-08-19 20:16:03 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog pt.c Added files: gcc/testsuite/g++.dg/template: delete1.C Log message: PR c++/15890 * pt.c (push_template_decl_real): Disallow template allocation functions with fewer than two parameters. PR c++/15890 * g++.dg/template/delete1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4161&r2=1.4162 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/delete1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4286&r2=1.4287 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.910&r2=1.911 Subject: Bug 15890 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: mmitchel@gcc.gnu.org 2004-08-19 20:18:23 Modified files: gcc/cp : ChangeLog pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: delete1.C Log message: PR c++/15890 * pt.c (push_template_decl_real): Disallow template allocation functions with fewer than two parameters. PR c++/15890 * g++.dg/template/delete1.C: New test. 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.148&r2=1.3892.2.149 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.40&r2=1.816.2.41 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.251&r2=1.3389.2.252 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/delete1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 Fixed in GCC 3.4.2. *** Bug 15898 has been marked as a duplicate of this bug. *** |