I looked into this and the issue is the following:

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).

-- 
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/ubuntu/+source/apt/+bug/1473674/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to