Bug 26140 - [4.2 Regression] ice on valid C++ code
Summary: [4.2 Regression] ice on valid C++ code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-02-06 23:00 UTC by David Binderman
Modified: 2006-02-07 15:39 UTC (History)
3 users (show)

See Also:
Host:
Target: x86_64-suse-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-07 00:35:43


Attachments
C++ source code (76.55 KB, application/octet-stream)
2006-02-06 23:02 UTC, David Binderman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2006-02-06 23:00:29 UTC
I just tried to compile package lilypond-2.6.5-2 from Suse Linux with a recent
GNU C++ compiler version 4.2 snapshot 20060204. 

The compiler snapshot said

rm -f ./out/drum-note-performer.dep; DEPENDENCIES_OUTPUT="./out/drum-note-performer.dep ./out/drum-note-performer.o" /home/dcb/gnu/42-20060204/results/bin/g++ -g -O3 -Wall -fmessage-length=0 -c -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H  -DNDEBUG -DSTRING_UTILS_INLINED -Iinclude -I./out -I../flower/include -I../flower/./out -I../flower/include -I/usr/include/python2.4   -DNDEBUG -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -O2 -finline-functions -pipe  -I/opt/gnome/include/pango-1.0 -I/usr/include/freetype2 -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib64/glib-2.0/include -I/usr/include/freetype2       -I/usr/include/python2.4   -DNDEBUG -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -O2 -finline-functions -pipe  -I/opt/gnome/include/pango-1.0 -I/usr/include/freetype2 -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib64/glib-2.0/include    -I/usr/include/freetype2   -W -Wall -Wconversion  -o out/drum-note-performer.o drum-note-performer.cc
drum-note-performer.cc: In member function "virtual void Drum_note_performer::create_audio_elements()"
drum-note-performer.cc:48: internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:1594Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [out/drum-note-performer.o] Error 1


Preprocessed source code attached.  No special flags required.
Comment 1 David Binderman 2006-02-06 23:02:21 UTC
Created attachment 10793 [details]
C++ source code
Comment 2 Andrew Pinski 2006-02-06 23:30:59 UTC
Reducing.
Comment 3 Andrew Pinski 2006-02-06 23:39:47 UTC
It worked with "4.2.0 20051217".
Comment 4 Andrew Pinski 2006-02-07 00:35:43 UTC
Reduced testcase:
struct Pitch
{
  int notename_;
};
struct Audio_note
{
  Audio_note (Pitch p);
};
void create_audio_elements ()
{
  Pitch *pit;
  new Audio_note (*pit);
}
--------
Looks like this is caused by:
2006-01-30  Richard Guenther  <rguenther@suse.de>

        PR c++/23372
        * gimplify.c (gimplify_target_expr): Handle easy cases
        without creating a temporary.
------
The reason I said this patch is because the IR looks like:
  (void) (TARGET_EXPR <D.2018, *(struct Pitch &) (struct Pitch *) NON_LVALUE_EXPR <pit>>;, TARGET_EXPR <D.1993, (struct Audio_note *) operator new (1)>;, try
    {
      __comp_ctor  (NON_LVALUE_EXPR <D.1993>, D.2018);
    }
  catch
    {
      operator delete ((void *) D.1993);
    }, D.1993) >>>
>>;
So we reduce the TARGET_EXPR to *pit but we reference  D.2018 in the other expression.
Comment 5 Richard Biener 2006-02-07 10:07:35 UTC
Ho humm, so I propose to revert the patch (that I didn't like very much anyway).  Can I do so without approval?
Comment 6 Andrew Pinski 2006-02-07 14:46:56 UTC
(In reply to comment #5)
> Ho humm, so I propose to revert the patch (that I didn't like very much
> anyway).  Can I do so without approval?

Yes but what about fixing the C++ front-end so that it does not place the TARGET_EXPR in the wrong spot?
Comment 7 Richard Biener 2006-02-07 15:36:47 UTC
Subject: Bug 26140

Author: rguenth
Date: Tue Feb  7 15:36:44 2006
New Revision: 110699

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110699
Log:
2006-02-07  Richard Guenther  <rguenther@suse.de>

	PR c++/26140
	Revert
	2006-01-30  Richard Guenther  <rguenther@suse.de>
 	PR c++/23372
 	* gimplify.c (gimplify_target_expr): Handle easy cases
 	without creating a temporary.

	Revert
	2006-01-30  Richard Guenther  <rguenther@suse.de>
 	PR c++/23372
 	* gcc.dg/pr23372-1.C: New testcase.

	* g++.dg/tree-ssa/pr26140.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr26140.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/pr23372-1.c

Comment 8 Richard Biener 2006-02-07 15:39:21 UTC
Fixed.