[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#907586: Fwd: Bug#907586: g++ compiler problem on hppa



Thanks for reporting this problem and generating a reduced testcase.

S.cpp is miscompiled at -O2.  The test passes if it is compiled at -O0.

The hppa architecture is unique in that function pointers point to function descriptors. Function pointers need to be "canonicalized" before they can be compared.  This involves calling _dl_fixup if a function descriptor hasn't been bound to its actual target.  Lazy binding is the default and the test fails due to the fact that the function pointers in _ZNK2SR4findEv
are not canonicalized at -O2.

A minor issue is "-fPIC" should be added to the link command "g++ -shared -o libS.so S.o".

I created a gcc PR:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87188

On 2018-08-29 10:01 PM, Matthias Klose wrote:


-------- Forwarded Message --------
Subject: Bug#907586: g++ compiler problem on hppa
Resent-Date: Wed, 29 Aug 2018 19:09:01 +0000
Resent-From: Mattias Ellert <mattias.ellert@physics.uu.se>
Resent-To: debian-bugs-dist@lists.debian.org
Resent-CC: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Date: Wed, 29 Aug 2018 21:04:09 +0200
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Reply-To: Mattias Ellert <mattias.ellert@physics.uu.se>, 907586@bugs.debian.org
To: submit@bugs.debian.org

Package: g++-8
Version: 8.2.0-4 Severity: important

One of the packages I maintain have been failing in its test suite on
hppa ever since it was first uploaded. I was never able to investigate
the reason for this because there until recently were no hppa porter
box.

I recently discovered that there is now an hppa porter box and I have
been able to reproduce the issue. I managed to take the failing part of
the code and reduce it to a small test case that is attached to this
bug report.

The issue only happens on hppa, and only when linking using a shared
library. If the test case is linked statically the issue does not
appear.

On all architectures except hppa the output of the test case is the
following:

$ make
g++ -O2 -g -c -o main.o main.cpp
g++ -O2 -g -fPIC -c -o S.o S.cpp
g++ -shared -o libS.so S.o
g++ -o main main.o -L. -lS
g++ -o altmain main.o S.o
-- Running using shared library
LD_LIBRARY_PATH=. ./main
OK
-- Running using static build
./altmain
OK

On hppa the output is as follows:

$ make
g++ -O2 -g -c -o main.o main.cpp
g++ -O2 -g -fPIC -c -o S.o S.cpp
g++ -shared -o libS.so S.o
g++ -o main main.o -L. -lS
g++ -o altmain main.o S.o
-- Running using shared library
LD_LIBRARY_PATH=. ./main
not OK
-- Running using static build
./altmain
OK
Dave

--
John David Anglin  dave.anglin@bell.net


Reply to: