Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 840616 - media-libs/assimp-5.2.3 - cc1plus: all warnings being treated as errors
Summary: media-libs/assimp-5.2.3 - cc1plus: all warnings being treated as errors
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Bernd
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: werror gcc-12
  Show dependency tree
 
Reported: 2022-04-24 16:14 UTC by Toralf Förster
Modified: 2022-04-29 19:13 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,18.00 KB, text/plain)
2022-04-24 16:14 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,208.43 KB, text/plain)
2022-04-24 16:14 UTC, Toralf Förster
Details
environment (environment,90.73 KB, text/plain)
2022-04-24 16:14 UTC, Toralf Förster
Details
etc.portage.tar.bz2 (etc.portage.tar.bz2,15.43 KB, application/x-bzip)
2022-04-24 16:14 UTC, Toralf Förster
Details
logs.tar.bz2 (logs.tar.bz2,4.62 KB, application/x-bzip)
2022-04-24 16:14 UTC, Toralf Förster
Details
media-libs:assimp-5.2.3:20220424-144715.log.bz2 (media-libs:assimp-5.2.3:20220424-144715.log.bz2,7.02 KB, application/x-bzip)
2022-04-24 16:14 UTC, Toralf Förster
Details
temp.tar.bz2 (temp.tar.bz2,28.73 KB, application/x-bzip)
2022-04-24 16:14 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2022-04-24 16:14:47 UTC
too long lines were shrinked:

/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp: In member function void Assimp::SMDImporter::CreateOutputMeshes()’:
/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp:240:57: note: at offset 103079215088 into object of size [8, 103079215088] allocated by operator new []’
  240 |     FaceList* aaiFaces = new FaceList[pScene->mNumMeshes];
      |                                                         ^
cc1plus: all warnings being treated as errors
[164/238] /usr/bin/x86_64-pc-linux-gnu-g++ -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_NO_M3D_EXPORTER -DASSIMP_BUILD_NO_M3D_IMPORTER -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0 -DOPENDDLPARSER_BUILD -DRAPIDJSO
[165/238] /usr/bin/x86_64-pc-linux-gnu-g++ -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_NO_M3D_EXPORTER -DASSIMP_BUILD_NO_M3D_IMPORTER -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0 -DOPENDDLPARSER_BUILD -DRAPIDJSO

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1_desktop_plasma-j4-20220422-045129

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-12.0.1 *
clang/llvm (if any):
clang version 14.0.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/14/bin
/usr/lib/llvm/14
14.0.1
Python 3.9.12
Available Ruby profiles:
  [1]   ruby26 (with Rubygems)
  [2]   ruby27 (with Rubygems)
  [3]   ruby31 (with Rubygems) *
Available Rust versions:
  [1]   rust-bin-1.60.0
  [2]   rust-1.60.0 *
The following VMs are available for generation-2:
*)	Eclipse Temurin JDK 11.0.14_p9 [openjdk-bin-11]
2)	Eclipse Temurin JDK 8.322_p06 [openjdk-bin-8]
Available Java Virtual Machines:
  [1]   openjdk-bin-8 
  [2]   openjdk-bin-11  system-vm

The Glorious Glasgow Haskell Compilation System, version 8.10.4
php cli:

  HEAD of ::gentoo
commit 08e65041d3a10a63223be66817c3057b99c3f199
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Sun Apr 24 14:03:27 2022 +0000

    2022-04-24 14:03:27 UTC

emerge -qpvO media-libs/assimp
[ebuild  N    ] media-libs/assimp-5.2.3  USE="-samples -test"
Comment 1 Toralf Förster gentoo-dev 2022-04-24 16:14:48 UTC
Created attachment 774121 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2022-04-24 16:14:49 UTC
Created attachment 774124 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2022-04-24 16:14:51 UTC
Created attachment 774127 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2022-04-24 16:14:52 UTC
Created attachment 774130 [details]
etc.portage.tar.bz2
Comment 5 Toralf Förster gentoo-dev 2022-04-24 16:14:53 UTC
Created attachment 774133 [details]
logs.tar.bz2
Comment 6 Toralf Förster gentoo-dev 2022-04-24 16:14:54 UTC
Created attachment 774136 [details]
media-libs:assimp-5.2.3:20220424-144715.log.bz2
Comment 7 Toralf Förster gentoo-dev 2022-04-24 16:14:55 UTC
Created attachment 774139 [details]
temp.tar.bz2
Comment 8 Bernd 2022-04-24 20:44:02 UTC
Does gcc-12 treat all warnings as errors by default, i.e. without using the -Werror flag?
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-24 20:56:11 UTC
(In reply to Bernd from comment #8)
> Does gcc-12 treat all warnings as errors by default, i.e. without using the
> -Werror flag?

No, but new compiler versions often either enable new _specific_ warnings-as-errors (like -Werror=foo, but not -Werror), or improve analysis so something which was previously not detected is now found.

In this case:

/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.1/include/g++-v12/bits/vector.tcc:114:27: error: array subscript 4294967295 is outside array bounds of ‘void [103079215088]’ [-Werror=array-bounds]
  114 |         if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
      |             ~~~~~~~~~~~~~~^~~~~~~~~
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-24 20:56:50 UTC
(In reply to Sam James from comment #9)
> (In reply to Bernd from comment #8)
> > Does gcc-12 treat all warnings as errors by default, i.e. without using the
> > -Werror flag?
> 
> No, but new compiler versions often either enable new _specific_
> warnings-as-errors (like -Werror=foo, but not -Werror), or improve analysis
> so something which was previously not detected is now found.
> 
> In this case:

sorry, I meant:

FAILED: code/CMakeFiles/assimp.dir/AssetLib/SMD/SMDLoader.cpp.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_NO_M3D_EXPORTER -DASSIMP_BUILD_NO_M3D_IMPORTER -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0 -DOPENDDLPARSER_BUILD -DRAPIDJSON_HAS_STDSTRING=1 -DRAPIDJSON_NOMEMBERITERATORCLASS -Dassimp_EXPORTS -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3_build/include -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3_build -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/include -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/. -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/../contrib/pugixml/src -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/../contrib/rapidjson/include -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/../contrib -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/../contrib/openddlparser/include -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/../include -I/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3_build/code/../include -I/usr/include/minizip  -fvisibility=hidden -fno-strict-aliasing -Wall -pipe -march=native -fno-diagnostics-color -O2 -Wall -fPIC -Werror -std=gnu++11 -MD -MT code/CMakeFiles/assimp.dir/AssetLib/SMD/SMDLoader.cpp.o -MF code/CMakeFiles/assimp.dir/AssetLib/SMD/SMDLoader.cpp.o.d -o code/CMakeFiles/assimp.dir/AssetLib/SMD/SMDLoader.cpp.o -c /var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.1/include/g++-v12/vector:70,
                 from /var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/include/assimp/DefaultLogger.hpp:57,
                 from /var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/include/assimp/fast_atof.h:30,
                 from /var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp:49:
In member function ‘void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {unsigned int}; _Tp = unsigned int; _Alloc = std::allocator<unsigned int>]’,
    inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = unsigned int; _Alloc = std::allocator<unsigned int>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.1/include/g++-v12/bits/stl_vector.h:1294:21,
    inlined from ‘void Assimp::SMDImporter::CreateOutputMeshes()’ at /var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp:255:50:
/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.1/include/g++-v12/bits/vector.tcc:114:27: error: array subscript 4294967295 is outside array bounds of ‘void [103079215088]’ [-Werror=array-bounds]
  114 |         if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
      |             ~~~~~~~~~~~~~~^~~~~~~~~
/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp: In member function ‘void Assimp::SMDImporter::CreateOutputMeshes()’:
/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp:240:57: note: at offset 103079215088 into object of size [8, 103079215088] allocated by ‘operator new []’
  240 |     FaceList* aaiFaces = new FaceList[pScene->mNumMeshes];
      |                                                         ^
In member function ‘void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {unsigned int}; _Tp = unsigned int; _Alloc = std::allocator<unsigned int>]’,
    inlined from ‘void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = unsigned int; _Alloc = std::allocator<unsigned int>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.1/include/g++-v12/bits/stl_vector.h:1294:21,
    inlined from ‘void Assimp::SMDImporter::CreateOutputMeshes()’ at /var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp:255:50:
/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.1/include/g++-v12/bits/vector.tcc:114:54: error: array subscript 4294967295 is outside array bounds of ‘void [103079215088]’ [-Werror=array-bounds]
  114 |         if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
      |                                        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp: In member function ‘void Assimp::SMDImporter::CreateOutputMeshes()’:
/var/tmp/portage/media-libs/assimp-5.2.3/work/assimp-5.2.3/code/AssetLib/SMD/SMDLoader.cpp:240:57: note: at offset 103079215088 into object of size [8, 103079215088] allocated by ‘operator new []’
  240 |     FaceList* aaiFaces = new FaceList[pScene->mNumMeshes];
      |                                                         ^
Comment 11 Bernd 2022-04-25 04:48:07 UTC
Could it be, this specific error (-Werror=array-bounds) is being added by the -Wall option? Neither the porting guide[1] nor the ChangeLog[2] has any hints on changes related to array bounds.

[1] https://gcc.gnu.org/gcc-12/porting_to.html
[2] https://gcc.gnu.org/gcc-12/changes.html
Comment 12 Bernd 2022-04-25 04:49:27 UTC
Just noticed, the -Werror option is added as well, although it shouldn't.
Comment 13 cyrillic 2022-04-28 02:18:27 UTC
It works a lot better when I remove -Werror

--- a/code/CMakeLists.txt	2022-03-17 06:35:44.000000000 -0400
+++ b/code/CMakeLists.txt	2022-04-27 22:10:03.270946358 -0400
@@ -1176,13 +1176,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)
-ENDIF()
-
 # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler
 TARGET_COMPILE_FEATURES(assimp PRIVATE c_std_99)
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-28 02:19:09 UTC
(In reply to Bernd from comment #11)
> Could it be, this specific error (-Werror=array-bounds) is being added by
> the -Wall option? Neither the porting guide[1] nor the ChangeLog[2] has any
> hints on changes related to array bounds.
> 
> [1] https://gcc.gnu.org/gcc-12/porting_to.html
> [2] https://gcc.gnu.org/gcc-12/changes.html

It's likely that the analyser got stricter rather than it being a new default -Werror here, I think.
Comment 15 Bernd 2022-04-28 05:16:34 UTC
(In reply to cyrillic from comment #13)
> It works a lot better when I remove -Werror
> 
> --- a/code/CMakeLists.txt	2022-03-17 06:35:44.000000000 -0400
> +++ b/code/CMakeLists.txt	2022-04-27 22:10:03.270946358 -0400
> @@ -1176,13 +1176,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)
> -ENDIF()
> -
>  # adds C_FLAGS required to compile zip.c on old GCC 4.x compiler
>  TARGET_COMPILE_FEATURES(assimp PRIVATE c_std_99)

In the PR I'm preparing, the ELSE() clause will be patched out as well. A global filter-flags didn't work though.

(In reply to Sam James from comment #14)
> (In reply to Bernd from comment #11)
> > Could it be, this specific error (-Werror=array-bounds) is being added by
> > the -Wall option? Neither the porting guide[1] nor the ChangeLog[2] has any
> > hints on changes related to array bounds.
> > 
> > [1] https://gcc.gnu.org/gcc-12/porting_to.html
> > [2] https://gcc.gnu.org/gcc-12/changes.html
> 
> It's likely that the analyser got stricter rather than it being a new
> default -Werror here, I think.

I agree, but upstream uses a global -Werror. As discussed in the linked upstream report, there's a suggestion to remove this for downstream packaging. Let's see if they pick up this suggestion.
Comment 16 Larry the Git Cow gentoo-dev 2022-04-29 02:22:39 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c7abed13a49d96d90fdeda81bba828271cace87

commit 3c7abed13a49d96d90fdeda81bba828271cace87
Author:     Bernd Waibel <waebbl-gentoo@posteo.net>
AuthorDate: 2022-04-28 06:06:12 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-04-29 02:22:31 +0000

    media-libs/assimp: build with gcc-12
    
    Fix an -Werror=array-bounds issue with gcc-12, by patching out the
    global -Werror flag used by upstream.
    Drop failing tests for x86_32.
    
    Closes: https://bugs.gentoo.org/840616
    Closes: https://bugs.gentoo.org/840767
    Bug: https://github.com/assimp/assimp/issues/4438
    Bug: https://github.com/assimp/assimp/issues/4433
    Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
    Closes: https://github.com/gentoo/gentoo/pull/25234
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/assimp/assimp-5.2.3.ebuild              |   9 ++
 .../assimp-5.2.3-drop-Werror-gcc-option.patch      |  22 ++++
 ...p-5.2.3-drop-failing-tests-for-abi_x86_32.patch | 131 +++++++++++++++++++++
 3 files changed, 162 insertions(+)