public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/91488] [9/10/11 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
@ 2020-11-16 22:03 ` redi at gcc dot gnu.org
  2021-01-14  8:19 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-16 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to ensadc from comment #1)
> It seems that the inliner does not like the `static` specifier in
> `__constant_string_p`. This also triggers "inlining failed in call to
> always_inline" error:
> 
> static __attribute__((always_inline)) constexpr bool
> f()
> {
>     return __builtin_is_constant_evaluated();
> }
> 
> int main() {
>     (void)f();
> }

That 'static' causes ODR violations, so I think we need to get rid of it
anyway.

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

* [Bug libstdc++/91488] [9/10/11 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
  2020-11-16 22:03 ` [Bug libstdc++/91488] [9/10/11 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17 redi at gcc dot gnu.org
@ 2021-01-14  8:19 ` rguenth at gcc dot gnu.org
  2021-06-01  8:15 ` [Bug libstdc++/91488] [9/10/11/12 " rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-14  8:19 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug libstdc++/91488] [9/10/11/12 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
  2020-11-16 22:03 ` [Bug libstdc++/91488] [9/10/11 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17 redi at gcc dot gnu.org
  2021-01-14  8:19 ` rguenth at gcc dot gnu.org
@ 2021-06-01  8:15 ` rguenth at gcc dot gnu.org
  2021-06-07  8:11 ` gustavo at ugr dot es
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug libstdc++/91488] [9/10/11/12 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-06-01  8:15 ` [Bug libstdc++/91488] [9/10/11/12 " rguenth at gcc dot gnu.org
@ 2021-06-07  8:11 ` gustavo at ugr dot es
  2021-06-07  8:14 ` gustavo at ugr dot es
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: gustavo at ugr dot es @ 2021-06-07  8:11 UTC (permalink / raw)
  To: gcc-bugs

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

gustavo <gustavo at ugr dot es> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gustavo at ugr dot es

--- Comment #5 from gustavo <gustavo at ugr dot es> ---
the bug is still here in gcc versión 11.1.1 20210531 (Red Hat 11.1.1-3) (GCC)

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

* [Bug libstdc++/91488] [9/10/11/12 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-06-07  8:11 ` gustavo at ugr dot es
@ 2021-06-07  8:14 ` gustavo at ugr dot es
  2021-06-07  8:16 ` gustavo at ugr dot es
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: gustavo at ugr dot es @ 2021-06-07  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from gustavo <gustavo at ugr dot es> ---
the bug is still here in gcc versión 11.1.1 20210531 (Red Hat 11.1.1-3) (GCC)


g++ -fgnu-tm -O1 -Wall    bug.cc   -o bug
In file included from /usr/include/c++/11/ios:40,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from bug.cc:2:
/usr/include/c++/11/bits/char_traits.h: In static member function 'static
constexpr std::size_t std::char_traits<char>::length(const char_type*)':
/usr/include/c++/11/bits/char_traits.h:257:5: error: inlining failed in call to
'always_inline' 'constexpr bool std::__constant_string_p(const _CharT*) [with
_CharT = char]': 
  257 |     __constant_string_p(const _CharT* __s)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/char_traits.h:368:32: note: called from here
  368 |         if (__constant_string_p(__s))
      |             ~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/11/bits/char_traits.h:257:5: error: inlining failed in call to
'always_inline' 'constexpr bool std::__constant_string_p(const _CharT*) [with
_CharT = char]': 
  257 |     __constant_string_p(const _CharT* __s)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/char_traits.h:368:32: note: called from here
  368 |         if (__constant_string_p(__s))
      |             ~~~~~~~~~~~~~~~~~~~^~~~~
make: *** [<builtin>: bug] Error 1

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

* [Bug libstdc++/91488] [9/10/11/12 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-06-07  8:14 ` gustavo at ugr dot es
@ 2021-06-07  8:16 ` gustavo at ugr dot es
  2021-06-17 21:45 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: gustavo at ugr dot es @ 2021-06-07  8:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from gustavo <gustavo at ugr dot es> ---
can be reproduced also trunk gcc in: 
https://gcc.godbolt.org/z/v6T9j3r4M

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

* [Bug libstdc++/91488] [9/10/11/12 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-06-07  8:16 ` gustavo at ugr dot es
@ 2021-06-17 21:45 ` cvs-commit at gcc dot gnu.org
  2021-06-18 10:20 ` [Bug libstdc++/91488] [9/10/11 " cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-17 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:b376b1ef38971b84975ad1540bf5d2ae0b924e76

commit r12-1603-gb376b1ef38971b84975ad1540bf5d2ae0b924e76
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jun 17 14:11:22 2021 +0100

    libstdc++: Simplify constexpr checks in std::char_traits [PR 91488]

    This removes the helper functions added by r8-1294 to detect whether the
    char_traits member functions can be evaluated at compile time. Instead,
    we can just use __builtin_constant_evaluated directly, which is well
    supported by non-GCC compilers by now.

    As a result, there is a chance that those members will no longer be
    usable in constant expressions when using old versions of non-GCC
    compilers. Make the relevant feature test macros depend on the
    availability of __builtin_constant_evaluated, so they are defined only
    when the feature is actualyl available.

    The new testcase from the PR is added to the libitm testsuite, because
    that's where we can be sure it's OK to use the -fgnu-tm option.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

            PR libstdc++/91488

    libstdc++-v3/ChangeLog:

            * include/bits/basic_string.h (__cpp_lib_constexpr_string): Only
            define when is_constant_evaluated is available.
            * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits):
            Likewise.
            (__constant_string_p, __constant_array_p): Remove.
            (char_traits): Use is_constant_evaluated directly.
            * include/std/version (__cpp_lib_constexpr_char_traits)
            (__cpp_lib_constexpr_string): Only define when
            is_constant_evaluated is available.

    libitm/ChangeLog:

            * testsuite/libitm.c++/libstdc++-pr91488.C: New test.

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

* [Bug libstdc++/91488] [9/10/11 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2021-06-17 21:45 ` cvs-commit at gcc dot gnu.org
@ 2021-06-18 10:20 ` cvs-commit at gcc dot gnu.org
  2021-06-18 11:50 ` [Bug libstdc++/91488] [9/10 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-18 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:0191c74141cfea8973a6d977ce9944d39f7c4329

commit r11-8616-g0191c74141cfea8973a6d977ce9944d39f7c4329
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jun 17 14:11:22 2021 +0100

    libstdc++: Simplify constexpr checks in std::char_traits [PR 91488]

    This removes the 'static' keyword from the helper functions added by
    r8-1294 to detect whether the char_traits member functions can be
    evaluated at compile time. This prevents the "inlining failed" error
    reported in the PR.

    The new testcase from the PR is added to the libitm testsuite, because
    that's where we can be sure it's OK to use the -fgnu-tm option.

    As a drive-by fix, the feature test macros for C++20 P0980R1 support are
    made to depend on whether __cpp_lib_is_constant_evaluated is defined.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

            PR libstdc++/91488

    libstdc++-v3/ChangeLog:

            * include/bits/basic_string.h (__cpp_lib_constexpr_string): Only
            define C++20 value when std::is_constant_evaluated is available.
            * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits):
            Likewise.
            (__constant_string_p, __constant_array_p): Give external
            linkage.
            * include/std/version (__cpp_lib_constexpr_char_traits)
            (__cpp_lib_constexpr_string): Only define C++20 values when
            is_constant_evaluated is available.

    libitm/ChangeLog:

            * testsuite/libitm.c++/libstdc++-pr91488.C: New test.

    (cherry picked from commit b376b1ef38971b84975ad1540bf5d2ae0b924e76)

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

* [Bug libstdc++/91488] [9/10 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2021-06-18 10:20 ` [Bug libstdc++/91488] [9/10/11 " cvs-commit at gcc dot gnu.org
@ 2021-06-18 11:50 ` cvs-commit at gcc dot gnu.org
  2021-06-18 14:43 ` cvs-commit at gcc dot gnu.org
  2021-06-18 14:45 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-18 11:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:b7cf6b97fc3f6c02a5d0114fed14f40b08ab3ad8

commit r10-9932-gb7cf6b97fc3f6c02a5d0114fed14f40b08ab3ad8
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jun 17 14:11:22 2021 +0100

    libstdc++: Simplify constexpr checks in std::char_traits [PR 91488]

    This removes the 'static' keyword from the helper functions added by
    r8-1294 to detect whether the char_traits member functions can be
    evaluated at compile time. This prevents the "inlining failed" error
    reported in the PR.

    The new testcase from the PR is added to the libitm testsuite, because
    that's where we can be sure it's OK to use the -fgnu-tm option.

    As a drive-by fix, the feature test macros for C++20 P0980R1 support are
    made to depend on whether __cpp_lib_is_constant_evaluated is defined.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

            PR libstdc++/91488

    libstdc++-v3/ChangeLog:

            * include/bits/basic_string.h (__cpp_lib_constexpr_string): Only
            define C++20 value when std::is_constant_evaluated is available.
            * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits):
            Likewise.
            (__constant_string_p, __constant_array_p): Give external
            linkage.
            * include/std/version (__cpp_lib_constexpr_char_traits)
            (__cpp_lib_constexpr_string): Only define C++20 values when
            is_constant_evaluated is available.

    libitm/ChangeLog:

            * testsuite/libitm.c++/libstdc++-pr91488.C: New test.

    (cherry picked from commit b376b1ef38971b84975ad1540bf5d2ae0b924e76)

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

* [Bug libstdc++/91488] [9/10 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2021-06-18 11:50 ` [Bug libstdc++/91488] [9/10 " cvs-commit at gcc dot gnu.org
@ 2021-06-18 14:43 ` cvs-commit at gcc dot gnu.org
  2021-06-18 14:45 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-18 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:cc44169fc7bc7552eb85f143f4fee9c8bcdd5e49

commit r9-9590-gcc44169fc7bc7552eb85f143f4fee9c8bcdd5e49
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jun 17 14:11:22 2021 +0100

    libstdc++: Simplify constexpr checks in std::char_traits [PR 91488]

    This removes the 'static' keyword from the helper functions added by
    r8-1294 to detect whether the char_traits member functions can be
    evaluated at compile time. This prevents the "inlining failed" error
    reported in the PR.

    The new testcase from the PR is added to the libitm testsuite, because
    that's where we can be sure it's OK to use the -fgnu-tm option.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

            PR libstdc++/91488

    libstdc++-v3/ChangeLog:

            * include/bits/char_traits.h (__constant_string_p)
            (__constant_array_p): Give external linkage.

    libitm/ChangeLog:

            * testsuite/libitm.c++/libstdc++-pr91488.C: New test.

    (cherry picked from commit b376b1ef38971b84975ad1540bf5d2ae0b924e76)

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

* [Bug libstdc++/91488] [9/10 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17
       [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2021-06-18 14:43 ` cvs-commit at gcc dot gnu.org
@ 2021-06-18 14:45 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-18 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 9.5, 10.4 and 11.2

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

end of thread, other threads:[~2021-06-18 14:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-91488-4@http.gcc.gnu.org/bugzilla/>
2020-11-16 22:03 ` [Bug libstdc++/91488] [9/10/11 Regression] char_traits::length causes "inlining failed in call to always_inline" error with -fgnu-tm -O2 -std=c++17 redi at gcc dot gnu.org
2021-01-14  8:19 ` rguenth at gcc dot gnu.org
2021-06-01  8:15 ` [Bug libstdc++/91488] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-06-07  8:11 ` gustavo at ugr dot es
2021-06-07  8:14 ` gustavo at ugr dot es
2021-06-07  8:16 ` gustavo at ugr dot es
2021-06-17 21:45 ` cvs-commit at gcc dot gnu.org
2021-06-18 10:20 ` [Bug libstdc++/91488] [9/10/11 " cvs-commit at gcc dot gnu.org
2021-06-18 11:50 ` [Bug libstdc++/91488] [9/10 " cvs-commit at gcc dot gnu.org
2021-06-18 14:43 ` cvs-commit at gcc dot gnu.org
2021-06-18 14:45 ` redi 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).