public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Fault report
@ 2004-04-15 12:04 Wolfgang.Roehrl
  2004-04-15 20:10 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang.Roehrl @ 2004-04-15 12:04 UTC (permalink / raw)
  To: gcc-bugs

[-- Attachment #1: Type: text/plain, Size: 1905 bytes --]





Dear all,

I would like to post a fault report for the GNU C/C++ compiler 3.3-e500.

We use the compiler to generate code for a PowerPC processor.

Used invokation line for the GNU C++ compiler:

ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig
-mmultiple
      -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti
      -I<different include paths>
      -D<differen #define's>
      Y.CPP -oY.O



// example program

#define MODE 1         // 0 or 1


template <typename T_>
struct type_tag
{
    typedef T_ type;
};



template <typename T_>
struct XYZ
{
    XYZ ()
    {
        ptr1 = new T_;
        ptr2 = 0;
    }

    template <typename U_>
    XYZ (const type_tag<U_>&)
    {
        ptr1 = 0;
        ptr2 = new U_;
    }

    template <typename U_, typename P_>
    XYZ (const type_tag<U_>&, const P_& p)
    {
        ptr1 = 0;
        ptr2 = new U_(p);
    }

private:
    T_* ptr1;
    void* ptr2;
};


XYZ<int> xyz1;

type_tag<char> t;
XYZ<int> xyz2 (t);
XYZ<int> xyz3 (t, 'a');

typedef type_tag<char> TT;

XYZ<int> xyz4 (TT());                       // <--- object is not allocated
XYZ<int> xyz5 (type_tag<char>());           // <--- object is not allocated

#if (MODE == 1)
  XYZ<int> xyz6 (TT(), 'a');                // <--- 'syntax error' (line
53)
  XYZ<int> xyz7 (type_tag<char>(), 'a');    // <--- 'syntax error' (line
54)
#endif


If the macro MODE is defined to 1, the compiler gives the following error
messages:

y.CPP:53: error: type specifier omitted for parameter
y.CPP:53: error: syntax error before 'a'
y.CPP:54: error: type specifier omitted for parameter
y.CPP:54: error: syntax error before 'a'


If MODE is defined to 0, I get no error message but the objects xyz4 and
xyz5
are neither allocated nor constructed. (The corresponding assembler listing
is
attached as file GNU2.TXT.)



With kind regards
W. Roehrl

(See attached file: Gnu2.txt)

[-- Attachment #2: Gnu2.txt --]
[-- Type: application/octet-stream, Size: 3274 bytes --]

	.file	"y.CPP"

 # rs6000/powerpc options: -mcpu=8540 -msdata=data
 # GNU C++ version 3.3-e500 20030421 (Wind River) (powerpc-wrs-vxworks)
 #	compiled by GNU C version 3.2.2.
 # GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32684
 # options passed:  -I. -ID:\\GNU_NG\\target\\h
 # -ID:\\GNU_NG\\target\\h\\types -ID:\\GNU_NG\\target\\h\\arch\\ppc
 # -iprefix -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0
 # -DCPU=PPC85XX -DTOOL_FAMILY=gnu -DTOOL=gnu -D__GNUG__=3 -mcpu=8540 -mbig
 # -mmultiple -mno-string -mstrict-align -ansi -auxbase-strip -O3 -Wall
 # -Werror -ansi -fverbose-asm -fno-exceptions -fno-rtti
 # -fno-builtin-printf -oy.ASS
 # options enabled:  -fdefer-pop -fomit-frame-pointer
 # -foptimize-sibling-calls -fcse-follow-jumps -fcse-skip-blocks
 # -fexpensive-optimizations -fthread-jumps -fstrength-reduce -fpeephole
 # -fforce-mem -ffunction-cse -fkeep-static-consts -fcaller-saves
 # -freg-struct-return -fgcse -fgcse-lm -fgcse-sm -floop-optimize
 # -fcrossjumping -fif-conversion -fif-conversion2 -frerun-cse-after-loop
 # -frerun-loop-opt -fdelete-null-pointer-checks -fschedule-insns
 # -fschedule-insns2 -fsched-interblock -fsched-spec -fbranch-count-reg
 # -freorder-blocks -freorder-functions -frename-registers
 # -fcprop-registers -fcommon -fverbose-asm -fregmove
 # -foptimize-register-move -fargument-alias -fstrict-aliasing
 # -fmerge-constants -fzero-initialized-in-bss -fident -fpeephole2
 # -fguess-branch-probability -fmath-errno -ftrapping-math -mpowerpc
 # -mpowerpc-gfxopt -mnew-mnemonics -mmultiple -mno-multiple -mno-string
 # -msched-prolog -msched-epilog -mstrict-align -meabi -mcpu=8540
 # -mcall-sysv -msdata=data

	.globl xyz1
	.lcomm	xyz1,8,4
	.type	xyz1, @object
	.globl t
	.lcomm	t,1,1
	.type	t, @object
	.globl xyz2
	.lcomm	xyz2,8,4
	.type	xyz2, @object
	.globl xyz3
	.lcomm	xyz3,8,4
	.type	xyz3, @object
	.section	".text"
	.align 2
	.type	_Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
	stwu 1,-24(1)
	mflr 5
	mr 7,3	 #  __initialize_p
	xori 6,4,65535	 #  __priority
	subfic 9,6,0
	adde 6,9,6
	li 3,4
	stw 5,28(1)
	stmw 28,8(1)
	xori 5,7,1	 #  __initialize_p
	subfic 9,5,0
	adde 5,9,5
	lis 29,xyz1@ha
	and. 9,6,5
	li 31,0
	la 28,xyz1@l(29)
	bne- 0,.L8
.L1:
	lwz 3,28(1)
	lmw 28,8(1)
	addi 1,1,24
	mtlr 3
	blr
.L8:
	bl _Znwj
	stw 31,4(28)	 #  <variable>.ptr2
	mr 9,3	 #  __initialize_p
	lis 10,xyz2@ha
	stw 9,xyz1@l(29)	 #  <variable>.ptr1,  __initialize_p
	li 3,1
	stw 31,xyz2@l(10)	 #  <variable>.ptr1
	la 29,xyz2@l(10)
	bl _Znwj
	stw 3,4(29)	 #  <variable>.ptr2,  __initialize_p
	lis 8,xyz3@ha
	li 3,1
	la 28,xyz3@l(8)
	stw 31,xyz3@l(8)	 #  <variable>.ptr1
	bl _Znwj
	li 4,97
	stb 4,0(3)	 # * __initialize_p
	stw 3,4(28)	 #  <variable>.ptr2,  __initialize_p
	b .L1
	.size	_Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
	.align 2
	.globl _GLOBAL__I_xyz1
	.type	_GLOBAL__I_xyz1, @function
_GLOBAL__I_xyz1:
	li 0,0
	li 3,1
	ori 4,0,65535
	b _Z41__static_initialization_and_destruction_0ii
	.size	_GLOBAL__I_xyz1, .-_GLOBAL__I_xyz1
	.ident	"GCC: (GNU) 3.3-e500 20030421 (Wind River)"

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

* Re: Fault report
  2004-04-15 12:04 Fault report Wolfgang.Roehrl
@ 2004-04-15 20:10 ` Jim Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2004-04-15 20:10 UTC (permalink / raw)
  To: Wolfgang.Roehrl; +Cc: gcc-bugs

Wolfgang.Roehrl@de.gi-de.com wrote:
> I would like to post a fault report for the GNU C/C++ compiler 3.3-e500.

You are more likely to get an answer if you file a bug report into our 
bugzilla bug database.  See
	http://gcc.gnu.org/bugs.html
for more info.

We do not track bug reports submitted via email bug gcc-bugs.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

* Fault report
@ 2004-03-18 11:48 Wolfgang.Roehrl
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang.Roehrl @ 2004-03-18 11:48 UTC (permalink / raw)
  To: gcc-bugs

[-- Attachment #1: Type: text/plain, Size: 2659 bytes --]





Dear all,

I would like to post two fault reports for the GNU C/C++ compiler 3.3-e500.

We use the compiler to generate code for a PowerPc processor and one bug
is related to to code generator and the other bug is related to the
compiler front
end.

Used invokation line for the C++ compiler:

ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig
-mmultiple
      -mno-string -mstrict-align -O3 -fno-exceptions -fno-rtti
      -I<different include paths>
      -D<differen #define's>
      Z.CPP -oZ.O



Fault report 1 (templates and pointer to const member):
=======================================================

// example program 1

template <typename T_>
class C1
{
public:
    C1 ();
    ~C1 ();
    const int C1<T_>::* getPtr () const;

private:
    int x;
    T_ y;
};


template <typename T_>
const int C1<T_>::* C1<T_>::getPtr () const
{ return &C1<T_>::x; }                      // <-- line 17


The compiler gives the following error message:

z.CPP:17: error: too few template parameter lists in declaration of `const
int
   C1<T_>::* C1<T_>::getPtr() const'


We get no error message if a typedef is introduced:

// example program 2

template <typename T_>
class C1
{
    typedef const int C1<T_>::* T_C1_INT_PTR;

public:
    C1 ();
    ~C1 ();
    T_C1_INT_PTR getPtr () const;

private:
    int x;
    T_ y;
};


template <typename T_>
typename C1<T_>::T_C1_INT_PTR C1<T_>::getPtr () const
{ return &C1<T_>::x; }



Fault report 2 (::delete and multiple inheritance):
===================================================

// example program

class B1
{
public:
    virtual ~B1 () throw();

protected:
    B1 ();

private:
    int x;
};


class B2
{
public:
    virtual ~B2 () throw();

protected:
    B2 ();

private:
    int x;
};


class D : public B1, public B2
{
public:
    D ();
    ~D () throw();

private:
    int y;
};


void f1 (D*);
void f2 (B2*);
void f3 (B1*);


void f (void)
{
    f1 (::new D);
    f2 (::new D);     // correct address adjustement D -> B2, see assembler
listing
    f3 (::new D);
}


void f1 (D* p) { ::delete p; }
void f2 (B2* p) { ::delete p; }  // missing address adjustment B2 -> D for
the call of ::operator delete()
void f3 (B1* p) { ::delete p; }


In function f2() the deallocation function ::operator delete() (assembler
call 'bl _ZdlPv') is called, but the deallocation function does not get the
address of the
dynamic D-object.

The corresponding assembler listing is attached as file GNU1.TXT.

I think that the code above is legal, cf. the C++ standard 5.3.4/9, 5.3.4
/18
(for constructor exceptions) and 5.3.5/8.



With kind regards
W. Roehrl


(See attached file: Gnu1.txt)

[-- Attachment #2: Gnu1.txt --]
[-- Type: application/octet-stream, Size: 7019 bytes --]

	.file	"z.CPP"

 # rs6000/powerpc options: -mcpu=8540 -msdata=data
 # GNU C++ version 3.3-e500 20030421 (Wind River) (powerpc-wrs-vxworks)
 #	compiled by GNU C version 3.2.2.
 # GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32684
 # options passed:  -I. -ID:\\GNU_NG\\target\\h
 # -ID:\\GNU_NG\\target\\h\\types -ID:\\GNU_NG\\target\\h\\arch\\ppc
 # -iprefix -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0
 # -DCPU=PPC85XX -DTOOL_FAMILY=gnu -DTOOL=gnu -D__GNUG__=3 -mcpu=8540 -mbig
 # -mmultiple -mno-string -mstrict-align -ansi -auxbase-strip -O3 -Wall
 # -Werror -ansi -fverbose-asm -fno-exceptions -fno-rtti -oz.ASS
 # options enabled:  -fdefer-pop -fomit-frame-pointer
 # -foptimize-sibling-calls -fcse-follow-jumps -fcse-skip-blocks
 # -fexpensive-optimizations -fthread-jumps -fstrength-reduce -fpeephole
 # -fforce-mem -ffunction-cse -fkeep-static-consts -fcaller-saves
 # -freg-struct-return -fgcse -fgcse-lm -fgcse-sm -floop-optimize
 # -fcrossjumping -fif-conversion -fif-conversion2 -frerun-cse-after-loop
 # -frerun-loop-opt -fdelete-null-pointer-checks -fschedule-insns
 # -fschedule-insns2 -fsched-interblock -fsched-spec -fbranch-count-reg
 # -freorder-blocks -freorder-functions -frename-registers
 # -fcprop-registers -fcommon -fverbose-asm -fregmove
 # -foptimize-register-move -fargument-alias -fstrict-aliasing
 # -fmerge-constants -fzero-initialized-in-bss -fident -fpeephole2
 # -fguess-branch-probability -fmath-errno -ftrapping-math -mpowerpc
 # -mpowerpc-gfxopt -mnew-mnemonics -mmultiple -mno-multiple -mno-string
 # -msched-prolog -msched-epilog -mstrict-align -meabi -mcpu=8540
 # -mcall-sysv -msdata=data

	.globl _ZTV1D
	.section	.rodata
	.align 3
	.type	_ZTV1D, @object
	.size	_ZTV1D, 32
_ZTV1D:
	.long	0
	.long	0
	.long	_ZN1DD1Ev
	.long	_ZN1DD0Ev
	.long	-8
	.long	0
	.long	_ZThn8_N1DD1Ev
	.long	_ZThn8_N1DD0Ev
	.section	".text"
	.align 2
	.globl _ZN1DC2Ev
	.type	_ZN1DC2Ev, @function
_ZN1DC2Ev:
	stwu 1,-24(1)
	mflr 7
	stmw 29,12(1)
	stw 7,28(1)
	mr 29,3	 #  this
	bl _ZN2B1C2Ev
	addi 3,29,8	 #  this,  this
	bl _ZN2B2C2Ev
	lis 3,_ZTV1D+24@ha
	la 0,_ZTV1D+24@l(3)
	lwz 3,28(1)
	lis 5,_ZTV1D+8@ha
	li 6,1
	la 4,_ZTV1D+8@l(5)
	stw 6,16(29)	 #  <variable>.y
	stw 4,0(29)	 #  <variable>._vptr$B1
	mtlr 3
	stw 0,8(29)	 #  <variable>._vptr$B2
	lmw 29,12(1)
	addi 1,1,24
	blr
	.size	_ZN1DC2Ev, .-_ZN1DC2Ev
	.align 2
	.globl _ZN1DC1Ev
	.type	_ZN1DC1Ev, @function
_ZN1DC1Ev:
	stwu 1,-24(1)
	mflr 7
	stmw 29,12(1)
	stw 7,28(1)
	mr 29,3	 #  this
	bl _ZN2B1C2Ev
	addi 3,29,8	 #  this,  this
	bl _ZN2B2C2Ev
	lis 3,_ZTV1D+24@ha
	la 0,_ZTV1D+24@l(3)
	lwz 3,28(1)
	lis 5,_ZTV1D+8@ha
	li 6,1
	la 4,_ZTV1D+8@l(5)
	stw 6,16(29)	 #  <variable>.y
	stw 4,0(29)	 #  <variable>._vptr$B1
	mtlr 3
	stw 0,8(29)	 #  <variable>._vptr$B2
	lmw 29,12(1)
	addi 1,1,24
	blr
	.size	_ZN1DC1Ev, .-_ZN1DC1Ev
	.align 2
	.globl _ZN1DD2Ev
	.type	_ZN1DD2Ev, @function
_ZN1DD2Ev:
	stwu 1,-24(1)
	lis 6,_ZTV1D+8@ha
	lis 5,_ZTV1D+24@ha
	mflr 7
	la 0,_ZTV1D+24@l(5)
	stmw 29,12(1)
	li 4,-1
	mr 29,3	 #  this
	stw 7,28(1)
	la 3,_ZTV1D+8@l(6)
	stw 0,8(29)	 #  <variable>._vptr$B2
	stw 3,0(29)	 #  <variable>._vptr$B1
	addi 3,29,8	 #  this,  this
	stw 4,16(29)	 #  <variable>.y
	bl _ZN2B2D2Ev
	mr 3,29	 #  this
	bl _ZN2B1D2Ev
	lmw 29,12(1)
	lwz 3,28(1)
	addi 1,1,24
	mtlr 3
	blr
	.size	_ZN1DD2Ev, .-_ZN1DD2Ev
	.align 2
	.globl _ZN1DD1Ev
	.type	_ZN1DD1Ev, @function
_ZN1DD1Ev:
	stwu 1,-24(1)
	lis 6,_ZTV1D+8@ha
	lis 5,_ZTV1D+24@ha
	mflr 7
	la 0,_ZTV1D+24@l(5)
	stmw 29,12(1)
	li 4,-1
	mr 29,3	 #  this
	stw 7,28(1)
	la 3,_ZTV1D+8@l(6)
	stw 0,8(29)	 #  <variable>._vptr$B2
	stw 3,0(29)	 #  <variable>._vptr$B1
	addi 3,29,8	 #  this,  this
	stw 4,16(29)	 #  <variable>.y
	bl _ZN2B2D2Ev
	mr 3,29	 #  this
	bl _ZN2B1D2Ev
	lmw 29,12(1)
	lwz 3,28(1)
	addi 1,1,24
	mtlr 3
	blr
	.size	_ZN1DD1Ev, .-_ZN1DD1Ev
	.align 2
	.globl _ZThn8_N1DD1Ev
	.type	_ZThn8_N1DD1Ev, @function
_ZThn8_N1DD1Ev:
	addi 3,3,-8
	b _ZN1DD1Ev
	.size	_ZThn8_N1DD1Ev, .-_ZThn8_N1DD1Ev
	.align 2
	.globl _ZN1DD0Ev
	.type	_ZN1DD0Ev, @function
_ZN1DD0Ev:
	stwu 1,-24(1)
	lis 6,_ZTV1D+8@ha
	lis 5,_ZTV1D+24@ha
	mflr 7
	la 0,_ZTV1D+24@l(5)
	stmw 29,12(1)
	li 4,-1
	mr 29,3	 #  this
	stw 7,28(1)
	la 3,_ZTV1D+8@l(6)
	stw 0,8(29)	 #  <variable>._vptr$B2
	stw 4,16(29)	 #  <variable>.y
	stw 3,0(29)	 #  <variable>._vptr$B1
	addi 3,29,8	 #  this,  this
	bl _ZN2B2D2Ev
	mr 3,29	 #  this
	bl _ZN2B1D2Ev
	mr 3,29	 #  this
	bl _ZdlPv
	lmw 29,12(1)
	lwz 3,28(1)
	addi 1,1,24
	mtlr 3
	blr
	.size	_ZN1DD0Ev, .-_ZN1DD0Ev
	.align 2
	.globl _ZThn8_N1DD0Ev
	.type	_ZThn8_N1DD0Ev, @function
_ZThn8_N1DD0Ev:
	addi 3,3,-8
	b _ZN1DD0Ev
	.size	_ZThn8_N1DD0Ev, .-_ZThn8_N1DD0Ev
	.align 2
	.globl _Z1fv
	.type	_Z1fv, @function
_Z1fv:
	stwu 1,-40(1)
	mflr 3
	stw 3,44(1)
	stmw 25,12(1)
	li 3,20
	li 25,1
	bl _Znwj
	mr 28,3	 #  this
	bl _ZN2B1C2Ev
	addi 3,28,8	 #  this,  this
	bl _ZN2B2C2Ev
	lis 4,_ZTV1D+24@ha
	lis 5,_ZTV1D+8@ha
	stw 25,16(28)	 #  <variable>.y
	la 26,_ZTV1D+8@l(5)
	la 27,_ZTV1D+24@l(4)
	stw 26,0(28)	 #  <variable>._vptr$B1
	mr 3,28	 #  this
	stw 27,8(28)	 #  <variable>._vptr$B2
	bl _Z2f1P1D
	li 3,20
	bl _Znwj
	addi 28,3,8	 #  this,  this
	mr 29,3	 #  this
	bl _ZN2B1C2Ev
	mr 3,28	 #  this
	bl _ZN2B2C2Ev
	stw 27,8(29)	 #  <variable>._vptr$B2
	stw 25,16(29)	 #  <variable>.y
	mr 3,28	 #  this
	stw 26,0(29)	 #  <variable>._vptr$B1
	bl _Z2f2P2B2
	li 3,20
	bl _Znwj
	mr 28,3	 #  this
	bl _ZN2B1C2Ev
	addi 3,28,8	 #  this,  this
	bl _ZN2B2C2Ev
	stw 25,16(28)	 #  <variable>.y
	stw 26,0(28)	 #  <variable>._vptr$B1
	mr 3,28	 #  this
	stw 27,8(28)	 #  <variable>._vptr$B2
	bl _Z2f3P2B1
	lmw 25,12(1)
	lwz 3,44(1)
	addi 1,1,40
	mtlr 3
	blr
	.size	_Z1fv, .-_Z1fv
	.align 2
	.globl _Z2f1P1D
	.type	_Z2f1P1D, @function
_Z2f1P1D:
	stwu 1,-24(1)
	mflr 4
	cmpwi 0,3,0	 #  p
	stw 31,20(1)
	mr 31,3	 #  p
	stw 4,28(1)
	beq- 0,.L21
	lwz 5,0(3)	 #  <variable>._vptr$B1
	lwz 0,0(5)
	mtctr 0
	bctrl
	mr 3,31	 #  p
	bl _ZdlPv
.L21:
	lwz 3,28(1)
	lwz 31,20(1)
	addi 1,1,24
	mtlr 3
	blr
	.size	_Z2f1P1D, .-_Z2f1P1D
	.align 2
	.globl _Z2f2P2B2
	.type	_Z2f2P2B2, @function
_Z2f2P2B2:
	stwu 1,-24(1)
	mflr 4
	cmpwi 0,3,0	 #  p
	stw 31,20(1)
	mr 31,3	 #  p
	stw 4,28(1)
	beq- 0,.L24
	lwz 5,0(3)	 #  <variable>._vptr$B2
	lwz 0,0(5)
	mtctr 0
	bctrl
	mr 3,31	 #  p
	bl _ZdlPv
.L24:
	lwz 3,28(1)
	lwz 31,20(1)
	addi 1,1,24
	mtlr 3
	blr
	.size	_Z2f2P2B2, .-_Z2f2P2B2
	.align 2
	.globl _Z2f3P2B1
	.type	_Z2f3P2B1, @function
_Z2f3P2B1:
	stwu 1,-24(1)
	mflr 4
	cmpwi 0,3,0	 #  p
	stw 31,20(1)
	mr 31,3	 #  p
	stw 4,28(1)
	beq- 0,.L27
	lwz 5,0(3)	 #  <variable>._vptr$B1
	lwz 0,0(5)
	mtctr 0
	bctrl
	mr 3,31	 #  p
	bl _ZdlPv
.L27:
	lwz 3,28(1)
	lwz 31,20(1)
	addi 1,1,24
	mtlr 3
	blr
	.size	_Z2f3P2B1, .-_Z2f3P2B1
	.ident	"GCC: (GNU) 3.3-e500 20030421 (Wind River)"

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

end of thread, other threads:[~2004-04-15 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-15 12:04 Fault report Wolfgang.Roehrl
2004-04-15 20:10 ` Jim Wilson
  -- strict thread matches above, loose matches on Subject: below --
2004-03-18 11:48 Wolfgang.Roehrl

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).