public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++
@ 2022-10-03 17:41 unlvsur at live dot com
  2022-10-03 19:28 ` [Bug libstdc++/107135] " arsen at aarsen dot me
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: unlvsur at live dot com @ 2022-10-03 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107135
           Summary: array<T>::at() method should not be in <array> for
                    freestanding C++
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unlvsur at live dot com
  Target Milestone: ---

Created attachment 53658
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53658&action=edit
array diff

Looks like array and span are GCC extensions to be in freestanding. That is
fine.
However, I think at() method has little chance to be in the future freestanding
C++ standard. I suggest that we should guard against those methods to prevent
potential issues forwarding compatibility issues.

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
@ 2022-10-03 19:28 ` arsen at aarsen dot me
  2022-10-03 19:40 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: arsen at aarsen dot me @ 2022-10-03 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

Arsen Arsenović <arsen at aarsen dot me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arsen at aarsen dot me

--- Comment #1 from Arsen Arsenović <arsen at aarsen dot me> ---
I'm not so sure, exceptions are explicitly mentioned (and specified to just
std::terminate if not possible/disabled) in P1642. The paper defers handling
these headers for later. With the exceptions note in mind, what forward
compatibility issue do you have in mind?

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
  2022-10-03 19:28 ` [Bug libstdc++/107135] " arsen at aarsen dot me
@ 2022-10-03 19:40 ` redi at gcc dot gnu.org
  2022-10-03 20:21 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-03 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We should make it terminate though, there's no definition of
__throw_out_of_range_fmt.

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
  2022-10-03 19:28 ` [Bug libstdc++/107135] " arsen at aarsen dot me
  2022-10-03 19:40 ` redi at gcc dot gnu.org
@ 2022-10-03 20:21 ` redi at gcc dot gnu.org
  2022-10-03 20:26 ` unlvsur at live dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-03 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 53662
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53662&action=edit
Define <bits/functexcept.h> function for freestanding

I think I prefer this direction.

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
                   ` (2 preceding siblings ...)
  2022-10-03 20:21 ` redi at gcc dot gnu.org
@ 2022-10-03 20:26 ` unlvsur at live dot com
  2022-10-03 20:47 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: unlvsur at live dot com @ 2022-10-03 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from cqwrteur <unlvsur at live dot com> ---
(In reply to Jonathan Wakely from comment #3)
> Created attachment 53662 [details]
> Define <bits/functexcept.h> function for freestanding
> 
> I think I prefer this direction.

Well i guess it would only work for sub classes of logic_error and bad_alloc.

Herb Sutter said those EH will be terminate in the future even it is for
hosted? I think a consistent behavior between freestanding and hosted are very
important. Speaking the same words with different languages is just like
spelling Chinese Words for Japanese Words, they are super confusing.

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
                   ` (3 preceding siblings ...)
  2022-10-03 20:26 ` unlvsur at live dot com
@ 2022-10-03 20:47 ` redi at gcc dot gnu.org
  2022-10-03 20:49 ` unlvsur at live dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-03 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #53662|0                           |1
        is obsolete|                            |

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 53663
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53663&action=edit
Define <bits/functexcept.h> function for freestanding

This one actually works correctly.

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
                   ` (4 preceding siblings ...)
  2022-10-03 20:47 ` redi at gcc dot gnu.org
@ 2022-10-03 20:49 ` unlvsur at live dot com
  2022-10-03 20:50 ` unlvsur at live dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: unlvsur at live dot com @ 2022-10-03 20:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from cqwrteur <unlvsur at live dot com> ---
Comment on attachment 53663
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53663
Define <bits/functexcept.h> function for freestanding

std::terminate() or std::abort() or __builtin_trap()??

std::terminate() has the issue of set_terminate() which causes trouble.

GCC optimizes __builtin_trap() best but it is not standard.

What about __builtin_abort()???

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
                   ` (5 preceding siblings ...)
  2022-10-03 20:49 ` unlvsur at live dot com
@ 2022-10-03 20:50 ` unlvsur at live dot com
  2022-10-04 14:07 ` cvs-commit at gcc dot gnu.org
  2022-10-04 14:28 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: unlvsur at live dot com @ 2022-10-03 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from cqwrteur <unlvsur at live dot com> ---
(In reply to cqwrteur from comment #6)
> Comment on attachment 53663 [details]
> Define <bits/functexcept.h> function for freestanding
> 
> std::terminate() or std::abort() or __builtin_trap()??
> 
> std::terminate() has the issue of set_terminate() which causes trouble.
> 
> GCC optimizes __builtin_trap() best but it is not standard.
> 
> What about __builtin_abort()???

maybe we could just mark std::terminate as weak?

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
                   ` (6 preceding siblings ...)
  2022-10-03 20:50 ` unlvsur at live dot com
@ 2022-10-04 14:07 ` cvs-commit at gcc dot gnu.org
  2022-10-04 14:28 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-04 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:7d8189882fc89f6f410fc9bcf0f8226787316f83

commit r13-3058-g7d8189882fc89f6f410fc9bcf0f8226787316f83
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Oct 3 20:53:35 2022 +0100

    libstdc++: Define <bits/functexcept.h> functions for freestanding
[PR107135]

    We don't compile src/c++11/functexcept.cc for freestanding, so just
    define the functions used by freestanding entities as inline calls to
    std::terminate.

    libstdc++-v3/ChangeLog:

            PR libstdc++/107135
            * include/bits/functexcept.h [!_GLIBCXX_HOSTED]
            (__throw_invalid_argument, __throw_out_of_range)
            (__throw_out_of_range_fmt, __throw_runtime_error)
            (__throw_overflow_error): Define inline.
            * include/std/bitset (_M_copy_from_ptr) [!_GLIBCXX_HOSTED]:
            Replace __builtin_abort with __throw_invalid_argument.

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

* [Bug libstdc++/107135] array<T>::at() method should not be in <array> for freestanding C++
  2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
                   ` (7 preceding siblings ...)
  2022-10-04 14:07 ` cvs-commit at gcc dot gnu.org
@ 2022-10-04 14:28 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-04 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |13.0

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed. Doing something other than std::terminate is a decision for another day.
For now, the freestanding environment needs to provide abort().

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

end of thread, other threads:[~2022-10-04 14:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 17:41 [Bug libstdc++/107135] New: array<T>::at() method should not be in <array> for freestanding C++ unlvsur at live dot com
2022-10-03 19:28 ` [Bug libstdc++/107135] " arsen at aarsen dot me
2022-10-03 19:40 ` redi at gcc dot gnu.org
2022-10-03 20:21 ` redi at gcc dot gnu.org
2022-10-03 20:26 ` unlvsur at live dot com
2022-10-03 20:47 ` redi at gcc dot gnu.org
2022-10-03 20:49 ` unlvsur at live dot com
2022-10-03 20:50 ` unlvsur at live dot com
2022-10-04 14:07 ` cvs-commit at gcc dot gnu.org
2022-10-04 14:28 ` 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).