Bug 119327 - [12/13/14/15 Regression] -Os breaks inlining: raw_hash_set.h: error: inlining failed in call to 'always_inline': target specific option mismatch since r12-5920
Summary: [12/13/14/15 Regression] -Os breaks inlining: raw_hash_set.h: error: inlining...
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 14.2.0
: P2 normal
Target Milestone: 12.5
Assignee: Jakub Jelinek
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2025-03-17 14:05 UTC by Sergey Fedorov
Modified: 2025-03-25 12:27 UTC (History)
4 users (show)

See Also:
Host:
Target: powerpc*-linux-gnu powerpc-darwin*
Build:
Known to work: 11.2.0
Known to fail: 12.1.0
Last reconfirmed: 2025-03-18 00:00:00


Attachments
Preprocessed source file which fails to compile (538.18 KB, application/zip)
2025-03-17 21:18 UTC, Sergey Fedorov
Details
Reduced testcase (146 bytes, text/plain)
2025-03-18 00:59 UTC, Andrew Pinski
Details
gcc15-pr119327.patch (760 bytes, patch)
2025-03-25 12:27 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Fedorov 2025-03-17 14:05:38 UTC
The code in s2geometry library fails to compile with gcc 14.2.0 if -Os is used:

[ 86%] Building CXX object CMakeFiles/s2.dir/src/s2/s2shapeutil_conversion.cc.o
/opt/local/bin/g++-mp-14 -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/opt/local/libexec/openssl3/include -I/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src -isystem /opt/local/include -pipe -I/opt/local/libexec/openssl3/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17 -arch ppc -mmacosx-version-min=10.6 -fPIC   -Wno-attributes -Wno-deprecated-declarations -MD -MT CMakeFiles/s2.dir/src/s2/s2shapeutil_conversion.cc.o -MF CMakeFiles/s2.dir/src/s2/s2shapeutil_conversion.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2shapeutil_conversion.cc.o -c /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src/s2/s2shapeutil_conversion.cc
[ 87%] Building CXX object CMakeFiles/s2.dir/src/s2/s2shapeutil_count_vertices.cc.o
/opt/local/bin/g++-mp-14 -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/opt/local/libexec/openssl3/include -I/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src -isystem /opt/local/include -pipe -I/opt/local/libexec/openssl3/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17 -arch ppc -mmacosx-version-min=10.6 -fPIC   -Wno-attributes -Wno-deprecated-declarations -MD -MT CMakeFiles/s2.dir/src/s2/s2shapeutil_count_vertices.cc.o -MF CMakeFiles/s2.dir/src/s2/s2shapeutil_count_vertices.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2shapeutil_count_vertices.cc.o -c /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src/s2/s2shapeutil_count_vertices.cc
[ 87%] Building CXX object CMakeFiles/s2.dir/src/s2/s2shapeutil_edge_iterator.cc.o
/opt/local/bin/g++-mp-14 -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/opt/local/libexec/openssl3/include -I/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src -isystem /opt/local/include -pipe -I/opt/local/libexec/openssl3/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17 -arch ppc -mmacosx-version-min=10.6 -fPIC   -Wno-attributes -Wno-deprecated-declarations -MD -MT CMakeFiles/s2.dir/src/s2/s2shapeutil_edge_iterator.cc.o -MF CMakeFiles/s2.dir/src/s2/s2shapeutil_edge_iterator.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2shapeutil_edge_iterator.cc.o -c /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src/s2/s2shapeutil_edge_iterator.cc
In file included from /opt/local/include/absl/container/internal/raw_hash_map.h:26,
                 from /opt/local/include/absl/container/flat_hash_map.h:45,
                 from /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src/s2/s2shapeutil_build_polygon_boundaries.cc:24:
/opt/local/include/absl/container/internal/raw_hash_set.h: In function 'void absl::lts_20240722::container_internal::IterateOverFullSlots(const CommonFields&, SlotType*, Callback) [with SlotType = map_slot_type<const S2Shape*, std::vector<S2Shape*> >; Callback = raw_hash_set<FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, HashEq<const S2Shape*, void>::Hash, HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const ctrl_t*, raw_hash_set<FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, HashEq<const S2Shape*, void>::Hash, HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>]':
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1884:9: note: called from here
 1884 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1893:9: note: called from here
 1893 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1884:9: note: called from here
 1884 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1884:9: note: called from here
 1884 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1893:9: note: called from here
 1893 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1893:9: note: called from here
 1893 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/build'
make[1]: *** [CMakeFiles/s2.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/build'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/build'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/build" && /usr/bin/make -j6 -w all VERBOSE=ON 
Exit code: 2

The same code compiles normally without -Os being passed.

Upstream suggests it could be a compiler bug.
Comment 1 Richard Biener 2025-03-17 14:22:14 UTC
Can you please provide preprocessed source of s2shapeutil_build_polygon_boundaries.cc?
Comment 2 Sergey Fedorov 2025-03-17 21:18:27 UTC
Created attachment 60796 [details]
Preprocessed source file which fails to compile
Comment 3 Sergey Fedorov 2025-03-17 21:20:30 UTC
And result of running the command manually:

$ sudo /opt/local/bin/g++-mp-14 -v -save-temps -DABSL_MIN_LOG_LEVEL=1 -Ds2_EXPORTS -I/opt/local/libexec/openssl3/include -I/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src -isystem /opt/local/include -pipe -I/opt/local/libexec/openssl3/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17 -arch ppc -mmacosx-version-min=10.6 -fPIC   -Wno-attributes -Wno-deprecated-declarations -MD -MT CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o -MF CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o.d -o CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o -c /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src/s2/s2shapeutil_build_polygon_boundaries.cc
Password:
g++-mp-14: warning: '-pipe' ignored because '-save-temps' specified
Using built-in specs.
COLLECT_GCC=/opt/local/bin/g++-mp-14
Target: powerpc-apple-darwin10
Configured with: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_gcc14/gcc14/work/gcc-14.2.0/configure --prefix=/opt/local --build=powerpc-apple-darwin10 --enable-languages=c,c++,objc,obj-c++,lto,fortran,jit --libdir=/opt/local/lib/gcc14 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-14 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-14 --with-gxx-include-dir=/opt/local/include/gcc14/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --with-zstd=/opt/local --enable-checking=release --disable-multilib --enable-lto --enable-libstdcxx-time --without-build-config --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --enable-host-shared --with-darwin-extra-rpath=/opt/local/lib/libgcc --with-libiconv-prefix=/opt/local --disable-tls --with-tune-cpu=G5 --with-gxx-libcxx-include-dir=/opt/local/libexec/gcc14/libc++/include/c++/v1 --with-pkgversion='MacPorts gcc14 14.2.0_1+G5+stdlib_flag'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (MacPorts gcc14 14.2.0_1+G5+stdlib_flag) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-D' 'ABSL_MIN_LOG_LEVEL=1' '-D' 's2_EXPORTS' '-I' '/opt/local/libexec/openssl3/include' '-I' '/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src' '-isystem' '/opt/local/include' '-pipe' '-I' '/opt/local/libexec/openssl3/include' '-Os' '-D' 'NDEBUG' '-I' '/opt/local/libexec/openssl3/include' '-isystem' '/opt/local/include/LegacySupport' '-isystem' '/opt/local/include' '-D' '_GLIBCXX_USE_CXX11_ABI=0' '-std=c++17' '-fPIC' '-Wno-attributes' '-Wno-deprecated-declarations' '-MD' '-MT' 'CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o' '-MF' 'CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o.d' '-o' 'CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o' '-c' '-m32' '-mmacosx-version-min=10.6' '-asm_macosx_version_min=10.6' '-nodefaultexport' '-shared-libgcc' '-dumpdir' 'CMakeFiles/s2.dir/src/s2/'
 /opt/local/libexec/gcc/powerpc-apple-darwin10/14.2.0/cc1plus -E -quiet -v -I /opt/local/libexec/openssl3/include -I /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src -I /opt/local/libexec/openssl3/include -I /opt/local/libexec/openssl3/include -MD CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.d -MF CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o.d -MT CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o -D__DYNAMIC__ -D ABSL_MIN_LOG_LEVEL=1 -D s2_EXPORTS -D NDEBUG -D _GLIBCXX_USE_CXX11_ABI=0 -isystem /opt/local/include -isystem /opt/local/include/LegacySupport -isystem /opt/local/include /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src/s2/s2shapeutil_build_polygon_boundaries.cc -fPIC -m32 -mmacosx-version-min=10.6 -std=c++17 -Wno-attributes -Wno-deprecated-declarations -fPIC -Os -fpch-preprocess -o CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.ii
ignoring duplicate directory "/opt/local/include"
ignoring duplicate directory "/opt/local/include"
ignoring nonexistent directory "/opt/local/lib/gcc14/gcc/powerpc-apple-darwin10/14.2.0/../../../../../powerpc-apple-darwin10/include"
ignoring duplicate directory "/opt/local/libexec/openssl3/include"
ignoring duplicate directory "/opt/local/libexec/openssl3/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/local/libexec/openssl3/include
 /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src
 /opt/local/include
 /opt/local/include/LegacySupport
 /opt/local/include/gcc14/c++/
 /opt/local/include/gcc14/c++//powerpc-apple-darwin10
 /opt/local/include/gcc14/c++//backward
 /opt/local/lib/gcc14/gcc/powerpc-apple-darwin10/14.2.0/include
 /opt/local/lib/gcc14/gcc/powerpc-apple-darwin10/14.2.0/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-D' 'ABSL_MIN_LOG_LEVEL=1' '-D' 's2_EXPORTS' '-I' '/opt/local/libexec/openssl3/include' '-I' '/opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src' '-isystem' '/opt/local/include' '-pipe' '-I' '/opt/local/libexec/openssl3/include' '-Os' '-D' 'NDEBUG' '-I' '/opt/local/libexec/openssl3/include' '-isystem' '/opt/local/include/LegacySupport' '-isystem' '/opt/local/include' '-D' '_GLIBCXX_USE_CXX11_ABI=0' '-std=c++17' '-fPIC' '-Wno-attributes' '-Wno-deprecated-declarations' '-MD' '-MT' 'CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o' '-MF' 'CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o.d' '-o' 'CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.o' '-c' '-m32' '-mmacosx-version-min=10.6' '-asm_macosx_version_min=10.6' '-nodefaultexport' '-shared-libgcc' '-dumpdir' 'CMakeFiles/s2.dir/src/s2/'
 /opt/local/libexec/gcc/powerpc-apple-darwin10/14.2.0/cc1plus -fpreprocessed CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.ii -fPIC -quiet -dumpdir CMakeFiles/s2.dir/src/s2/ -dumpbase s2shapeutil_build_polygon_boundaries.cc.cc -dumpbase-ext .cc -m32 -mmacosx-version-min=10.6 -Os -Wno-attributes -Wno-deprecated-declarations -std=c++17 -version -fPIC -o CMakeFiles/s2.dir/src/s2/s2shapeutil_build_polygon_boundaries.cc.s
GNU C++17 (MacPorts gcc14 14.2.0_1+G5+stdlib_flag) version 14.2.0 (powerpc-apple-darwin10)
	compiled by GNU C version 14.2.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.27-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4eeccb86024452cd4fb7f8152095b7cb
In file included from /opt/local/include/absl/container/internal/raw_hash_map.h:26,
                 from /opt/local/include/absl/container/flat_hash_map.h:45,
                 from /opt/local/var/macports/build/_opt_local_ppcports_math_s2geometry/s2geometry/work/s2geometry-0.12.0/src/s2/s2shapeutil_build_polygon_boundaries.cc:24:
/opt/local/include/absl/container/internal/raw_hash_set.h: In function 'void absl::lts_20240722::container_internal::IterateOverFullSlots(const CommonFields&, SlotType*, Callback) [with SlotType = map_slot_type<const S2Shape*, std::vector<S2Shape*> >; Callback = raw_hash_set<FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, HashEq<const S2Shape*, void>::Hash, HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const ctrl_t*, raw_hash_set<FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, HashEq<const S2Shape*, void>::Hash, HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>]':
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1884:9: note: called from here
 1884 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1893:9: note: called from here
 1893 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1884:9: note: called from here
 1884 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1884:9: note: called from here
 1884 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1893:9: note: called from here
 1893 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
/opt/local/include/absl/container/internal/raw_hash_set.h:3536:9: error: inlining failed in call to 'always_inline' 'absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::destroy_slots()::<lambda(const absl::lts_20240722::container_internal::ctrl_t*, absl::lts_20240722::container_internal::raw_hash_set<absl::lts_20240722::container_internal::FlatHashMapPolicy<const S2Shape*, std::vector<S2Shape*> >, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Hash, absl::lts_20240722::container_internal::HashEq<const S2Shape*, void>::Eq, std::allocator<std::pair<const S2Shape* const, std::vector<S2Shape*> > > >::slot_type*)>': target specific option mismatch
 3536 |         [&](const ctrl_t*, slot_type* slot)
      |         ^
/opt/local/include/absl/container/internal/raw_hash_set.h:1893:9: note: called from here
 1893 |       cb(ctrl + i, slot + i);
      |       ~~^~~~~~~~~~~~~~~~~~~~
Comment 4 Andrew Pinski 2025-03-17 23:37:35 UTC
Trying to reduce it.

But yes I can reproduce it on the trunk and -O2 works but -Os does not.

This might be due to the code savings with the C++ front-end and constructors. Or it could be something else.
Comment 5 Andrew Pinski 2025-03-18 00:15:59 UTC
Note the quick and dirty short function testcase just includes absl and libstdc++ classes (note is not a full testcase just what I have done so far manually to testcase):
```
void BuildPolygonBoundaries() {
  absl::flat_hash_map<int *, std::vector<int>> children;
}
```

So it is not related at all to s2geometry sources as far as I can tell.
Comment 6 Andrew Pinski 2025-03-18 00:59:16 UTC
Created attachment 60798 [details]
Reduced testcase
Comment 7 Andrew Pinski 2025-03-18 01:02:33 UTC
With the reduced testcase fails for powerpc64el-linux-gnu starting in GCC 12.

Works on both aarch64 and x86_64.
Comment 8 Andrew Pinski 2025-03-18 01:09:49 UTC
(In reply to Andrew Pinski from comment #5)
> So it is not related at all to s2geometry sources as far as I can tell.

Except for the `pragma GCC optimize` :).
Comment 9 Andrew Pinski 2025-03-21 17:51:01 UTC
I wonder if this is related to PR 114992. The 2 reduced testcases both have 2 lambda functions in it and both use optimize/target option changing features.
Comment 10 Jakub Jelinek 2025-03-25 11:43:39 UTC
Started with r12-5920-g01ad8c54fdca1db3d71bf6c4b861a9d1db3c2a59
Comment 11 Jakub Jelinek 2025-03-25 12:21:02 UTC
So, the difference that precludes inlining is OPTION_MASK_SAVE_TOC_INDIRECT.
This is set conditionally based on 
  /* If we can shrink-wrap the TOC register save separately, then use
     -msave-toc-indirect unless explicitly disabled.  */
  if ((rs6000_isa_flags_explicit & OPTION_MASK_SAVE_TOC_INDIRECT) == 0
      && flag_shrink_wrap_separate
      && optimize_function_for_speed_p (cfun))
    rs6000_isa_flags |= OPTION_MASK_SAVE_TOC_INDIRECT;
where optimize_function_for_speed_p depends not just on -Os/-Oz vs. other options, but also whether it is cold or not etc., so failing inlining because of this doesn't make any sense to me.  Although in rs6000_isa_flags, it doesn't feel like this is an ISA flag but just an optimization hint.
Comment 12 Jakub Jelinek 2025-03-25 12:27:18 UTC
Created attachment 60874 [details]
gcc15-pr119327.patch

Untested patch which fixes the testcase for me.