This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/41552] New: Undefined references with -flto, dependent on object file ordering
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Oct 2009 10:55:05 -0000
- Subject: [Bug lto/41552] New: Undefined references with -flto, dependent on object file ordering
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
> ./g++ -B. -fPIC -O -flto -c dvector.3.ii slufactor.3.ii
> ./g++ -nostdlib -B. -fPIC -O -shared -o t slufactor.3.o dvector.3.o
> nm t | grep _ZN6soplex7DVectoraSERKNS_6VectorE
> ./g++ -nostdlib -B. -fPIC -O -shared -o t dvector.3.o slufactor.3.o
> nm t | grep _ZN6soplex7DVectoraSERKNS_6VectorE
> ./g++ -nostdlib -B. -fPIC -O -shared -o t dvector.3.o slufactor.3.o -flto
> nm t | grep _ZN6soplex7DVectoraSERKNS_6VectorE
U _ZN6soplex7DVectoraSERKNS_6VectorE
> ./g++ -nostdlib -B. -fPIC -O -shared -o t slufactor.3.o dvector.3.o -flto
> nm t | grep _ZN6soplex7DVectoraSERKNS_6VectorE
00000000000004f2 W _ZN6soplex7DVectoraSERKNS_6VectorE
WTF? 1) That function probably is inlined without lto, 2) Obviously the
merged cgraph is dependent on the ordering of object files on the link
command line...
slufactor.3.ii:
---------------
namespace soplex {
class Vector {
public:
Vector& operator=(const Vector& vec);
int dim() const { }
};
class DVector : public Vector {
public:
void reDim(int newdim);
DVector& operator=(const Vector& vec) {
if (vec.dim() != dim())
reDim(vec.dim());
Vector::operator=(vec);
}
};
class SLinSolver { };
class CLUFactor { };
class SLUFactor : public SLinSolver, private CLUFactor {
DVector vec;
void solveRight (Vector& x, const Vector& b);
};
void SLUFactor::solveRight (Vector& x, const Vector& b) {
vec = b;
vec = b;
}
}
----------
dvector.3.ii:
------------
namespace soplex {
typedef double Real;
class Vector {
int dimen;
Real* val;
public:
Vector(int p_dimen, Real *p_val)
: dimen(p_dimen) , val(p_val) { }
int dim() const {
return dimen;
}
};
class DVector : public Vector {
Real* mem;
void reDim(int newdim);
explicit DVector(const Vector& old);
DVector& operator=(const Vector& vec) {
if (vec.dim() != dim())
reDim(vec.dim());
}
};
DVector::DVector(const Vector& old)
: Vector(0, 0) , mem( 0 )
{
*this = old;
}
}
----------
--
Summary: Undefined references with -flto, dependent on object
file ordering
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41552