← Back to team overview

touch-packages team mailing list archive

[Bug 1473674] Re: apt fails a test from the testsuite on ppc64el when built with gcc-5 and -O3

 

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
Touch seeded packages, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/1473674

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

Status in apt package in Ubuntu:
  Confirmed
Status in gcc-5 package in Ubuntu:
  New
Status in apt source package in Wily:
  Confirmed
Status in gcc-5 source package in Wily:
  New

Bug description:
  to reproduce:

   - wily chroot
   - PPA https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-016/
     (this holds gcc-5 as the default, branch 20150711).
   - dpkg-buildpackage -B 

  note that explicitly using the gcc-5/g++-5 from wily doesn't show the
  test failure. the only difference in the configuration is that the one
  in wily is built using the old libstdc++ ABI and the one in the PPA
  with the dual ABI defaulting to new/c++11.

  building with -O2 instead of -O3 works around the issue.

  [ RUN      ] CDROMTest.FindPackages
  /scratch/doko/tmp/apt-1.0.9.10ubuntu1/test/libapt/cdromfindpackages_test.cc:95: Failure
  Value of: InfoDir
    Actual: ""
  Expected: path + "/.disk/"
  Which is: "/tmp/apt-tests-findpackage.gpopMw/.disk/"
  [  FAILED  ] CDROMTest.FindPackages (4 ms)

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


References