public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/5554: corrupt this pointer after function call
@ 2002-01-31  6:16 jeroenk
  0 siblings, 0 replies; 3+ messages in thread
From: jeroenk @ 2002-01-31  6:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5554
>Category:       other
>Synopsis:       corrupt this pointer after function call
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 31 06:16:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     jeroenk@allieddata.com
>Release:        3.1
>Organization:
>Environment:

>Description:
Hello,

My this pointer becomes corrupt after a function call.

I use the following:
- gcc & g++ version 3.1
- libstdc++-3.1-0.17
- glibc-2.2.90-3

In the debugger (gdb) you can see how the this pointer becommes corrupt.
Before we call the function we use a backtrace (bt) to resolve the this pointer: (0x08048502 in Test::test() (this=0xbffff9e0) )
After executing the function the this pointer has changed:(0x08048502 in Test::test() (this=0xbffff9e5))

______________________________________________________________________
GNU gdb Red Hat Linux (5.1-2)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) break 31
Breakpoint 1 at 0x8048511: file test2.cpp, line 31.
(gdb) run
Starting program: /home/jeroenk/qt/monitor/test/test2/./test2 

Breakpoint 1, Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0, 
    TheCurrentMACaddress=0xbffff9b0 "\001\002\003\004\005\006\001@\210\226\001@\005")
    at test2.cpp:31
31          memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof (CurrentMACaddress));
(gdb) bt
#0  Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0, 
    TheCurrentMACaddress=0xbffff9b0 "\001\002\003\004\005\006\001@\210\226\001@\005")
    at test2.cpp:31
#1  0x08048502 in Test::test() (this=0xbffff9e0) at test2.cpp:26
#2  0x08048572 in main (argc=1, argv=0xbffffa54) at test2.cpp:51
#3  0x4011e108 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) next
32      }
(gdb) bt
#0  Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0, 
    TheCurrentMACaddress=0xbffff9b0 "\001\002\003\004\005\006\001@\210\226\001@\005")
    at test2.cpp:32
#1  0x08048502 in Test::test() (this=0xbffff9e5) at test2.cpp:26
#2  0x08048572 in main (argc=1, argv=0xbffffa54) at test2.cpp:51
#3  0x4011e108 in __libc_start_main () from /lib/i686/libc.so.6
(gdb)
____________________________________________________________________________

However if we use the another pc with the following information:
gcc & g++ version 2.96
libstdc++-2.96-98
glibc-2.2.4-19.3

Everyting works fine.
____________________________________________________________________________
GNU gdb Red Hat Linux (5.1-1)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) break 31
Breakpoint 1 at 0x804856d: file test2.cpp, line 31.
(gdb) run
Starting program: /home/jeroenk/./test2 

Breakpoint 1, Test::SetCurrentMACaddress (this=0xbffff9f0, 
    TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at test2.cpp:31
31          memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof (CurrentMACaddress));
(gdb) bt
#0  Test::SetCurrentMACaddress (this=0xbffff9f0, 
    TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at test2.cpp:31
#1  0x0804855e in Test::test (this=0xbffff9f0) at test2.cpp:26
#2  0x080485d2 in main (argc=1, argv=0xbffffa74) at test2.cpp:51
#3  0x400b4627 in __libc_start_main (main=0x80485c0 <main>, argc=1, ubp_av=0xbffffa74, 
    init=0x80483bc <_init>, fini=0x8048620 <_fini>, rtld_fini=0x4000dcc4 <_dl_fini>, 
    stack_end=0xbffffa6c) at ../sysdeps/generic/libc-start.c:129
(gdb) next
32      }
(gdb) bt
#0  Test::SetCurrentMACaddress (this=0xbffff9f0, 
    TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at test2.cpp:32
#1  0x0804855e in Test::test (this=0xbffff9f0) at test2.cpp:26
#2  0x080485d2 in main (argc=1, argv=0xbffffa74) at test2.cpp:51
#3  0x400b4627 in __libc_start_main (main=0x80485c0 <main>, argc=1, ubp_av=0xbffffa74, 
    init=0x80483bc <_init>, fini=0x8048620 <_fini>, rtld_fini=0x4000dcc4 <_dl_fini>, 
    stack_end=0xbffffa6c) at ../sysdeps/generic/libc-start.c:129
(gdb) 
___________________________________________________________________________

See also attached source file.

What could be the problem?
>How-To-Repeat:
see description and file attachment
If file attachment fails, see source code below:
-----test2.cpp------
#include <stddef.h>

typedef unsigned       char tMAC[6];

class Test{

public:
    void test();
private:
    void SetCurrentMACaddress(tMAC TheCurrentMACaddress);
    void *memcpy(void *dest, const void *src, size_t n);
    tMAC CurrentMACaddress;

};

void Test::test()
{
    tMAC MyMac;
    MyMac[0] = 0x01;
    MyMac[1] = 0x02;
    MyMac[2] = 0x03;
    MyMac[3] = 0x04;
    MyMac[4] = 0x05;
    MyMac[5] = 0x06;

    SetCurrentMACaddress(MyMac);
}

void Test::SetCurrentMACaddress(tMAC TheCurrentMACaddress)
{
    memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof (CurrentMACaddress));
}

void *Test::memcpy(void *dest, const void *src, size_t n)
{
    void * tmp = dest;

    while(n--)
    {
       *((char *)dest) = *((char *)src);
       ++(char *)dest;
       ++(char *)src;
    }
   return tmp;
}

int main( int argc, char ** argv )
{
    Test a;

    a.test();
}
-----test2.cpp------
>Fix:
None
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* RE: other/5554: corrupt this pointer after function call
@ 2002-02-07  5:36 Jeroen Kappert
  0 siblings, 0 replies; 3+ messages in thread
From: Jeroen Kappert @ 2002-02-07  5:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/5554; it has been noted by GNATS.

From: Jeroen Kappert <JeroenK@Allieddata.com>
To: 'Andrew Pinski' <pinskia@physics.uc.edu>
Cc: "'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>
Subject: RE: other/5554: corrupt this pointer after function call
Date: Thu, 7 Feb 2002 14:26:14 +0100 

 This message is in MIME format. Since your mail reader does not understand
 this format, some or all of this message may not be legible.
 
 ------_=_NextPart_001_01C1AFDB.043ADE30
 Content-Type: text/plain
 
 Hi,
 
 Thanks, i upgraded the following:
 
 rawhide
 gcc-3.1-0.17.i386.rpm -> gcc-3.1-0.19.i386.rpm
 and all other dependencies (libgcc etc.)
 
 And the problem seems to be fixed...
 
 Regards,
         J. Kappert
 
 
 
 
 -----Original Message-----
 From: Andrew Pinski [mailto:pinskia@physics.uc.edu]
 Sent: donderdag 31 januari 2002 15:31
 To: jeroenk@allieddata.com
 Cc: gcc-gnats@gcc.gnu.org
 Subject: Re: other/5554: corrupt this pointer after function call
 
 
 Try a newer version of gcc and/or gdb. It seems to fixed in ones build 
 yesterday.
 
 Thanks,
 Andrew Pinski
 On Thursday, January 31, 2002, at 09:08 , jeroenk@allieddata.com wrote:
 
 >
 >> Number:         5554
 >> Category:       other
 >> Synopsis:       corrupt this pointer after function call
 >> Confidential:   no
 >> Severity:       serious
 >> Priority:       medium
 >> Responsible:    unassigned
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Thu Jan 31 06:16:00 PST 2002
 >> Closed-Date:
 >> Last-Modified:
 >> Originator:     jeroenk@allieddata.com
 >> Release:        3.1
 >> Organization:
 >> Environment:
 >
 >> Description:
 > Hello,
 >
 > My this pointer becomes corrupt after a function call.
 >
 > I use the following:
 > - gcc & g++ version 3.1
 > - libstdc++-3.1-0.17
 > - glibc-2.2.90-3
 >
 > In the debugger (gdb) you can see how the this pointer becommes corrupt.
 > Before we call the function we use a backtrace (bt) to resolve the this 
 > pointer: (0x08048502 in Test::test() (this=0xbffff9e0) )
 > After executing the function the this pointer has changed:(0x08048502 
 > in Test::test() (this=0xbffff9e5))
 >
 > ______________________________________________________________________
 > GNU gdb Red Hat Linux (5.1-2)
 > Copyright 2001 Free Software Foundation, Inc.
 > GDB is free software, covered by the GNU General Public License, and 
 > you are
 > welcome to change it and/or distribute copies of it under certain 
 > conditions.
 > Type "show copying" to see the conditions.
 > There is absolutely no warranty for GDB.  Type "show warranty" for 
 > details.
 > This GDB was configured as "i386-redhat-linux"...
 > (gdb) break 31
 > Breakpoint 1 at 0x8048511: file test2.cpp, line 31.
 > (gdb) run
 > Starting program: /home/jeroenk/qt/monitor/test/test2/./test2
 >
 > Breakpoint 1, Test::SetCurrentMACaddress(unsigned char*) 
 > (this=0xbffff9e0,
 >     TheCurrentMACaddress=0xbffff9b0 
 > "\001\002\003\004\005\006\001@\210\226\001@\005")
 >     at test2.cpp:31
 > 31          memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof 
 > (CurrentMACaddress));
 > (gdb) bt
 > #0  Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0,
 >     TheCurrentMACaddress=0xbffff9b0 
 > "\001\002\003\004\005\006\001@\210\226\001@\005")
 >     at test2.cpp:31
 > #1  0x08048502 in Test::test() (this=0xbffff9e0) at test2.cpp:26
 > #2  0x08048572 in main (argc=1, argv=0xbffffa54) at test2.cpp:51
 > #3  0x4011e108 in __libc_start_main () from /lib/i686/libc.so.6
 > (gdb) next
 > 32      }
 > (gdb) bt
 > #0  Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0,
 >     TheCurrentMACaddress=0xbffff9b0 
 > "\001\002\003\004\005\006\001@\210\226\001@\005")
 >     at test2.cpp:32
 > #1  0x08048502 in Test::test() (this=0xbffff9e5) at test2.cpp:26
 > #2  0x08048572 in main (argc=1, argv=0xbffffa54) at test2.cpp:51
 > #3  0x4011e108 in __libc_start_main () from /lib/i686/libc.so.6
 > (gdb)
 >
 ____________________________________________________________________________
 >
 > However if we use the another pc with the following information:
 > gcc & g++ version 2.96
 > libstdc++-2.96-98
 > glibc-2.2.4-19.3
 >
 > Everyting works fine.
 >
 ____________________________________________________________________________
 > GNU gdb Red Hat Linux (5.1-1)
 > Copyright 2001 Free Software Foundation, Inc.
 > GDB is free software, covered by the GNU General Public License, and 
 > you are
 > welcome to change it and/or distribute copies of it under certain 
 > conditions.
 > Type "show copying" to see the conditions.
 > There is absolutely no warranty for GDB.  Type "show warranty" for 
 > details.
 > This GDB was configured as "i386-redhat-linux"...
 > (gdb) break 31
 > Breakpoint 1 at 0x804856d: file test2.cpp, line 31.
 > (gdb) run
 > Starting program: /home/jeroenk/./test2
 >
 > Breakpoint 1, Test::SetCurrentMACaddress (this=0xbffff9f0,
 >     TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at 
 > test2.cpp:31
 > 31          memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof 
 > (CurrentMACaddress));
 > (gdb) bt
 > #0  Test::SetCurrentMACaddress (this=0xbffff9f0,
 >     TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at 
 > test2.cpp:31
 > #1  0x0804855e in Test::test (this=0xbffff9f0) at test2.cpp:26
 > #2  0x080485d2 in main (argc=1, argv=0xbffffa74) at test2.cpp:51
 > #3  0x400b4627 in __libc_start_main (main=0x80485c0 <main>, argc=1, 
 > ubp_av=0xbffffa74,
 >     init=0x80483bc <_init>, fini=0x8048620 <_fini>, 
 > rtld_fini=0x4000dcc4 <_dl_fini>,
 >     stack_end=0xbffffa6c) at ../sysdeps/generic/libc-start.c:129
 > (gdb) next
 > 32      }
 > (gdb) bt
 > #0  Test::SetCurrentMACaddress (this=0xbffff9f0,
 >     TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at 
 > test2.cpp:32
 > #1  0x0804855e in Test::test (this=0xbffff9f0) at test2.cpp:26
 > #2  0x080485d2 in main (argc=1, argv=0xbffffa74) at test2.cpp:51
 > #3  0x400b4627 in __libc_start_main (main=0x80485c0 <main>, argc=1, 
 > ubp_av=0xbffffa74,
 >     init=0x80483bc <_init>, fini=0x8048620 <_fini>, 
 > rtld_fini=0x4000dcc4 <_dl_fini>,
 >     stack_end=0xbffffa6c) at ../sysdeps/generic/libc-start.c:129
 > (gdb)
 >
 ___________________________________________________________________________
 >
 > See also attached source file.
 >
 > What could be the problem?
 >> How-To-Repeat:
 > see description and file attachment
 > If file attachment fails, see source code below:
 > -----test2.cpp------
 > #include <stddef.h>
 >
 > typedef unsigned       char tMAC[6];
 >
 > class Test{
 >
 > public:
 >     void test();
 > private:
 >     void SetCurrentMACaddress(tMAC TheCurrentMACaddress);
 >     void *memcpy(void *dest, const void *src, size_t n);
 >     tMAC CurrentMACaddress;
 >
 > };
 >
 > void Test::test()
 > {
 >     tMAC MyMac;
 >     MyMac[0] = 0x01;
 >     MyMac[1] = 0x02;
 >     MyMac[2] = 0x03;
 >     MyMac[3] = 0x04;
 >     MyMac[4] = 0x05;
 >     MyMac[5] = 0x06;
 >
 >     SetCurrentMACaddress(MyMac);
 > }
 >
 > void Test::SetCurrentMACaddress(tMAC TheCurrentMACaddress)
 > {
 >     memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof 
 > (CurrentMACaddress));
 > }
 >
 > void *Test::memcpy(void *dest, const void *src, size_t n)
 > {
 >     void * tmp = dest;
 >
 >     while(n--)
 >     {
 >        *((char *)dest) = *((char *)src);
 >        ++(char *)dest;
 >        ++(char *)src;
 >     }
 >    return tmp;
 > }
 >
 > int main( int argc, char ** argv )
 > {
 >     Test a;
 >
 >     a.test();
 > }
 > -----test2.cpp------
 >> Fix:
 > None
 >> Release-Note:
 >> Audit-Trail:
 >> Unformatted:
 >
 >
 
 ------_=_NextPart_001_01C1AFDB.043ADE30
 Content-Type: text/html
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
 <HTML>
 <HEAD>
 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
 <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
 <TITLE>RE: other/5554: corrupt this pointer after function call</TITLE>
 </HEAD>
 <BODY>
 
 <P><FONT SIZE=2>Hi,</FONT>
 </P>
 
 <P><FONT SIZE=2>Thanks, i upgraded the following:</FONT>
 </P>
 
 <P><FONT SIZE=2>rawhide</FONT>
 <BR><FONT SIZE=2>gcc-3.1-0.17.i386.rpm -&gt; gcc-3.1-0.19.i386.rpm</FONT>
 <BR><FONT SIZE=2>and all other dependencies (libgcc etc.)</FONT>
 </P>
 
 <P><FONT SIZE=2>And the problem seems to be fixed...</FONT>
 </P>
 
 <P><FONT SIZE=2>Regards,</FONT>
 <BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; J. Kappert</FONT>
 </P>
 <BR>
 <BR>
 <BR>
 
 <P><FONT SIZE=2>-----Original Message-----</FONT>
 <BR><FONT SIZE=2>From: Andrew Pinski [<A HREF="mailto:pinskia@physics.uc.edu">mailto:pinskia@physics.uc.edu</A>]</FONT>
 <BR><FONT SIZE=2>Sent: donderdag 31 januari 2002 15:31</FONT>
 <BR><FONT SIZE=2>To: jeroenk@allieddata.com</FONT>
 <BR><FONT SIZE=2>Cc: gcc-gnats@gcc.gnu.org</FONT>
 <BR><FONT SIZE=2>Subject: Re: other/5554: corrupt this pointer after function call</FONT>
 </P>
 <BR>
 
 <P><FONT SIZE=2>Try a newer version of gcc and/or gdb. It seems to fixed in ones build </FONT>
 <BR><FONT SIZE=2>yesterday.</FONT>
 </P>
 
 <P><FONT SIZE=2>Thanks,</FONT>
 <BR><FONT SIZE=2>Andrew Pinski</FONT>
 <BR><FONT SIZE=2>On Thursday, January 31, 2002, at 09:08 , jeroenk@allieddata.com wrote:</FONT>
 </P>
 
 <P><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Number:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5554</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Category:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; other</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Synopsis:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; corrupt this pointer after function call</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Confidential:&nbsp;&nbsp; no</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Severity:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serious</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Priority:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; medium</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Responsible:&nbsp;&nbsp;&nbsp; unassigned</FONT>
 <BR><FONT SIZE=2>&gt;&gt; State:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; open</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Class:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sw-bug</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Submitter-Id:&nbsp;&nbsp; net</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Arrival-Date:&nbsp;&nbsp; Thu Jan 31 06:16:00 PST 2002</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Closed-Date:</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Last-Modified:</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Originator:&nbsp;&nbsp;&nbsp;&nbsp; jeroenk@allieddata.com</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Release:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.1</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Organization:</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Environment:</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Description:</FONT>
 <BR><FONT SIZE=2>&gt; Hello,</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; My this pointer becomes corrupt after a function call.</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; I use the following:</FONT>
 <BR><FONT SIZE=2>&gt; - gcc &amp; g++ version 3.1</FONT>
 <BR><FONT SIZE=2>&gt; - libstdc++-3.1-0.17</FONT>
 <BR><FONT SIZE=2>&gt; - glibc-2.2.90-3</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; In the debugger (gdb) you can see how the this pointer becommes corrupt.</FONT>
 <BR><FONT SIZE=2>&gt; Before we call the function we use a backtrace (bt) to resolve the this </FONT>
 <BR><FONT SIZE=2>&gt; pointer: (0x08048502 in Test::test() (this=0xbffff9e0) )</FONT>
 <BR><FONT SIZE=2>&gt; After executing the function the this pointer has changed:(0x08048502 </FONT>
 <BR><FONT SIZE=2>&gt; in Test::test() (this=0xbffff9e5))</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; ______________________________________________________________________</FONT>
 <BR><FONT SIZE=2>&gt; GNU gdb Red Hat Linux (5.1-2)</FONT>
 <BR><FONT SIZE=2>&gt; Copyright 2001 Free Software Foundation, Inc.</FONT>
 <BR><FONT SIZE=2>&gt; GDB is free software, covered by the GNU General Public License, and </FONT>
 <BR><FONT SIZE=2>&gt; you are</FONT>
 <BR><FONT SIZE=2>&gt; welcome to change it and/or distribute copies of it under certain </FONT>
 <BR><FONT SIZE=2>&gt; conditions.</FONT>
 <BR><FONT SIZE=2>&gt; Type &quot;show copying&quot; to see the conditions.</FONT>
 <BR><FONT SIZE=2>&gt; There is absolutely no warranty for GDB.&nbsp; Type &quot;show warranty&quot; for </FONT>
 <BR><FONT SIZE=2>&gt; details.</FONT>
 <BR><FONT SIZE=2>&gt; This GDB was configured as &quot;i386-redhat-linux&quot;...</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) break 31</FONT>
 <BR><FONT SIZE=2>&gt; Breakpoint 1 at 0x8048511: file test2.cpp, line 31.</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) run</FONT>
 <BR><FONT SIZE=2>&gt; Starting program: /home/jeroenk/qt/monitor/test/test2/./test2</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; Breakpoint 1, Test::SetCurrentMACaddress(unsigned char*) </FONT>
 <BR><FONT SIZE=2>&gt; (this=0xbffff9e0,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; TheCurrentMACaddress=0xbffff9b0 </FONT>
 <BR><FONT SIZE=2>&gt; &quot;\001\002\003\004\005\006\001@\210\226\001@\005&quot;)</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; at test2.cpp:31</FONT>
 <BR><FONT SIZE=2>&gt; 31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof </FONT>
 <BR><FONT SIZE=2>&gt; (CurrentMACaddress));</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) bt</FONT>
 <BR><FONT SIZE=2>&gt; #0&nbsp; Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; TheCurrentMACaddress=0xbffff9b0 </FONT>
 <BR><FONT SIZE=2>&gt; &quot;\001\002\003\004\005\006\001@\210\226\001@\005&quot;)</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; at test2.cpp:31</FONT>
 <BR><FONT SIZE=2>&gt; #1&nbsp; 0x08048502 in Test::test() (this=0xbffff9e0) at test2.cpp:26</FONT>
 <BR><FONT SIZE=2>&gt; #2&nbsp; 0x08048572 in main (argc=1, argv=0xbffffa54) at test2.cpp:51</FONT>
 <BR><FONT SIZE=2>&gt; #3&nbsp; 0x4011e108 in __libc_start_main () from /lib/i686/libc.so.6</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) next</FONT>
 <BR><FONT SIZE=2>&gt; 32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) bt</FONT>
 <BR><FONT SIZE=2>&gt; #0&nbsp; Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; TheCurrentMACaddress=0xbffff9b0 </FONT>
 <BR><FONT SIZE=2>&gt; &quot;\001\002\003\004\005\006\001@\210\226\001@\005&quot;)</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; at test2.cpp:32</FONT>
 <BR><FONT SIZE=2>&gt; #1&nbsp; 0x08048502 in Test::test() (this=0xbffff9e5) at test2.cpp:26</FONT>
 <BR><FONT SIZE=2>&gt; #2&nbsp; 0x08048572 in main (argc=1, argv=0xbffffa54) at test2.cpp:51</FONT>
 <BR><FONT SIZE=2>&gt; #3&nbsp; 0x4011e108 in __libc_start_main () from /lib/i686/libc.so.6</FONT>
 <BR><FONT SIZE=2>&gt; (gdb)</FONT>
 <BR><FONT SIZE=2>&gt; ____________________________________________________________________________</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; However if we use the another pc with the following information:</FONT>
 <BR><FONT SIZE=2>&gt; gcc &amp; g++ version 2.96</FONT>
 <BR><FONT SIZE=2>&gt; libstdc++-2.96-98</FONT>
 <BR><FONT SIZE=2>&gt; glibc-2.2.4-19.3</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; Everyting works fine.</FONT>
 <BR><FONT SIZE=2>&gt; ____________________________________________________________________________</FONT>
 <BR><FONT SIZE=2>&gt; GNU gdb Red Hat Linux (5.1-1)</FONT>
 <BR><FONT SIZE=2>&gt; Copyright 2001 Free Software Foundation, Inc.</FONT>
 <BR><FONT SIZE=2>&gt; GDB is free software, covered by the GNU General Public License, and </FONT>
 <BR><FONT SIZE=2>&gt; you are</FONT>
 <BR><FONT SIZE=2>&gt; welcome to change it and/or distribute copies of it under certain </FONT>
 <BR><FONT SIZE=2>&gt; conditions.</FONT>
 <BR><FONT SIZE=2>&gt; Type &quot;show copying&quot; to see the conditions.</FONT>
 <BR><FONT SIZE=2>&gt; There is absolutely no warranty for GDB.&nbsp; Type &quot;show warranty&quot; for </FONT>
 <BR><FONT SIZE=2>&gt; details.</FONT>
 <BR><FONT SIZE=2>&gt; This GDB was configured as &quot;i386-redhat-linux&quot;...</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) break 31</FONT>
 <BR><FONT SIZE=2>&gt; Breakpoint 1 at 0x804856d: file test2.cpp, line 31.</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) run</FONT>
 <BR><FONT SIZE=2>&gt; Starting program: /home/jeroenk/./test2</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; Breakpoint 1, Test::SetCurrentMACaddress (this=0xbffff9f0,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; TheCurrentMACaddress=0xbffff9c0 &quot;\001\002\003\004\005\006&quot;) at </FONT>
 <BR><FONT SIZE=2>&gt; test2.cpp:31</FONT>
 <BR><FONT SIZE=2>&gt; 31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof </FONT>
 <BR><FONT SIZE=2>&gt; (CurrentMACaddress));</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) bt</FONT>
 <BR><FONT SIZE=2>&gt; #0&nbsp; Test::SetCurrentMACaddress (this=0xbffff9f0,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; TheCurrentMACaddress=0xbffff9c0 &quot;\001\002\003\004\005\006&quot;) at </FONT>
 <BR><FONT SIZE=2>&gt; test2.cpp:31</FONT>
 <BR><FONT SIZE=2>&gt; #1&nbsp; 0x0804855e in Test::test (this=0xbffff9f0) at test2.cpp:26</FONT>
 <BR><FONT SIZE=2>&gt; #2&nbsp; 0x080485d2 in main (argc=1, argv=0xbffffa74) at test2.cpp:51</FONT>
 <BR><FONT SIZE=2>&gt; #3&nbsp; 0x400b4627 in __libc_start_main (main=0x80485c0 &lt;main&gt;, argc=1, </FONT>
 <BR><FONT SIZE=2>&gt; ubp_av=0xbffffa74,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; init=0x80483bc &lt;_init&gt;, fini=0x8048620 &lt;_fini&gt;, </FONT>
 <BR><FONT SIZE=2>&gt; rtld_fini=0x4000dcc4 &lt;_dl_fini&gt;,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; stack_end=0xbffffa6c) at ../sysdeps/generic/libc-start.c:129</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) next</FONT>
 <BR><FONT SIZE=2>&gt; 32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
 <BR><FONT SIZE=2>&gt; (gdb) bt</FONT>
 <BR><FONT SIZE=2>&gt; #0&nbsp; Test::SetCurrentMACaddress (this=0xbffff9f0,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; TheCurrentMACaddress=0xbffff9c0 &quot;\001\002\003\004\005\006&quot;) at </FONT>
 <BR><FONT SIZE=2>&gt; test2.cpp:32</FONT>
 <BR><FONT SIZE=2>&gt; #1&nbsp; 0x0804855e in Test::test (this=0xbffff9f0) at test2.cpp:26</FONT>
 <BR><FONT SIZE=2>&gt; #2&nbsp; 0x080485d2 in main (argc=1, argv=0xbffffa74) at test2.cpp:51</FONT>
 <BR><FONT SIZE=2>&gt; #3&nbsp; 0x400b4627 in __libc_start_main (main=0x80485c0 &lt;main&gt;, argc=1, </FONT>
 <BR><FONT SIZE=2>&gt; ubp_av=0xbffffa74,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; init=0x80483bc &lt;_init&gt;, fini=0x8048620 &lt;_fini&gt;, </FONT>
 <BR><FONT SIZE=2>&gt; rtld_fini=0x4000dcc4 &lt;_dl_fini&gt;,</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; stack_end=0xbffffa6c) at ../sysdeps/generic/libc-start.c:129</FONT>
 <BR><FONT SIZE=2>&gt; (gdb)</FONT>
 <BR><FONT SIZE=2>&gt; ___________________________________________________________________________</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; See also attached source file.</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; What could be the problem?</FONT>
 <BR><FONT SIZE=2>&gt;&gt; How-To-Repeat:</FONT>
 <BR><FONT SIZE=2>&gt; see description and file attachment</FONT>
 <BR><FONT SIZE=2>&gt; If file attachment fails, see source code below:</FONT>
 <BR><FONT SIZE=2>&gt; -----test2.cpp------</FONT>
 <BR><FONT SIZE=2>&gt; #include &lt;stddef.h&gt;</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; typedef unsigned&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char tMAC[6];</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; class Test{</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; public:</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; void test();</FONT>
 <BR><FONT SIZE=2>&gt; private:</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; void SetCurrentMACaddress(tMAC TheCurrentMACaddress);</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; void *memcpy(void *dest, const void *src, size_t n);</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; tMAC CurrentMACaddress;</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; };</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; void Test::test()</FONT>
 <BR><FONT SIZE=2>&gt; {</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; tMAC MyMac;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; MyMac[0] = 0x01;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; MyMac[1] = 0x02;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; MyMac[2] = 0x03;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; MyMac[3] = 0x04;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; MyMac[4] = 0x05;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; MyMac[5] = 0x06;</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; SetCurrentMACaddress(MyMac);</FONT>
 <BR><FONT SIZE=2>&gt; }</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; void Test::SetCurrentMACaddress(tMAC TheCurrentMACaddress)</FONT>
 <BR><FONT SIZE=2>&gt; {</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof </FONT>
 <BR><FONT SIZE=2>&gt; (CurrentMACaddress));</FONT>
 <BR><FONT SIZE=2>&gt; }</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; void *Test::memcpy(void *dest, const void *src, size_t n)</FONT>
 <BR><FONT SIZE=2>&gt; {</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; void * tmp = dest;</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; while(n--)</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *((char *)dest) = *((char *)src);</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++(char *)dest;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++(char *)src;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp; return tmp;</FONT>
 <BR><FONT SIZE=2>&gt; }</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt; int main( int argc, char ** argv )</FONT>
 <BR><FONT SIZE=2>&gt; {</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Test a;</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp; a.test();</FONT>
 <BR><FONT SIZE=2>&gt; }</FONT>
 <BR><FONT SIZE=2>&gt; -----test2.cpp------</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Fix:</FONT>
 <BR><FONT SIZE=2>&gt; None</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Release-Note:</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Audit-Trail:</FONT>
 <BR><FONT SIZE=2>&gt;&gt; Unformatted:</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 <BR><FONT SIZE=2>&gt;</FONT>
 </P>
 
 </BODY>
 </HTML>
 ------_=_NextPart_001_01C1AFDB.043ADE30--


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

* Re: other/5554: corrupt this pointer after function call
@ 2002-01-31  6:36 Andrew Pinski
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Pinski @ 2002-01-31  6:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR other/5554; it has been noted by GNATS.

From: Andrew Pinski <pinskia@physics.uc.edu>
To: jeroenk@allieddata.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: other/5554: corrupt this pointer after function call
Date: Thu, 31 Jan 2002 09:31:27 -0500

 Try a newer version of gcc and/or gdb. It seems to fixed in ones build 
 yesterday.
 
 Thanks,
 Andrew Pinski
 On Thursday, January 31, 2002, at 09:08 , jeroenk@allieddata.com wrote:
 
 >
 >> Number:         5554
 >> Category:       other
 >> Synopsis:       corrupt this pointer after function call
 >> Confidential:   no
 >> Severity:       serious
 >> Priority:       medium
 >> Responsible:    unassigned
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Thu Jan 31 06:16:00 PST 2002
 >> Closed-Date:
 >> Last-Modified:
 >> Originator:     jeroenk@allieddata.com
 >> Release:        3.1
 >> Organization:
 >> Environment:
 >
 >> Description:
 > Hello,
 >
 > My this pointer becomes corrupt after a function call.
 >
 > I use the following:
 > - gcc & g++ version 3.1
 > - libstdc++-3.1-0.17
 > - glibc-2.2.90-3
 >
 > In the debugger (gdb) you can see how the this pointer becommes corrupt.
 > Before we call the function we use a backtrace (bt) to resolve the this 
 > pointer: (0x08048502 in Test::test() (this=0xbffff9e0) )
 > After executing the function the this pointer has changed:(0x08048502 
 > in Test::test() (this=0xbffff9e5))
 >
 > ______________________________________________________________________
 > GNU gdb Red Hat Linux (5.1-2)
 > Copyright 2001 Free Software Foundation, Inc.
 > GDB is free software, covered by the GNU General Public License, and 
 > you are
 > welcome to change it and/or distribute copies of it under certain 
 > conditions.
 > Type "show copying" to see the conditions.
 > There is absolutely no warranty for GDB.  Type "show warranty" for 
 > details.
 > This GDB was configured as "i386-redhat-linux"...
 > (gdb) break 31
 > Breakpoint 1 at 0x8048511: file test2.cpp, line 31.
 > (gdb) run
 > Starting program: /home/jeroenk/qt/monitor/test/test2/./test2
 >
 > Breakpoint 1, Test::SetCurrentMACaddress(unsigned char*) 
 > (this=0xbffff9e0,
 >     TheCurrentMACaddress=0xbffff9b0 
 > "\001\002\003\004\005\006\001@\210\226\001@\005")
 >     at test2.cpp:31
 > 31          memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof 
 > (CurrentMACaddress));
 > (gdb) bt
 > #0  Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0,
 >     TheCurrentMACaddress=0xbffff9b0 
 > "\001\002\003\004\005\006\001@\210\226\001@\005")
 >     at test2.cpp:31
 > #1  0x08048502 in Test::test() (this=0xbffff9e0) at test2.cpp:26
 > #2  0x08048572 in main (argc=1, argv=0xbffffa54) at test2.cpp:51
 > #3  0x4011e108 in __libc_start_main () from /lib/i686/libc.so.6
 > (gdb) next
 > 32      }
 > (gdb) bt
 > #0  Test::SetCurrentMACaddress(unsigned char*) (this=0xbffff9e0,
 >     TheCurrentMACaddress=0xbffff9b0 
 > "\001\002\003\004\005\006\001@\210\226\001@\005")
 >     at test2.cpp:32
 > #1  0x08048502 in Test::test() (this=0xbffff9e5) at test2.cpp:26
 > #2  0x08048572 in main (argc=1, argv=0xbffffa54) at test2.cpp:51
 > #3  0x4011e108 in __libc_start_main () from /lib/i686/libc.so.6
 > (gdb)
 > ____________________________________________________________________________
 >
 > However if we use the another pc with the following information:
 > gcc & g++ version 2.96
 > libstdc++-2.96-98
 > glibc-2.2.4-19.3
 >
 > Everyting works fine.
 > ____________________________________________________________________________
 > GNU gdb Red Hat Linux (5.1-1)
 > Copyright 2001 Free Software Foundation, Inc.
 > GDB is free software, covered by the GNU General Public License, and 
 > you are
 > welcome to change it and/or distribute copies of it under certain 
 > conditions.
 > Type "show copying" to see the conditions.
 > There is absolutely no warranty for GDB.  Type "show warranty" for 
 > details.
 > This GDB was configured as "i386-redhat-linux"...
 > (gdb) break 31
 > Breakpoint 1 at 0x804856d: file test2.cpp, line 31.
 > (gdb) run
 > Starting program: /home/jeroenk/./test2
 >
 > Breakpoint 1, Test::SetCurrentMACaddress (this=0xbffff9f0,
 >     TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at 
 > test2.cpp:31
 > 31          memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof 
 > (CurrentMACaddress));
 > (gdb) bt
 > #0  Test::SetCurrentMACaddress (this=0xbffff9f0,
 >     TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at 
 > test2.cpp:31
 > #1  0x0804855e in Test::test (this=0xbffff9f0) at test2.cpp:26
 > #2  0x080485d2 in main (argc=1, argv=0xbffffa74) at test2.cpp:51
 > #3  0x400b4627 in __libc_start_main (main=0x80485c0 <main>, argc=1, 
 > ubp_av=0xbffffa74,
 >     init=0x80483bc <_init>, fini=0x8048620 <_fini>, 
 > rtld_fini=0x4000dcc4 <_dl_fini>,
 >     stack_end=0xbffffa6c) at ../sysdeps/generic/libc-start.c:129
 > (gdb) next
 > 32      }
 > (gdb) bt
 > #0  Test::SetCurrentMACaddress (this=0xbffff9f0,
 >     TheCurrentMACaddress=0xbffff9c0 "\001\002\003\004\005\006") at 
 > test2.cpp:32
 > #1  0x0804855e in Test::test (this=0xbffff9f0) at test2.cpp:26
 > #2  0x080485d2 in main (argc=1, argv=0xbffffa74) at test2.cpp:51
 > #3  0x400b4627 in __libc_start_main (main=0x80485c0 <main>, argc=1, 
 > ubp_av=0xbffffa74,
 >     init=0x80483bc <_init>, fini=0x8048620 <_fini>, 
 > rtld_fini=0x4000dcc4 <_dl_fini>,
 >     stack_end=0xbffffa6c) at ../sysdeps/generic/libc-start.c:129
 > (gdb)
 > ___________________________________________________________________________
 >
 > See also attached source file.
 >
 > What could be the problem?
 >> How-To-Repeat:
 > see description and file attachment
 > If file attachment fails, see source code below:
 > -----test2.cpp------
 > #include <stddef.h>
 >
 > typedef unsigned       char tMAC[6];
 >
 > class Test{
 >
 > public:
 >     void test();
 > private:
 >     void SetCurrentMACaddress(tMAC TheCurrentMACaddress);
 >     void *memcpy(void *dest, const void *src, size_t n);
 >     tMAC CurrentMACaddress;
 >
 > };
 >
 > void Test::test()
 > {
 >     tMAC MyMac;
 >     MyMac[0] = 0x01;
 >     MyMac[1] = 0x02;
 >     MyMac[2] = 0x03;
 >     MyMac[3] = 0x04;
 >     MyMac[4] = 0x05;
 >     MyMac[5] = 0x06;
 >
 >     SetCurrentMACaddress(MyMac);
 > }
 >
 > void Test::SetCurrentMACaddress(tMAC TheCurrentMACaddress)
 > {
 >     memcpy(CurrentMACaddress, TheCurrentMACaddress, sizeof 
 > (CurrentMACaddress));
 > }
 >
 > void *Test::memcpy(void *dest, const void *src, size_t n)
 > {
 >     void * tmp = dest;
 >
 >     while(n--)
 >     {
 >        *((char *)dest) = *((char *)src);
 >        ++(char *)dest;
 >        ++(char *)src;
 >     }
 >    return tmp;
 > }
 >
 > int main( int argc, char ** argv )
 > {
 >     Test a;
 >
 >     a.test();
 > }
 > -----test2.cpp------
 >> Fix:
 > None
 >> Release-Note:
 >> Audit-Trail:
 >> Unformatted:
 >
 >
 


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

end of thread, other threads:[~2002-02-07 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-31  6:16 other/5554: corrupt this pointer after function call jeroenk
2002-01-31  6:36 Andrew Pinski
2002-02-07  5:36 Jeroen Kappert

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