public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109421] New: Compilation takes a long time for struct that contains a large default-initialized array
@ 2023-04-05 17:20 ejakobs at boerboeltrading dot com
  2023-04-05 17:24 ` [Bug c++/109421] " pinskia at gcc dot gnu.org
  2023-04-05 17:25 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ejakobs at boerboeltrading dot com @ 2023-04-05 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109421
           Summary: Compilation takes a long time for struct that contains
                    a large default-initialized array
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ejakobs at boerboeltrading dot com
  Target Milestone: ---

This is similar to #59659, but is still a problem in GCC 11.2.1 and GCC 10.2.1. 

The following code takes a very long time to compile with -O3 enabled:


#include <vector>

#ifndef SIZE
#define SIZE 100000
#endif
struct S
{
  int a;
};

struct T
{
  std::vector<S> arr[SIZE]{}; // remove the default-initializer {} to compile
fast
};

int main(int argc, char** argv)
{
  T t;
  for (int i=0; i<SIZE; ++i) {
    t.arr[i].push_back(S{argc * i}); // use argc so that gcc doesn't optimize
everything out
  }
  return t.arr[SIZE-1][0].a;
}

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

* [Bug c++/109421] Compilation takes a long time for struct that contains a large default-initialized array
  2023-04-05 17:20 [Bug c++/109421] New: Compilation takes a long time for struct that contains a large default-initialized array ejakobs at boerboeltrading dot com
@ 2023-04-05 17:24 ` pinskia at gcc dot gnu.org
  2023-04-05 17:25 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-05 17:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks to be fixed with GCC 12.1.0 .

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

* [Bug c++/109421] Compilation takes a long time for struct that contains a large default-initialized array
  2023-04-05 17:20 [Bug c++/109421] New: Compilation takes a long time for struct that contains a large default-initialized array ejakobs at boerboeltrading dot com
  2023-04-05 17:24 ` [Bug c++/109421] " pinskia at gcc dot gnu.org
@ 2023-04-05 17:25 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-05 17:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 92385.

*** This bug has been marked as a duplicate of bug 92385 ***

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

end of thread, other threads:[~2023-04-05 17:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-05 17:20 [Bug c++/109421] New: Compilation takes a long time for struct that contains a large default-initialized array ejakobs at boerboeltrading dot com
2023-04-05 17:24 ` [Bug c++/109421] " pinskia at gcc dot gnu.org
2023-04-05 17:25 ` 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).