public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65591] New: G++ should use default constructor for {}-init when possible
@ 2015-03-26 20:38 jason at gcc dot gnu.org
  2015-03-27  9:28 ` [Bug c++/65591] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2015-03-26 20:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65591
           Summary: G++ should use default constructor for {}-init when
                    possible
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jason at gcc dot gnu.org
                CC: daniel.kruegler at googlemail dot com, jakub at gcc dot gnu.org,
                    jason at gcc dot gnu.org, maltsevm at gmail dot com,
                    mpolacek at gcc dot gnu.org, pinskia at gcc dot gnu.org
        Depends on: 65154

>From Mikhail Maltsev's comment 5 on Bug #65154:

But it reveals some latent bug (PR65503). In the following case (after applying
the patch):

struct ss {
    ss() {};
};
struct C {
      ss s[1000];
};
int main() {
      C cs[5]{};
}

We'll get 1000 calls to ss() in main instead of calling default c-tor of struct
C. (which is probably not what we want).

-----

I agree that we want to call the default constructor in this case, and let the
inliner decide from there.  This is not the same issue as bug 65503.


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

* [Bug c++/65591] G++ should use default constructor for {}-init when possible
  2015-03-26 20:38 [Bug c++/65591] New: G++ should use default constructor for {}-init when possible jason at gcc dot gnu.org
@ 2015-03-27  9:28 ` rguenth at gcc dot gnu.org
  2015-03-27 15:47 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-27  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-27
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/65591] G++ should use default constructor for {}-init when possible
  2015-03-26 20:38 [Bug c++/65591] New: G++ should use default constructor for {}-init when possible jason at gcc dot gnu.org
  2015-03-27  9:28 ` [Bug c++/65591] " rguenth at gcc dot gnu.org
@ 2015-03-27 15:47 ` jason at gcc dot gnu.org
  2021-07-23  1:31 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2015-03-27 15:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED
         Depends on|                            |65503

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Actually, the standard (8.5.1/8.5.4) says we need to do aggregate
initialization here, so this is either a language issue or a duplicate of bug
65503.


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

* [Bug c++/65591] G++ should use default constructor for {}-init when possible
  2015-03-26 20:38 [Bug c++/65591] New: G++ should use default constructor for {}-init when possible jason at gcc dot gnu.org
  2015-03-27  9:28 ` [Bug c++/65591] " rguenth at gcc dot gnu.org
  2015-03-27 15:47 ` jason at gcc dot gnu.org
@ 2021-07-23  1:31 ` pinskia at gcc dot gnu.org
  2022-01-07  0:48 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-23  1:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We should be able to do a loop instead of 1000 calls though.

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

* [Bug c++/65591] G++ should use default constructor for {}-init when possible
  2015-03-26 20:38 [Bug c++/65591] New: G++ should use default constructor for {}-init when possible jason at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-07-23  1:31 ` pinskia at gcc dot gnu.org
@ 2022-01-07  0:48 ` pinskia at gcc dot gnu.org
  2022-01-07  0:55 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07  0:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65591
Bug 65591 depends on bug 65503, which changed state.

Bug 65503 Summary: g++ string array in struct crash
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65503

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

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

* [Bug c++/65591] G++ should use default constructor for {}-init when possible
  2015-03-26 20:38 [Bug c++/65591] New: G++ should use default constructor for {}-init when possible jason at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-07  0:48 ` pinskia at gcc dot gnu.org
@ 2022-01-07  0:55 ` pinskia at gcc dot gnu.org
  2022-01-07  2:56 ` jason at gcc dot gnu.org
  2022-01-07  5:23 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07  0:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I thought the patch which fixes PR 92385 would fix this one but instead we
are getting an ICE which I filed as PR 103936. I suspect after that is fixed
this will also be fixed.

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

* [Bug c++/65591] G++ should use default constructor for {}-init when possible
  2015-03-26 20:38 [Bug c++/65591] New: G++ should use default constructor for {}-init when possible jason at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-01-07  0:55 ` pinskia at gcc dot gnu.org
@ 2022-01-07  2:56 ` jason at gcc dot gnu.org
  2022-01-07  5:23 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-07  2:56 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Yes, this is fixed by r12-6326.  And then broken again by r12-6329, which I'll
address in the new PR.

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

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

* [Bug c++/65591] G++ should use default constructor for {}-init when possible
  2015-03-26 20:38 [Bug c++/65591] New: G++ should use default constructor for {}-init when possible jason at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-01-07  2:56 ` jason at gcc dot gnu.org
@ 2022-01-07  5:23 ` cvs-commit at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-07  5:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:765693be1c8dc91fe612e7a499c5e41ba398ab96

commit r12-6339-g765693be1c8dc91fe612e7a499c5e41ba398ab96
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jan 6 21:58:01 2022 -0500

    c++: temporarily restore VEC_INIT_EXPR gimplify [PR103936]

    PR103936 demonstrates that some VEC_INIT_EXPR can still survive into
    GENERIC; until that's fixed let's put back the handling in
cp_gimplify_expr.

            PR c++/103936
            PR c++/65591

    gcc/cp/ChangeLog:

            * cp-gimplify.c (cp_gimplify_expr): Restore VEC_INIT_EXPR handling.

    gcc/testsuite/ChangeLog:

            * g++.dg/init/aggr15.C: New test.

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

end of thread, other threads:[~2022-01-07  5:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 20:38 [Bug c++/65591] New: G++ should use default constructor for {}-init when possible jason at gcc dot gnu.org
2015-03-27  9:28 ` [Bug c++/65591] " rguenth at gcc dot gnu.org
2015-03-27 15:47 ` jason at gcc dot gnu.org
2021-07-23  1:31 ` pinskia at gcc dot gnu.org
2022-01-07  0:48 ` pinskia at gcc dot gnu.org
2022-01-07  0:55 ` pinskia at gcc dot gnu.org
2022-01-07  2:56 ` jason at gcc dot gnu.org
2022-01-07  5:23 ` cvs-commit 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).