public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110229] New: Segment fault on git clone
@ 2023-06-12 17:44 larry9 at ffdlr dot com
  2023-06-12 17:47 ` [Bug c++/110229] Segment fault with initializer an array (unrolled) in a function pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: larry9 at ffdlr dot com @ 2023-06-12 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110229
           Summary: Segment fault on git clone
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: larry9 at ffdlr dot com
  Target Milestone: ---

Created attachment 55312
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55312&action=edit
Where gdb was at the segfault

The file is initializing a very large vector. An array doesn't cause the
segment fault. It needs to be compiled -O1 too, -O0 doesn't segfault. The file
needs some 12GiB to compile and took 5 hours with the debug cc1plus to get to
the fault. It also takes more or less entries between my machines and versions.
I found this with v11.3 under Ubuntu 22.04 but I did a git clone and compiled
with -O0 -ggdb to get the trace starting like

/net/larry/bin64/g++-git-dbg/libexec/gcc/x86_64-linux-gnu/14.0.0/cc1plus -quiet
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE bug.sh.cpp -quiet -dumpbase
bug.sh.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -O1 -o /tmp/bug.sh.s

#0  0x0000000000c45f4c in gt_ggc_mx_lang_tree_node (x_p=0x7ffcef0f18a0) at
./gt-cp-tree.h:104
#1  0x0000000000c466fd in gt_ggc_mx_lang_tree_node (x_p=<optimized out>) at
./gt-cp-tree.h:494
#2  0x0000000000c466fd in gt_ggc_mx_lang_tree_node (x_p=<optimized out>) at
./gt-cp-tree.h:494
#3  0x0000000000c466fd in gt_ggc_mx_lang_tree_node (x_p=<optimized out>) at
./gt-cp-tree.h:494

I have included the gdb output as an attachment

The code is too large to be an attachment. It could easily be generated by a
script, but I don't know the rules on that one.

typedef unsigned long long int  size_t;

class psuedo_vector {
public:
  ~psuedo_vector() {
    delete[] data_;
  }
  psuedo_vector(size_t sz) {
    data_ = new int[sz];
  }
  int&  operator[] (size_t index) {
    return data_[index];
  }
private:
  int*  data_;
};

psuedo_vector  V(2673938);

void
init_v()
{
  V[19]=19;
  V[20]=20;
...
  V[2589823]=2589823;
  V[2589824]=2589824;
}

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

* [Bug c++/110229] Segment fault with initializer an array (unrolled) in a function
  2023-06-12 17:44 [Bug c++/110229] New: Segment fault on git clone larry9 at ffdlr dot com
@ 2023-06-12 17:47 ` pinskia at gcc dot gnu.org
  2023-06-12 17:54 ` larry9 at ffdlr dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>It could easily be generated by a script, but I don't know the rules on that one.
Attaching the script is ok for this case.

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

* [Bug c++/110229] Segment fault with initializer an array (unrolled) in a function
  2023-06-12 17:44 [Bug c++/110229] New: Segment fault on git clone larry9 at ffdlr dot com
  2023-06-12 17:47 ` [Bug c++/110229] Segment fault with initializer an array (unrolled) in a function pinskia at gcc dot gnu.org
@ 2023-06-12 17:54 ` larry9 at ffdlr dot com
  2023-06-12 18:02 ` [Bug middle-end/110229] " pinskia at gcc dot gnu.org
  2023-06-12 18:11 ` larry9 at ffdlr dot com
  3 siblings, 0 replies; 5+ messages in thread
From: larry9 at ffdlr dot com @ 2023-06-12 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Larry Fiedler <larry9 at ffdlr dot com> ---
Created attachment 55313
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55313&action=edit
script to make the c++ file that segfaults

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

* [Bug middle-end/110229] Segment fault with initializer an array (unrolled) in a function
  2023-06-12 17:44 [Bug c++/110229] New: Segment fault on git clone larry9 at ffdlr dot com
  2023-06-12 17:47 ` [Bug c++/110229] Segment fault with initializer an array (unrolled) in a function pinskia at gcc dot gnu.org
  2023-06-12 17:54 ` larry9 at ffdlr dot com
@ 2023-06-12 18:02 ` pinskia at gcc dot gnu.org
  2023-06-12 18:11 ` larry9 at ffdlr dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-12 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
By the way it is just a stack overflow while GCC is doing a mark and sweep GC .

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

* [Bug middle-end/110229] Segment fault with initializer an array (unrolled) in a function
  2023-06-12 17:44 [Bug c++/110229] New: Segment fault on git clone larry9 at ffdlr dot com
                   ` (2 preceding siblings ...)
  2023-06-12 18:02 ` [Bug middle-end/110229] " pinskia at gcc dot gnu.org
@ 2023-06-12 18:11 ` larry9 at ffdlr dot com
  3 siblings, 0 replies; 5+ messages in thread
From: larry9 at ffdlr dot com @ 2023-06-12 18:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Larry Fiedler <larry9 at ffdlr dot com> ---
Yes, I should have experimented with changing the stack size.
The structure is now done as an initializer list of an array with no problems.

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

end of thread, other threads:[~2023-06-12 18:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 17:44 [Bug c++/110229] New: Segment fault on git clone larry9 at ffdlr dot com
2023-06-12 17:47 ` [Bug c++/110229] Segment fault with initializer an array (unrolled) in a function pinskia at gcc dot gnu.org
2023-06-12 17:54 ` larry9 at ffdlr dot com
2023-06-12 18:02 ` [Bug middle-end/110229] " pinskia at gcc dot gnu.org
2023-06-12 18:11 ` larry9 at ffdlr dot com

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).