public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115403] New: [15 Regression]  highway build from git fails with 'target specific option mismatch' since r15-902-geff00046409a72
@ 2024-06-09  8:54 slyfox at gcc dot gnu.org
  2024-06-09  8:59 ` [Bug c++/115403] " slyfox at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-06-09  8:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115403

            Bug ID: 115403
           Summary: [15 Regression]  highway build from git fails with
                    'target specific option mismatch' since
                    r15-902-geff00046409a72
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

I was not able to extract small example yet from highway. The build failure
happens on gcc-15 since r15-902-geff00046409a72 (bisected):

    commit eff00046409a7289bfdc1861e68b532895f91c0e
    Author: Jason Merrill <jason@redhat.com>
    Date:   Wed Feb 14 17:18:17 2024 -0500

        c++: pragma target and static init [PR109753]

Looks relevant.

The build fails as:

hwy/base.h:1006:40: error: inlining failed in call to 'always_inline'
'constexpr To hwy::BitCastScalar(const From&) [with To = short unsigned int;
From = float16_t; EnableIf<((bool)(! IsSpecialFloat<To>()))>* <anonymous> =
0]': target specific option mismatch
 1006 | HWY_API HWY_BITCASTSCALAR_CONSTEXPR To BitCastScalar(const From& val) {
      |                                        ^~~~~~~~~~~~~

I think it's a gcc bug. highway uses `__attribute__((target(...)))` on a
per-function basis.

To reproduce:

    $ git clone https://github.com/google/highway.git
    # I got 026be6bf23c026eb2ab6d28dfb9e4ecdda909d4d locally
    $ cd highway/
    $ mkdir b
    $ cd b
    $ cmake ..
    $ make
    [ 42%] Building CXX object
CMakeFiles/float_test.dir/hwy/tests/float_test.cc.o
    ...
    In file included from highway/hwy/tests/float_test.cc:22:
highway/hwy/base.h: In function 'constexpr bool hwy::ScalarIsInf(T) [with T =
float16_t]':
highway/hwy/base.h:1006:40: error: inlining failed in call to 'always_inline'
'constexpr To hwy::BitCastScalar(const From&) [with To = short unsigned int;
From = float16_t; EnableIf<((bool)(! IsSpecialFloat<To>()))>* <anonymous> =
0]': target specific option mismatch
 1006 | HWY_API HWY_BITCASTSCALAR_CONSTEXPR To BitCastScalar(const From& val) {
      |                                        ^~~~~~~~~~~~~
highway/hwy/base.h:2855:43: note: called from here
 2855 |   return static_cast<TU>(BitCastScalar<TU>(static_cast<TF>(val)) << 1)
==
      |                          ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

$ gcc -v |& unnix
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-15.0.0/bin/gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-15.0.0/libexec/gcc/x86_64-unknown-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../source/configure --prefix=/<<NIX>>/gcc-15.0.0
--with-gmp-include=/<<NIX>>/gmp-6.3.0-dev/include
--with-gmp-lib=/<<NIX>>/gmp-6.3.0/lib
--with-mpfr-include=/<<NIX>>/mpfr-4.2.1-dev/include
--with-mpfr-lib=/<<NIX>>/mpfr-4.2.1/lib --with-mpc=/<<NIX>>/libmpc-1.3.1
--with-native-system-header-dir=/<<NIX>>/glibc-2.39-52-dev/include
--with-build-sysroot=/
--with-gxx-include-dir=/<<NIX>>/gcc-15.0.0/include/c++/15.0.0/
--program-prefix= --enable-lto --disable-libstdcxx-pch
--without-included-gettext --with-system-zlib --enable-checking=release
--enable-static --enable-languages=c,c++ --disable-multilib --enable-plugin
--disable-libcc1 --with-isl=/<<NIX>>/isl-0.20 --disable-bootstrap
--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=x86_64-unknown-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 99999999 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115403] [15 Regression]  highway build from git fails with 'target specific option mismatch' since r15-902-geff00046409a72
  2024-06-09  8:54 [Bug c++/115403] New: [15 Regression] highway build from git fails with 'target specific option mismatch' since r15-902-geff00046409a72 slyfox at gcc dot gnu.org
@ 2024-06-09  8:59 ` slyfox at gcc dot gnu.org
  2024-06-09 10:17 ` slyfox at gcc dot gnu.org
  2024-06-09 16:46 ` [Bug c++/115403] [15 Regression] highway build from git fails with 'target specific option mismatch' (templates) " pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-06-09  8:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115403

--- Comment #1 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Created attachment 58388
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58388&action=edit
float_test.cc.cc.xz

Attaching preprocessed file. It fails as:

$ g++ -O2 -std=c++17 -c float_test.cc.cc
float_test.cc.cc: In function 'constexpr bool hwy::ScalarIsInf(T) [with T =
float16_t]':
float_test.cc.cc:15617:108: error: inlining failed in call to 'always_inline'
'constexpr To hwy::BitCastScalar(const From&) [with To = short unsigned int;
From = float16_t; EnableIf<((bool)(! IsSpecialFloat<To>()))>* <anonymous> =
0]': target specific option mismatch
15617 | ine)) __attribute__((flatten)) __attribute__((unused)) constexpr To
BitCastScalar(const From& val) {
      |                                                                    
^~~~~~~~~~~~~
float_test.cc.cc:16478:43: note: called from here
16478 |   return static_cast<TU>(BitCastScalar<TU>(static_cast<TF>(val)) << 1)
==
      |                          ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115403] [15 Regression]  highway build from git fails with 'target specific option mismatch' since r15-902-geff00046409a72
  2024-06-09  8:54 [Bug c++/115403] New: [15 Regression] highway build from git fails with 'target specific option mismatch' since r15-902-geff00046409a72 slyfox at gcc dot gnu.org
  2024-06-09  8:59 ` [Bug c++/115403] " slyfox at gcc dot gnu.org
@ 2024-06-09 10:17 ` slyfox at gcc dot gnu.org
  2024-06-09 16:46 ` [Bug c++/115403] [15 Regression] highway build from git fails with 'target specific option mismatch' (templates) " pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-06-09 10:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115403

--- Comment #2 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
`cvise` came up with this example:

    //$ cat float_test.cc.cc
    template <typename> __attribute__((always_inline)) inline void
AssertEqual() {}
    void TestAllF16FromF32() { AssertEqual<float>(); }
    #pragma GCC target "sse4.1"

Looks valid?

gcc-14 can handle it, gcc-15 can't:

$ g++-14 -O2 -std=c++17 -c float_test.cc.cc

$ g++-15 -O2 -std=c++17 -c float_test.cc.cc
float_test.cc.cc: In function 'void TestAllF16FromF32()':
float_test.cc.cc:1:64: error: inlining failed in call to 'always_inline' 'void
AssertEqual() [with <template-parameter-1-1> = float]': target specific option
mismatch
    1 | template <typename> __attribute__((always_inline)) inline void
AssertEqual() {}
      |                                                               
^~~~~~~~~~~
float_test.cc.cc:2:46: note: called from here
    2 | void TestAllF16FromF32() { AssertEqual<float>(); }
      |                            ~~~~~~~~~~~~~~~~~~^~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115403] [15 Regression]  highway build from git fails with 'target specific option mismatch'  (templates) since r15-902-geff00046409a72
  2024-06-09  8:54 [Bug c++/115403] New: [15 Regression] highway build from git fails with 'target specific option mismatch' since r15-902-geff00046409a72 slyfox at gcc dot gnu.org
  2024-06-09  8:59 ` [Bug c++/115403] " slyfox at gcc dot gnu.org
  2024-06-09 10:17 ` slyfox at gcc dot gnu.org
@ 2024-06-09 16:46 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-09 16:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115403

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |rejects-valid
                 CC|                            |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-06-09
            Summary|[15 Regression]  highway    |[15 Regression]  highway
                   |build from git fails with   |build from git fails with
                   |'target specific option     |'target specific option
                   |mismatch' since             |mismatch'  (templates)
                   |r15-902-geff00046409a72     |since
                   |                            |r15-902-geff00046409a72
   Target Milestone|---                         |15.0

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-09 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-09  8:54 [Bug c++/115403] New: [15 Regression] highway build from git fails with 'target specific option mismatch' since r15-902-geff00046409a72 slyfox at gcc dot gnu.org
2024-06-09  8:59 ` [Bug c++/115403] " slyfox at gcc dot gnu.org
2024-06-09 10:17 ` slyfox at gcc dot gnu.org
2024-06-09 16:46 ` [Bug c++/115403] [15 Regression] highway build from git fails with 'target specific option mismatch' (templates) " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).