Re: c++/10882: passing and return by reference of char pointer corrupted on x86_64
| Newsgroups | gmane.comp.gcc.prs,gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]> |
Synopsis: passing and return by reference of char pointer corrupted on x86_64
State-Changed-From-To: open->closed
State-Changed-By: aj
State-Changed-When: Tue May 20 13:07:52 2003
State-Changed-Why:
The code is invalid, you do the following basically:
int number;
void *ptr;
ptr = &number;
*ptr = NULL;
Note that int is 32-bit and a pointer is 64-bit on x86-64.
You therefore override some random memory, in this case
the string popped_name.
Since your code is not 64-bit clean, and you explicitly
shut GCC up with casts to void, there's not much that GCC can do and it will produce this code.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10882