Launchpad has imported 17 comments from the remote bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66868.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2015-07-14T12:05:54+00:00 Doko-v wrote:

Created attachment 35975
preprocessed source

[forwarded from
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1473674]

seen in the apt package manager, when built with -O3. Works with -O2 or
-O3 -fno-inline-functions -finline-small-functions, on at least x86_64
and powerpc64le. The test CDROMTest.FindPackages from the apt testsuite
then fails.

built with g++ -c -g -O3 -fPIE -fstack-protector-strong -fPIC

upstream writes:

There is a Cdrom wrapper:
"""
class Cdrom : public pkgCdrom {
   public:
      bool FindPackages(std::string const &CD,
     std::vector<std::string> &List,
     std::vector<std::string> &SList,
     std::vector<std::string> &SigList,
     std::vector<std::string> &TransList,
     std::string &InfoDir) {
  std::string const startdir = SafeGetCWD();
  EXPECT_FALSE(startdir.empty());
  bool const result = pkgCdrom::FindPackages(CD, List, SList, SigList, 
TransList, InfoDir, NULL, 0);
...
}
"""

and a unittest that calls it:
"""
TEST(CDROMTest,FindPackages)
{
   Cdrom cd;
  std::string InfoDir;
  EXPECT_TRUE(cd.FindPackages(path, Packages, Sources, Signatur, Translation, 
InfoDir));
...
  EXPECT_EQ(path + "/.disk/", InfoDir);
}
"""
The actual code for this is apt-pkg/cdrom.cc:
"""
bool pkgCdrom::FindPackages(string CD,
       vector<string> &List,
       vector<string> &SList,
       vector<string> &SigList,
       vector<string> &TransList,
       string &InfoDir, pkgCdromStatus *log,
       unsigned int Depth)
{
...
   if (DirectoryExists(".disk") == true)
   {
      if (InfoDir.empty() == true)
  InfoDir = CD + ".disk/";
   }
...
"""

So I suspect that the optimizer gets confused that InfoDir is a
reference or it gets confused because InfoDir is not used in
FindPackages anymore and it assumes its dead code.

I tried to create a simplified testcase but failed so far. Whats interessting 
is that if I add a std::cerr << "debug" line into cdrom.cc lines (or even a "CD 
= CD"):
"""
   if (DirectoryExists(".disk") == true)
   {
      if (InfoDir.empty() == true) {
std::cerr << "debug" << std::endl;
  InfoDir = CD + ".disk/";
}
   }
"""
it works (which indicates dead-code elimination to me).

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/4

------------------------------------------------------------------------
On 2015-07-14T12:25:42+00:00 Trippels wrote:

Have you tried to build with -fsanitize=undefined?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/5

------------------------------------------------------------------------
On 2015-07-14T13:02:47+00:00 Doko-v wrote:

the testsuite passes with -fsanitize=undefined (no additional output)
and both -fsanitize=undefined -fsanitize-undefined-trap-on-error doesn't
abort either.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/6

------------------------------------------------------------------------
On 2015-07-16T09:12:36+00:00 Rguenth wrote:

GCC 5.2 is being released, adjusting target milestone to 5.3.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/7

------------------------------------------------------------------------
On 2015-07-21T22:10:17+00:00 Bill-schmidt wrote:

Hm.  I compiled it as stated and I see a bunch of code that appears to
be storing the ".disk/" string.  So it doesn't look like dead code
elimination.  Perhaps a branch is short circuiting this, or the address
of where to store it has been corrupted.

I don't have any way to confirm that I'm reproducing the problem when I
compile, from what's given here.  It might be helpful to provide the
full test case without ellipses, and the failure message given by the
test.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/9

------------------------------------------------------------------------
On 2015-07-22T13:54:47+00:00 Bill-schmidt wrote:

Using current trunk, I compared the 193t.optimized dumps for the
original cdrom.ii attachment and for the same attachment modified to add
the debug output statement from the end of comment 2.  Other than the
added statements for the debug output, there don't appear to be any
changes.  This bug is marked as 5.1/6 regression -- are you certain that
it regresses on trunk?  Will check 5.1 the same way.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/10

------------------------------------------------------------------------
On 2015-07-22T13:55:28+00:00 Bill-schmidt wrote:

Sorry, not from comment 2 on this bugzilla; comment 2 from the launchpad
bug.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/11

------------------------------------------------------------------------
On 2015-07-22T14:07:46+00:00 Bill-schmidt wrote:

I tried the same thing with a snapshot of the 5 branch I had lying
around:  r225783 from 2015-07-14.  I also don't see any differences in
the output from the middle end, as I would expect since this bug has
shown up on multiple targets.  So maybe this has been fixed recently?
Let me see if I can find an older snapshot.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/12

------------------------------------------------------------------------
On 2015-07-22T14:28:34+00:00 Bill-schmidt wrote:

Same experiment with r222218 from 2015-04-18.  Same results.

At this point I can't reproduce anything from the information given.  Do
you have any local modifications that could be causing this?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/13

------------------------------------------------------------------------
On 2015-07-24T19:58:48+00:00 Doko-v wrote:

this works ok with trunk r226068, still fails on the branch.

gcc is configured with --enable-
languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-
libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath
--enable-plugin --with-system-zlib --disable-browser-plugin --enable-
java-awt=gtk --enable-gtk-cairo --with-java-
home=/usr/lib/jvm/java-1.5.0-gcj-5-ppc64el/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-ppc64el --with-jvm-
jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-ppc64el --with-arch-
directory=ppc64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-
objc-gc --enable-secureplt --with-cpu=power7 --with-tune=power8
--disable-multilib --enable-multiarch --disable-werror --with-long-
double-128 --enable-checking=release --build=powerpc64le-linux-gnu
--host=powerpc64le-linux-gnu --target=powerpc64le-linux-gnu

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/15

------------------------------------------------------------------------
On 2015-07-24T23:34:11+00:00 Doko-v wrote:

rechecked with a 5.2.0 release tarball, fails with -O3

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/16

------------------------------------------------------------------------
On 2015-07-27T17:05:45+00:00 Doko-v wrote:

rechecked with a 5.1.0 release tarball, fails with -O3

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/17

------------------------------------------------------------------------
On 2015-11-18T11:15:12+00:00 Rguenth wrote:

Matthias, can you bisect what makes it work on trunk?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/18

------------------------------------------------------------------------
On 2015-11-18T12:15:32+00:00 Jakub-gcc wrote:

I don't see significant difference when adding the CD = CD; on the gcc 5
branch either.  So, IMNSHO, if you want anything to move forward on this
issue, you need to create a (small) self-contained testcase out of it.
Add noinline attributes to the functions/methods that are called in
FindPackages and do not need to be inlined to reproduce it, add noinline
to FindPackages itself, if it still reproduces, stub the noinline
functions/methods it calls and stub a caller (new main) that calls
FindPackages that just sets up everything that is needed to reproduce.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/19

------------------------------------------------------------------------
On 2015-12-04T10:45:51+00:00 Rguenth wrote:

GCC 5.3 is being released, adjusting target milestone.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/21

------------------------------------------------------------------------
On 2016-06-03T10:05:40+00:00 Rguenth wrote:

GCC 5.4 is being released, adjusting target milestone.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/22

------------------------------------------------------------------------
On 2016-08-13T10:17:30+00:00 Doko-v wrote:

this turned out as a code issue in apt:
https://anonscm.debian.org/cgit/apt/apt.git/commit/?id=9445fa62386c80c9822e77484d30b2109aa0f2dc

Reply at:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1473674/comments/26


** Changed in: gcc
       Status: Unknown => Invalid

** Changed in: gcc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1473674

Title:
  apt fails a test from the testsuite on ppc64el when built with gcc-5
  and -O3

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/1473674/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to