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.
Created attachment 10793 [details] C++ source code
Reducing.
It worked with "4.2.0 20051217".
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.
Ho humm, so I propose to revert the patch (that I didn't like very much anyway). Can I do so without approval?
(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?
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
Fixed.