🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1963

Possible Misplacement of math library in ld++

#1963
From: zhao
Date: Thu, 04 May 1989 00:13
45 lines
1898 bytes
This short program shows a possible misplacement of math library when
ld++ tries to load it. Swapping "-lg++" and "-lm" eliminates the 
problem.

This is run in a SUN3/60M OS4.0.1 using the normal ld.c (not newld.c)

Script started on Wed May  3 17:04:19 1989
[1]: cat bug1.c
#include <stream.h>
#include <Complex.h>

main (void) {

	Complex a(2, 4), b(3, 5);
	Complex c = a + b;

	cout << a << " + " << b << " = " << c << "\n";
}
[2]: g++ -g -v -c bug1.c
g++ version 1.35.0-
 /home/wiener/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 bug1.c /tmp/cca04788.cpp
GNU CPP version 1.35
 /home/wiener/local/lib/gcc-c++ /tmp/cca04788.cpp -quiet -dumpbase bug1.c -noreg -version -G -o /tmp/cca04788.s
GNU C++ version 1.35.0- (68k, MIT syntax) compiled by GNU C version 1.34.91.
 as -mc68020 /tmp/cca04788.s -o bug1.o
[3]: g++ -v -o bug1 bug1.o -lm
g++ version 1.35.0-
 /home/wiener/local/lib/gcc-ld++ -o bug1 -C -dc -dp /home/wiener/local/lib/gcc-crt0+.o /lib/Mcrt1.o bug1.o -lm -lg++ /home/wiener/local/lib/gcc-gnulib -lc
Undefined symbols:
 _log
 _sqrt
 _atan2
 _sinh
 _sin
 _cos
 _cosh
 _exp
 _hypot

[4]: /home/wiener/local/lib/gcc-ld++ -o bug1 -C -dc -dp /home/wiener/local/lib/gcc-crt0+.o /lib/Mcrt1.o bug1.o -lg++ -lm /home/wiener/local/lib/gcc-gnulib -lc
[5]: bug1
(2, 4) + (3, 5) = (5, 9)
[6]: exit
[7]: 
script done on Wed May  3 17:06:04 1989
Technical Details
Message-ID: <17002@usc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!usc!wiener.usc.edu!zhao

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!usc!wiener.usc.edu!zhao
From: zhao@wiener.usc.edu
Newsgroups: gnu.g++.bug
Subject: Possible Misplacement of math library in ld++
Message-ID: <17002@usc.edu>
Date: 4 May 89 00:13:25 GMT
Sender: news@usc.edu
Reply-To: zhao@wiener.usc.edu
Distribution: gnu
Organization: University of Southern California, Los Angeles, CA
Lines: 45