From: Peter Seiderer <ps.report@gmx.net>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v1] package/assimp: disable -Werror compile flag
Date: Sun, 12 Dec 2021 17:02:19 +0100 [thread overview]
Message-ID: <20211212170219.321ee357@gmx.net> (raw)
In-Reply-To: <d84bde70-7a76-69ea-7b87-7b15b4ee9df8@mind.be>
Hello Arnout,
On Sun, 12 Dec 2021 15:41:09 +0100, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 10/12/2021 15:25, Peter Seiderer wrote:
> > Add patch to disable -Werror compile flag.
> >
> > Fixes:
> >
> > - http://autobuild.buildroot.net/results/49beb264b8454b9af092278074c4087013692052/
> >
> > .../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
> > 285 | std::unique_ptr<bool[]> done(new bool[max_out]);
> > | ^
> > [...]
> > .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
> > 127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
> > | ^~~~~~~~
> >
> > Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> > ---
> > package/assimp/0001-code-disable-Werror.patch | 39 +++++++++++++++++++
> > 1 file changed, 39 insertions(+)
> > create mode 100644 package/assimp/0001-code-disable-Werror.patch
> >
> > diff --git a/package/assimp/0001-code-disable-Werror.patch b/package/assimp/0001-code-disable-Werror.patch
> > new file mode 100644
> > index 0000000000..33867e61c3
> > --- /dev/null
> > +++ b/package/assimp/0001-code-disable-Werror.patch
> > @@ -0,0 +1,39 @@
> > +From 5146e1c4d58174e302dbdcf2a85c2023be1cffc6 Mon Sep 17 00:00:00 2001
> > +From: Peter Seiderer <ps.report@gmx.net>
> > +Date: Fri, 10 Dec 2021 15:15:30 +0100
> > +Subject: [PATCH] code: disable -Werror
> > +MIME-Version: 1.0
> > +Content-Type: text/plain; charset=UTF-8
> > +Content-Transfer-Encoding: 8bit
> > +
> > +Fixes:
> > +
> > + .../build/assimp-5.1.3/code/PostProcessing/TriangulateProcess.cpp:285:50: error: argument 1 value ‘4294967294’ exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
> > + 285 | std::unique_ptr<bool[]> done(new bool[max_out]);
> > + | ^
> > + [...]
> > + .../host/opt/ext-toolchain/powerpc-buildroot-linux-uclibc/include/c++/9.3.0/new:127:26: note: in a call to allocation function ‘void* operator new [](std::size_t)’ declared here
> > + 127 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
> > + | ^~~~~~~~
> > +
> > +Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> > +---
> > + code/CMakeLists.txt | 2 --
> > + 1 file changed, 2 deletions(-)
> > +
> > +diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
> > +index e45bf8a2a..f71b6583d 100644
> > +--- a/code/CMakeLists.txt
> > ++++ b/code/CMakeLists.txt
> > +@@ -1167,8 +1167,6 @@ TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp)
> > + # enable warnings as errors ########################################
> > + IF (MSVC)
> > + TARGET_COMPILE_OPTIONS(assimp PRIVATE /WX)
> > +-ELSE()
> > +- TARGET_COMPILE_OPTIONS(assimp PRIVATE -Werror)
>
> This looks like a patch that is not upstreamable, so not so nice.
>
> Worse though: it seems that the issue raised by Werror could be an actual bug.
> Allocting 4GB doesn't sound like a good idea, does it?
>
> So perhaps it would be better to create an upstream issue for this? It should
> be relatively easy to reproduce, any 32-bit target should be sufficient, no?
Thanks for review and sorry for being to short in the commit message, the code
in question is from build/assimp-5.1.0/code/PostProcessing/TriangulateProcess.cpp
is:
225 // Find out how many output faces we'll get
226 uint32_t numOut = 0, max_out = 0;
227 bool get_normals = true;
228 for( unsigned int a = 0; a < pMesh->mNumFaces; a++) {
229 aiFace& face = pMesh->mFaces[a];
230 if (face.mNumIndices <= 4) {
231 get_normals = false;
232 }
233 if( face.mNumIndices <= 3) {
234 numOut++;
235
236 }
237 else {
238 numOut += face.mNumIndices-2;
239 max_out = std::max(max_out,face.mNumIndices);
240 }
241 }
[...]
284 // use std::unique_ptr to avoid slow std::vector<bool> specialiations
285 std::unique_ptr<bool[]> done(new bool[max_out]);
The warning creeped in most likely with upstream commit [1] and I believe is
a false positive a la [2]..., it is not a real overflow but a warning about
a possible/theoretically overflow....
Regards,
Peter
[1] https://github.com/assimp/assimp/commit/b94183376ced40aecab78b5b5893dca8277542b9
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783
>
> Regards,
> Arnout
>
> > + ENDIF()
> > +
> > + # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler
> > +--
> > +2.34.1
> > +
> >
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2021-12-12 16:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 14:25 [Buildroot] [PATCH v1] package/assimp: disable -Werror compile flag Peter Seiderer
2021-12-12 14:41 ` Arnout Vandecappelle
2021-12-12 16:02 ` Peter Seiderer [this message]
2021-12-27 10:26 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211212170219.321ee357@gmx.net \
--to=ps.report@gmx.net \
--cc=arnout@mind.be \
--cc=buildroot@buildroot.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.