public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109953] New: segmentation fault with import "functional" during program execution
@ 2023-05-24  9:31 saifi.khan at nishan dot io
  2023-05-24  9:58 ` [Bug c++/109953] " redi at gcc dot gnu.org
  2024-02-16  0:27 ` [Bug c++/109953] [c++modules] " nshead at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: saifi.khan at nishan dot io @ 2023-05-24  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109953
           Summary: segmentation fault with import "functional" during
                    program execution
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: saifi.khan at nishan dot io
  Target Milestone: ---

environment GNU/Linux 6.3.3 gcc 14.0.0 glibc 2.37-3

command 'g++ -std=c++23 -v -g3 -Wall -fmodules-ts'

Here is the program

import "iostream";
import "functional";
import "string_view";

auto test (std::string_view sv) -> void {

      std::cout << sv.substr (std::size_t {0}, std::size_t {8})
                << '\n';
}

auto main () -> int {

     test ("Free Software Community");

return 0;
}

When the program is executed, it encounters a segmentation fault.

The stack trace is as follows

Program received signal SIGSEGV, Segmentation fault.
0x0000555555555344 in std::min<unsigned long> (__a=@0x7fffffffe0d8: 8,
__b=@0x7fffffffe0f8: 23) at /opt/gcc/include/c++/14.0.0/bits/stl_algobase.h:238
238           if (__b < __a)
(gdb) bt
#0  0x0000555555555344 in std::min<unsigned long> (__a=@0x7fffffffe0d8: 8,
__b=@0x7fffffffe0f8: 23) at /opt/gcc/include/c++/14.0.0/bits/stl_algobase.h:238
#1  0x00005555555553bf in std::basic_string_view<char, std::char_traits<char>
>::substr (this=0x7fffffffe130, __pos=0, __n=8)
    at /opt/gcc/include/c++/14.0.0/string_view:336
#2  0x00005555555551c4 in test (sv="Free Software Community") at
str_view_01.cc:10
#3  0x0000555555555230 in main () at str_view_01.cc:16
(gdb) 


NOTE
when the line 'import "functional";' is commented out and the program is
re-compiled. It executes and prints the expected result "Free Sof".

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

* [Bug c++/109953] segmentation fault with import "functional" during program execution
  2023-05-24  9:31 [Bug c++/109953] New: segmentation fault with import "functional" during program execution saifi.khan at nishan dot io
@ 2023-05-24  9:58 ` redi at gcc dot gnu.org
  2024-02-16  0:27 ` [Bug c++/109953] [c++modules] " nshead at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-24  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-05-24
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed.

N.B. to compile the program you first need to do:

for i in iostream functional string_view ; do
  g++ -c -std=c++23 -g3 -fmodules-ts -fmodule-only -x c++-system-header $i
done

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

* [Bug c++/109953] [c++modules] segmentation fault with import "functional" during program execution
  2023-05-24  9:31 [Bug c++/109953] New: segmentation fault with import "functional" during program execution saifi.khan at nishan dot io
  2023-05-24  9:58 ` [Bug c++/109953] " redi at gcc dot gnu.org
@ 2024-02-16  0:27 ` nshead at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-02-16  0:27 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nshead at gcc dot gnu.org
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.0
             Status|NEW                         |RESOLVED

--- Comment #2 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Looks to be fixed on GCC 14 trunk.

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

end of thread, other threads:[~2024-02-16  0:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24  9:31 [Bug c++/109953] New: segmentation fault with import "functional" during program execution saifi.khan at nishan dot io
2023-05-24  9:58 ` [Bug c++/109953] " redi at gcc dot gnu.org
2024-02-16  0:27 ` [Bug c++/109953] [c++modules] " nshead 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).