This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problems with __complex__ in C++
- To: gcc at gcc dot gnu dot org
- Subject: Problems with __complex__ in C++
- From: Branko Čibej <branko dot cibej at hermes dot si>
- Date: Wed, 19 Apr 2000 20:08:28 +0200
- Organization: HERMES SoftLab
- References: <38F17D9D.B0173DFC@hermes.si>
Hi,
I've been trying to track down a bug in g++ that shows up when I try
to compile libstdc++-v3 on sparc-sun-solaris2.6. The root of the
problem seems to be that implicit conversions between different
complex types are not implemented in C++.
I managed to reproduce the problem with the testcase below. It compiles
as C, but fails as C++.
Unfortunately I can't find my way around the sources too well, so
my debugging efforts haven't been much use yet. If somewone could
give me a few pointers, I could try to fix the problem myself.
In the meantime, here's the testcase and compilation logs:
int main (void)
{
static __complex__ float x;
static __complex__ double y;
x = y;
y = x;
return 0;
}
With gcc:
Reading specs from /home/brane/eval/gcc/obj/gcc/specs
gcc version 2.96 20000417 (experimental)
/home/brane/eval/gcc/obj/gcc/cpp -lang-c -v -iprefix /home/brane/eval/gcc/obj/gcc/../lib/gcc-lib/sparc-sun-solaris2.6/2.96/
-isystem /home/brane/eval/gcc/obj/gcc/include -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -Dsparc -Dsun -Dunix
-D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix)
-Asystem(svr4) -W -Wall -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) ./complexbug.c /var/tmp/ccJEWkfF.i
GNU CPP version 2.96 20000417 (experimental) (cpplib)
(sparc)
ignoring nonexistent directory `/home/brane/eval/gcc/obj/lib/gcc-lib/sparc-sun-solaris2.6/2.96/include'
ignoring nonexistent directory `/home/brane/eval/gcc/obj/sparc-sun-solaris2.6/include'
#include "..." search starts here:
#include <...> search starts here:
/home/brane/eval/gcc/obj/gcc/include
/usr/local/include
/home/brane/eval/gcc/inst/lib/gcc-lib/sparc-sun-solaris2.6/2.96/include
/home/brane/eval/gcc/inst/sparc-sun-solaris2.6/include
/usr/include
End of search list.
/home/brane/eval/gcc/obj/gcc/cc1 /var/tmp/ccJEWkfF.i -quiet -dumpbase complexbug.c -W -Wall -version -o /var/tmp/ccq31pbm.s
GNU C version 2.96 20000417 (experimental) (sparc-sun-solaris2.6) compiled by GNU C version 2.96 20000417 (experimental).
/home/brane/eval/gcc/inst/bin/as -V -Qy -s -o ./complexbug.o /var/tmp/ccq31pbm.s
GNU assembler version 2.9.1 (sparc-sun-solaris2.6), using BFD version 2.9.1
With g++:
Reading specs from /home/brane/eval/gcc/obj/gcc/specs
gcc version 2.96 20000417 (experimental)
/home/brane/eval/gcc/obj/gcc/cpp -lang-c++ -v -iprefix /home/brane/eval/gcc/obj/gcc/../lib/gcc-lib/sparc-sun-solaris2.6/2.96/
-isystem /home/brane/eval/gcc/obj/gcc/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0
-D__cplusplus -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun
-D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -W -Wall -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)
./complexbug.cc /var/tmp/cc7m66vk.ii
GNU CPP version 2.96 20000417 (experimental) (cpplib)
(sparc)
ignoring nonexistent directory `/home/brane/eval/gcc/obj/include/g++-v3'
ignoring nonexistent directory `/home/brane/eval/gcc/obj/lib/gcc-lib/sparc-sun-solaris2.6/2.96/include'
ignoring nonexistent directory `/home/brane/eval/gcc/obj/sparc-sun-solaris2.6/include'
#include "..." search starts here:
#include <...> search starts here:
/home/brane/eval/gcc/obj/gcc/include
/home/brane/eval/gcc/inst/include/g++-v3
/usr/local/include
/home/brane/eval/gcc/inst/lib/gcc-lib/sparc-sun-solaris2.6/2.96/include
/home/brane/eval/gcc/inst/sparc-sun-solaris2.6/include
/usr/include
End of search list.
/home/brane/eval/gcc/obj/gcc/cc1plus /var/tmp/cc7m66vk.ii -quiet -dumpbase complexbug.cc -W -Wall -version -o
/var/tmp/cck0R7Gx.s
GNU C++ version 2.96 20000417 (experimental) (sparc-sun-solaris2.6) compiled by GNU C version 2.96 20000417 (experimental).
./complexbug.cc: In function `int main ()':
./complexbug.cc:6: cannot convert `complex double' to `complex float'
./complexbug.cc:6: in assignment
./complexbug.cc:7: cannot convert `complex float' to `complex double'
./complexbug.cc:7: in assignment
--
Branko Čibej <branko.cibej@hermes.si>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
voice: (+386 1) 586 53 49 fax: (+386 1) 586 52 70