Re: Help with Rawhide build error with GCC 6.0

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

 



On 03/02/16 17:30 +0000, Jonathan Wakely wrote:
On 03/02/16 10:59 -0600, Richard Shaw wrote:
With the release of GCC 6.0 in Rawhide I'm having a build
warning/error[1,2] with OpenImageIO I'm not sure what to do with (other
than adding a flag to ignore it).

tl;dr either add -Wno-error=placement-new for now or try the
workaround at the bottom of this mail.

Upstream is looking into it but currently thinks that the pugixml API is
requiring a method that GCC 6.0 doesn't like:

No, the code is trying to place a large object in a tiny buffer, and
GCC issues a warning about that, because it looks suspect. Because the
package uses -Werror (which I won't rant about now) that warning
becomes an error and so breaks the build.

It looks like the code is possibly safe though, meaning the warning is
a false-positive. The code appears to be using an emulated form of C99
flexible-array member (which isn't supported in standard C++). I
assume there is a 1-byte array at the end of the object, and then they
over-allocating for the object so they can store something else in the
location beginning at the 1-byte array e.g.

#include <stdlib.h>

struct X {
enum Type { Int, Double };
Type type;
char data[1];
};

int main()
{
X* p = (X*)malloc(sizeof(X) + sizeof(double) - 1);
*(double*)p->data = 1.0;

Oops, I pasted the wrong version of the example. To reproduce the same
warning the line above should be:

 double* d = new (p->data) double(1.0);


p->type = X::Double;
}
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
http://lists.fedoraproject.org/admin/lists/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux