public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138
@ 2004-06-09 12:09 jkherciueh at gmx dot net
  2004-06-09 13:17 ` [Bug c++/15890] [3.3/3.4/3.5 regression] " bangerth at dealii dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jkherciueh at gmx dot net @ 2004-06-09 12:09 UTC (permalink / raw)
  To: gcc-bugs

The compiler asked me to submit a bug report. This is the first time, I am doing
this, so please be patient. I am using gcc-3.4.0 (April 20) on Linux 2.4.24. The
following very small file triggers an internal error. I do not claim the code to
be valid. It does not include any other files.

// minimal trigger

template < typename T >
class SmartPtr {};

template < typename T >
void operator delete ( void* raw ) {
  delete raw;
}

class A { };

int main() {
   A* a = new A;
   delete a;
}

// end of file

Here is what the compiler prints before dying:

gcc-3.4.0-killer.cc: In function `int main()':
gcc-3.4.0-killer.cc:15: 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.

Here is the output from gcc -v:

Reading specs from
/mnt/target/lfs/my_dist/shaddow/pkg/gcc-3.4.0/usr/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ./configure
--prefix=/mnt/target/lfs/my_dist/shaddow/pkg/gcc-3.4.0/usr/ --enable-threads
Thread model: posix
gcc version 3.4.0

Here is the commandline:

news_group> /mnt/target/lfs/my_dist/shaddow/pkg/gcc-3.4.0/usr/bin/g++ -I
/usr/include -I /home/bux/bux/todo/towrite/c++ -Wall -pedantic gcc-3.4.0-killer.cc

-- 
           Summary: internal compiler error: in c_expand_expr, at c-
                    common.c:4138
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jkherciueh at gmx dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: ?
  GCC host triplet: ?
GCC target triplet: ?


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
@ 2004-06-09 13:17 ` bangerth at dealii dot org
  2004-06-09 13:19 ` bangerth at dealii dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-06-09 13:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-09 13:17 -------
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. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
  GCC build triplet|?                           |
   GCC host triplet|?                           |
 GCC target triplet|?                           |
      Known to fail|                            |3.2.3 3.3.3 3.4.0 3.5.0
      Known to work|                            |2.95.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-09 13:17:39
               date|                            |
            Summary|internal compiler error: in |[3.3/3.4/3.5 regression]
                   |c_expand_expr, at c-        |internal compiler error: in
                   |common.c:4138               |c_expand_expr, at c-
                   |                            |common.c:4138
   Target Milestone|---                         |3.4.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
  2004-06-09 13:17 ` [Bug c++/15890] [3.3/3.4/3.5 regression] " bangerth at dealii dot org
@ 2004-06-09 13:19 ` bangerth at dealii dot org
  2004-06-09 13:35 ` jkherciueh at gmx dot net
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-06-09 13:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-09 13:19 -------
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. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
  2004-06-09 13:17 ` [Bug c++/15890] [3.3/3.4/3.5 regression] " bangerth at dealii dot org
  2004-06-09 13:19 ` bangerth at dealii dot org
@ 2004-06-09 13:35 ` jkherciueh at gmx dot net
  2004-06-09 14:04 ` bangerth at dealii dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jkherciueh at gmx dot net @ 2004-06-09 13:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jkherciueh at gmx dot net  2004-06-09 13:35 -------
> 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;
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
                   ` (2 preceding siblings ...)
  2004-06-09 13:35 ` jkherciueh at gmx dot net
@ 2004-06-09 14:04 ` bangerth at dealii dot org
  2004-06-09 14:25 ` jkherciueh at gmx dot net
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-06-09 14:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-09 14:04 -------
> 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. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
                   ` (3 preceding siblings ...)
  2004-06-09 14:04 ` bangerth at dealii dot org
@ 2004-06-09 14:25 ` jkherciueh at gmx dot net
  2004-06-09 16:03 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jkherciueh at gmx dot net @ 2004-06-09 14:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jkherciueh at gmx dot net  2004-06-09 14:25 -------
> > > 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

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
                   ` (4 preceding siblings ...)
  2004-06-09 14:25 ` jkherciueh at gmx dot net
@ 2004-06-09 16:03 ` bangerth at dealii dot org
  2004-08-10 21:41 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-06-09 16:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-09 16:03 -------
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. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
                   ` (5 preceding siblings ...)
  2004-06-09 16:03 ` bangerth at dealii dot org
@ 2004-08-10 21:41 ` pinskia at gcc dot gnu dot org
  2004-08-19 20:16 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-10 21:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-10 21:41 -------
: Search converges between 2001-05-20-trunk (#20) and 2001-05-27-trunk (#21).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
                   ` (6 preceding siblings ...)
  2004-08-10 21:41 ` pinskia at gcc dot gnu dot org
@ 2004-08-19 20:16 ` cvs-commit at gcc dot gnu dot org
  2004-08-19 20:18 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-19 20:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-19 20:16 -------
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



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
                   ` (7 preceding siblings ...)
  2004-08-19 20:16 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-19 20:18 ` cvs-commit at gcc dot gnu dot org
  2004-08-19 20:20 ` mmitchel at gcc dot gnu dot org
  2004-08-19 20:21 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-19 20:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-19 20:18 -------
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



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
                   ` (8 preceding siblings ...)
  2004-08-19 20:18 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-19 20:20 ` mmitchel at gcc dot gnu dot org
  2004-08-19 20:21 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-19 20:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-19 20:20 -------
Fixed in GCC 3.4.2.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/15890] [3.3/3.4/3.5 regression] internal compiler error: in c_expand_expr, at c-common.c:4138
  2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
                   ` (9 preceding siblings ...)
  2004-08-19 20:20 ` mmitchel at gcc dot gnu dot org
@ 2004-08-19 20:21 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-19 20:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-19 20:21 -------
*** Bug 15898 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
Bug 15890 depends on bug 15898, which changed state.

Bug 15898 Summary: Error with templated operator delete not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15898

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATEBug 15890 depends on bug 15898, which changed state.

Bug 15898 Summary: Error with templated operator delete not detected
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15898

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15890


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-08-19 20:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-09 12:09 [Bug c++/15890] New: internal compiler error: in c_expand_expr, at c-common.c:4138 jkherciueh at gmx dot net
2004-06-09 13:17 ` [Bug c++/15890] [3.3/3.4/3.5 regression] " bangerth at dealii dot org
2004-06-09 13:19 ` bangerth at dealii dot org
2004-06-09 13:35 ` jkherciueh at gmx dot net
2004-06-09 14:04 ` bangerth at dealii dot org
2004-06-09 14:25 ` jkherciueh at gmx dot net
2004-06-09 16:03 ` bangerth at dealii dot org
2004-08-10 21:41 ` pinskia at gcc dot gnu dot org
2004-08-19 20:16 ` cvs-commit at gcc dot gnu dot org
2004-08-19 20:18 ` cvs-commit at gcc dot gnu dot org
2004-08-19 20:20 ` mmitchel at gcc dot gnu dot org
2004-08-19 20:21 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).