This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug in egcs-2.91.60


hallo,

I get a linker error with the following program.
At the end of this mail there are conditions under which the program
compiles correctly. This indicates that there is a compiler error.
Documentation of the erroneous behaviour:

uname -a
--------
Linux stones 2.2.3 #4 SMP Mit M„r 17 11:19:30 CET 1999 i686 unknown

OS
--
Debian Linux

source files
------------
file 1.c:
typedef double atype;
void f(double *x1, atype *x2);

int main() {
  double *d1;
  double *d2;
  f(d1, d2);
}

file 2.c:
void f(double *x1, double *x2) {}


I'm not sure if this source is correct ANSI C, but if not, it should
also lead to an error in the case of int *x1 as mentioned above.


compilation with g++ -v -c 1.c 2.c
----------------------------------
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/specs
gcc version egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release)
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__
-Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__
-D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix)
-D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386
-D__i386 -D__i386__ -Di486 -D__i486 -D__i486__ 1.c /tmp/ccrREwrn.ii
GNU CPP version egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-2
 /usr/local/include
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/cc1plus /tmp/ccrREwrn.ii
-quiet -dumpbase 1.cc -version -o /tmp/ccihf3RB.s
GNU C++ version egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release)
(i486-linux) compiled by GNU C version egcs-2.91.60 Debian 2.1
(egcs-1.1.1 release).
 as -V -Qy -o 1.o /tmp/ccihf3RB.s
GNU assembler version 2.9.1 (i486-linux), using BFD version 2.9.1.0.19
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__
-Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__
-D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix)
-D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386
-D__i386 -D__i386__ -Di486 -D__i486 -D__i486__ 2.c /tmp/ccrREwrn.ii
GNU CPP version egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-2
 /usr/local/include
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/cc1plus /tmp/ccrREwrn.ii
-quiet -dumpbase 2.cc -version -o /tmp/ccihf3RB.s
GNU C++ version egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release)
(i486-linux) compiled by GNU C version egcs-2.91.60 Debian 2.1
(egcs-1.1.1 release).
 as -V -Qy -o 2.o /tmp/ccihf3RB.s
GNU assembler version 2.9.1 (i486-linux), using BFD version 2.9.1.0.19


linking with g++ 1.o 2.o
------------------------
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/specs
gcc version egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release)
 /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/collect2 -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/gcc-lib/i486-linux/egcs-2.91.60/crtbegin.o
-L/usr/lib/gcc-lib/i486-linux/egcs-2.91.60 1.o 2.o -lstdc++ -lm -lgcc
-lc -lgcc /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/crtend.o
/usr/lib/crtn.o
1.o: In function `main':
1.o(.text+0xf): undefined reference to `f(double *, double *)'
collect2: ld returned 1 exit status


nm -g 1.o 2.o sais:
-------------------

1.o:
         U f__FPdPd
00000000 T main

2.o:
00000000 T f__FPdT0   !!!!!!!!!!!!!!!



nm -gC 1.o 2.o sais:
--------------------

1.o:
         U f(double *, double *)
00000000 T main

2.o:
00000000 T f(double *, double *)



The program compiles without error under any of the following
conditions:
- gcc instead g++
- IBM machine with IBM compiler
- SUN machine with gcc 2.7.2
- DEC alpha with Red Hat Linux and 
  gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
- x1 and d1 omitted
- int *x1 instead double *x1, same for d1       !!!!
- double x1 instead double *x1, same for d1
- x2 and d2 omitted


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]