This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs-971122 bug: incorrect code, object destroyed immdiately


egcs generates incorrect code for the simple code below.
( 'X* x = new X; return x + 1;' works )

uname -a: SunOS zeal 5.5 Generic sun4u sparc SUNW,Ultra-1

c++ source
---------------------------------
class X {
public:
   X(void);
};

X* f(void) {
  return  (new X) + 1; 
}
---------------------------------


/export/home/users/joseph/egcs-971122/bin/g++ -v -S b12.cc
Reading specs from
/export/home/users/joseph/egcs-971122/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.90.17/specs
gcc version egcs-2.90.17 971114 (gcc2-970802 experimental)

/export/home/users/joseph/egcs-971122/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.90.17/cpp
-lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90
-Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__
-D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4)
-D__EXCEPTIONS -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) b12.cc
/var/tmp/cca007KQ.ii
GNU CPP version egcs-2.90.17 971114 (gcc2-970802 experimental) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /export/home/users/joseph/egcs-971122/include/g++
 /usr/local/include
 /export/home/users/joseph/egcs-971122/sparc-sun-solaris2.5/include

/export/home/users/joseph/egcs-971122/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.90.17/include
 /usr/include
End of search list.

/export/home/users/joseph/egcs-971122/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.90.17/cc1plus
/var/tmp/cca007KQ.ii -quiet -dumpbase b12.cc -version -o b12.s
GNU C++ version egcs-2.90.17 971114 (gcc2-970802 experimental)
(sparc-sun-solaris2.5) compiled by GNU C version 2.7.2.2.


Compilation finished at Wed Nov 26 12:19:18


b12.s
---------------------------------
	.file	"b12.cc"
! GNU C++ version egcs-2.90.17 971114 (gcc2-970802 experimental)
(sparc-sun-solaris2.5) compiled by GNU C version 2.7.2.2.
! options passed: 
! options enabled:  -fpeephole -ffunction-cse -fkeep-static-consts
! -fpcc-struct-return -fexceptions -fcommon -fverbose-asm -fgnu-linker
! -fargument-alias -mepilogue -mapp-regs

gcc2_compiled.:
	.global __throw
.section	".text"
	.align 4
	.global f__Fv
	.type	 f__Fv,#function
	.proc	0110
f__Fv:
.LLFB1:
	!#PROLOGUE# 0
	save %sp,-112,%sp
.LLCFI0:
	!#PROLOGUE# 1
	mov 1,%o0
	call __builtin_new,0
	nop
	mov %o0,%l0
	mov %l0,%o0
	call __1X,0
	nop
	mov %o0,%l1
	mov %l0,%o0
	call __builtin_delete,0            
??????????????????????????????????????????????
	nop
.LLEHB3:
.LLEHE3:
	b .LL4
	nop
.LL2:
	nop
.LL4:
	add %l1,1,%o0
	mov %o0,%i0
	b .LL1
	nop
	b .LL5
	nop
.LLEHB7:
.LL3:
	sethi %hi(__eh_pc),%o0
	sethi %hi(.LL2),%o2
	or %o2,%lo(.LL2),%o1
	st %o1,[%o0+%lo(__eh_pc)]
	call __throw,0
	nop
.LLEHE7:
	b .LL8
	nop
.LL6:
	nop
.LL8:
.LL7:
	call terminate__Fv,0
	nop
.LL5:
	b .LL9
	nop
	b .LL1
	nop
.LL9:
.LL1:
	ret
	restore
.LLFE1:
.LLfe1:
	.size	 f__Fv,.LLfe1-f__Fv
.section	".gcc_except_table",#alloc,#write
	.align 4
__EXCEPTION_TABLE__:
	.uaword	.LLEHB3
	.uaword	.LLEHE3
	.uaword	.LL3

	.uaword	.LLEHB7
	.uaword	.LLEHE7
	.uaword	.LL7

	.uaword	-1
	.uaword	-1
	.uaword	-1


.section	".eh_frame",#alloc,#write
__FRAME_BEGIN__:
	.uaword	.LLECIE1-.LLSCIE1
.LLSCIE1:
	.uaword	0x0
	.byte	0x1
	.asciz	"eh"

	.uaword	__EXCEPTION_TABLE__
	.byte	0x1
	.byte	0x7c
	.byte	0x65
	.byte	0xc
	.byte	0xe
	.byte	0x0
	.byte	0x9
	.byte	0x65
	.byte	0xf
	.align 4
.LLECIE1:
	.uaword	.LLEFDE1-.LLSFDE1
.LLSFDE1:
	.uaword	.LLSFDE1-__FRAME_BEGIN__
	.uaword	.LLFB1
	.uaword	.LLFE1-.LLFB1
	.byte	0x4
	.uaword	.LLCFI0-.LLFB1
	.byte	0xd
	.byte	0x1e
	.byte	0x2d
	.byte	0x9
	.byte	0x65
	.byte	0x1f
	.align 4
.LLEFDE1:
	.ident	"GCC: (GNU) egcs-2.90.17 971114 (gcc2-970802 experimental)"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]