This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12418] New: reference to void pointer is not correct!!!
- From: "olg at ks dot informatik dot uni-kiel dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Sep 2003 09:06:52 -0000
- Subject: [Bug c++/12418] New: reference to void pointer is not correct!!!
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12418
Summary: reference to void pointer is not correct!!!
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: olg at ks dot informatik dot uni-kiel dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: gcc 3.3.x
GCC host triplet: gcc 3.3.x
GCC target triplet: gcc 3.3.x
The following code produce different outputs under different versions of gcc:
------------------------------------------------------
#include <stdio.h>
void ptest(void* &pointer)
{
printf(" pointer: %p ; pointer to pointer %p\n",
pointer,&pointer);
}
int main()
{
int *pointer;
int y;
pointer = &y;
printf(" pointer: %p ; pointer to pointer %p ; pointer of y: %p\n",
pointer,&pointer,&y);
ptest((void*)pointer);
return 0;
}
----------------------------------------------------------
The gcc on RedHat 8.0 works correct:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
This is the output:
pointer: 0xbffff540 ; pointer to pointer 0xbffff544 ; pointer of y: 0xbffff540
pointer: 0xbffff540 ; pointer to pointer 0xbffff544
As you can see the pointer to pointer values are equal!
------------------------------------------------
The gcc 3.x on SuSe and an other gcc under 3.x Solaris doesn't work or produce
strange output:
The SuSe version:
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib
--enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-libgcj --wi
th-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit i486-suse-l
inux
Thread model: posix
gcc version 3.3 20030226 (prerelease) (SuSE Linux)
The output on SuSe:
pointer: 0xbffff5a4 ; pointer to pointer 0xbffff5a8 ; pointer of y: 0xbffff5a4
pointer: 0xbffff5a4 ; pointer to pointer 0xbffff5a0
As you can see the pointer to pointer values are NOT equal!
----------------------------------------------------------------------
The Solaris Version:
Reading specs from /home/gcc/lib/gcc-lib/sparc-sun-solaris2.8/3.3.1/specs
Configured with: ../gcc-3.3.1/configure --prefix=/home/gcc
--enable-languages=c,c++,f77 --with-gnu-ld --with-ld=/home/gcc/bin/ld
--with-gnu-as --with-as=/home/gcc/bin/as
Thread model: posix
gcc version 3.3.1
The output on Solaris:
pointer: ffbef338 ; pointer to pointer ffbef33c ; pointer of y: ffbef338
pointer: ffbef338 ; pointer to pointer ffbef334
As you can see the pointer to pointer values are NOT equal!
----------------------------------------------------------------------
Thanks for reading this and also many thanks for the GCC. :-)
Oliver Granert