This is the mail archive of the gcc-prs@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]
Other format: [Raw text]

c++/8035: optimizing access to a const member causes illegal code to be generated on powerpc


>Number:         8035
>Category:       c++
>Synopsis:       optimizing access to a const member causes illegal code to be generated on powerpc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 25 05:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Rob Taylor
>Release:        gcc version 3.2.1 20020912 (Debian prerelease)
>Organization:
>Environment:
debian woody with gcc packages from sid. powerpc. 
>Description:
compile the test case with -O2. The generated code for BuildArray2 calls object<X1>::set_new with r5=0, where it should be a pointer to powner.

here is the asm output (demangled) that i get, with the erronous line highlighted:

	.file	"const-opt-bug.cpp"
	.section	".text"
	.align 2
	.globl ___GetX1()
	.type	___GetX1(),@function
___GetX1():
.LFB1:
	blr
.LFE1:
.Lfe1:
	.size	___GetX1(),.Lfe1-___GetX1()
	.align 2
	.globl BuildArray()
	.type	BuildArray(),@function
BuildArray():
.LFB2:
	stwu 1,-32(1)
.LCFI0:
	mflr 0
	li 5,0
	stw 31,28(1)
.LCFI1:
	addi 31,1,12
	stw 30,24(1)
.LCFI2:
	mr 30,3
	stw 5,8(1)
	stw 0,36(1)
.LCFI3:
	stb 0,12(1)
	bl ___GetX1()
	lwz 5,8(1)
	mr 4,3
	addi 3,1,8
	cmpw 0,5,31
	beq- 0,.L5
	stw 31,8(1)
	mr 5,31
.L5:
	bl object<X1>::set_new(Bla*, Owner const&)
	lwz 31,28(1)
	lwz 0,36(1)
	mr 3,30
	lwz 30,24(1)
	addi 1,1,32
	mtlr 0
	blr
.LFE2:
.Lfe2:
	.size	BuildArray(),.Lfe2-BuildArray()
	.align 2
	.globl BuildArray2()
	.type	BuildArray2(),@function
BuildArray2():
.LFB3:
	stwu 1,-32(1)
.LCFI4:
	mflr 0
	stw 29,20(1)
.LCFI5:
	li 29,0
	stw 29,0(3)
	stw 30,24(1)
.LCFI6:
	addi 30,1,8
	stw 31,28(1)
.LCFI7:
	mr 31,3
	stw 0,36(1)
.LCFI8:
	stb 0,8(1)
	bl ___GetX1()
	cmpw 0,29,30
	mr 4,3
	li 5,0        *********************<< ERROR HERE!!
	mr 3,31
	beq- 0,.L10
	stw 30,0(31)
.L10:
	bl object<X1>::set_new(Bla*, Owner const&)
	lwz 30,24(1)
	lwz 0,36(1)
	mr 3,31
	lwz 29,20(1)
	lwz 31,28(1)
	mtlr 0
	addi 1,1,32
	blr
.LFE3:
.Lfe3:
	.size	BuildArray2(),.Lfe3-BuildArray2()
	.section	.eh_frame,"aw",@progbits
.Lframe1:
	.4byte	.LECIE1-.LSCIE1
.LSCIE1:
	.4byte	0x0
	.byte	0x1
	.string	"zP"
	.uleb128 0x1
	.sleb128 -4
	.byte	0x41
	.uleb128 0x5
	.byte	0x0
	.4byte	__gxx_personality_v0
	.byte	0xc
	.uleb128 0x1
	.uleb128 0x0
	.align 2
.LECIE1:
.LSFDE3:
	.4byte	.LEFDE3-.LASFDE3
.LASFDE3:
	.4byte	.LASFDE3-.Lframe1
	.4byte	.LFB2
	.4byte	.LFE2-.LFB2
	.uleb128 0x0
	.byte	0x4
	.4byte	.LCFI0-.LFB2
	.byte	0xe
	.uleb128 0x20
	.byte	0x4
	.4byte	.LCFI1-.LCFI0
	.byte	0x9f
	.uleb128 0x1
	.byte	0x4
	.4byte	.LCFI2-.LCFI1
	.byte	0x9e
	.uleb128 0x2
	.byte	0x4
	.4byte	.LCFI3-.LCFI2
	.byte	0x11
	.uleb128 0x41
	.sleb128 -1
	.align 2
.LEFDE3:
.LSFDE5:
	.4byte	.LEFDE5-.LASFDE5
.LASFDE5:
	.4byte	.LASFDE5-.Lframe1
	.4byte	.LFB3
	.4byte	.LFE3-.LFB3
	.uleb128 0x0
	.byte	0x4
	.4byte	.LCFI4-.LFB3
	.byte	0xe
	.uleb128 0x20
	.byte	0x4
	.4byte	.LCFI5-.LCFI4
	.byte	0x9d
	.uleb128 0x3
	.byte	0x4
	.4byte	.LCFI6-.LCFI5
	.byte	0x9e
	.uleb128 0x2
	.byte	0x4
	.4byte	.LCFI7-.LCFI6
	.byte	0x9f
	.uleb128 0x1
	.byte	0x4
	.4byte	.LCFI8-.LCFI7
	.byte	0x11
	.uleb128 0x41
	.sleb128 -1
	.align 2
.LEFDE5:
	.ident	"GCC: (GNU) 3.2.1 20020912 (Debian prerelease)"
>How-To-Repeat:
g++ -O2 const-opt-bug.cpp 
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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