public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104182] New: [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd
@ 2022-01-22  9:25 marxin at gcc dot gnu.org
  2022-01-22  9:25 ` [Bug c++/104182] " marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-22  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104182
           Summary: [12 Regression] Wrong code since
                    r12-6329-g4f6bc28fc7dd86bd
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jason at gcc dot gnu.org
  Target Milestone: ---

Originally reported here:
https://gitlab.kitware.com/cmake/cmake/-/issues/23126#note_1111696

for the following we emit a wrong code:

$ cat cmake-repro.C
#include <iostream>
#include <string>
#include <vector>

struct S
{
  int A;
  std::string B;
};

struct V
{
  std::vector<S> v;
};

static const V v{ { { { 1, "2" } } } };

int main()
{
  if (v.v[0].A != 1 || v.v[0].B[0] != '2')
    __builtin_abort();
  return 0;
}

$ g++ cmake-repro.C && ./a.out
Aborted (core dumped)

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

* [Bug c++/104182] [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd
  2022-01-22  9:25 [Bug c++/104182] New: [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd marxin at gcc dot gnu.org
@ 2022-01-22  9:25 ` marxin at gcc dot gnu.org
  2022-01-22 12:13 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-22  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=103984
           Priority|P3                          |P1
   Target Milestone|---                         |12.0
   Last reconfirmed|                            |2022-01-22

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

* [Bug c++/104182] [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd
  2022-01-22  9:25 [Bug c++/104182] New: [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd marxin at gcc dot gnu.org
  2022-01-22  9:25 ` [Bug c++/104182] " marxin at gcc dot gnu.org
@ 2022-01-22 12:13 ` pinskia at gcc dot gnu.org
  2022-01-22 19:54 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-22 12:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical

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

* [Bug c++/104182] [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd
  2022-01-22  9:25 [Bug c++/104182] New: [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd marxin at gcc dot gnu.org
  2022-01-22  9:25 ` [Bug c++/104182] " marxin at gcc dot gnu.org
  2022-01-22 12:13 ` pinskia at gcc dot gnu.org
@ 2022-01-22 19:54 ` jason at gcc dot gnu.org
  2022-01-23  3:19 ` cvs-commit at gcc dot gnu.org
  2022-01-23 22:34 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-22 19:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

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

* [Bug c++/104182] [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd
  2022-01-22  9:25 [Bug c++/104182] New: [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-01-22 19:54 ` jason at gcc dot gnu.org
@ 2022-01-23  3:19 ` cvs-commit at gcc dot gnu.org
  2022-01-23 22:34 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-23  3:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 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:9718bc4b03c1a94f7cf64860bbc828aa53c56234

commit r12-6822-g9718bc4b03c1a94f7cf64860bbc828aa53c56234
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Jan 22 17:11:54 2022 -0500

    c++: array temporary at file scope [PR104182]

    This is the same issue as PR104031, but that patch doesn't fix this
    testcase because in this case, current_function_decl isn't set when we get
    to cp_genericize_target_expr.  But there seems to be no need for
    is_local_temp to check for function scope; !TREE_STATIC should be enough.

            PR c++/104182

    gcc/cp/ChangeLog:

            * cp-gimplify.cc (cp_genericize_target_expr): Make sure nothing
            has set DECL_INITIAL on a TARGET_EXPR slot.
            * tree.cc (is_local_temp): Don't check DECL_CONTEXT.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/initlist127.C: New test.

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

* [Bug c++/104182] [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd
  2022-01-22  9:25 [Bug c++/104182] New: [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-23  3:19 ` cvs-commit at gcc dot gnu.org
@ 2022-01-23 22:34 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-23 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22  9:25 [Bug c++/104182] New: [12 Regression] Wrong code since r12-6329-g4f6bc28fc7dd86bd marxin at gcc dot gnu.org
2022-01-22  9:25 ` [Bug c++/104182] " marxin at gcc dot gnu.org
2022-01-22 12:13 ` pinskia at gcc dot gnu.org
2022-01-22 19:54 ` jason at gcc dot gnu.org
2022-01-23  3:19 ` cvs-commit at gcc dot gnu.org
2022-01-23 22:34 ` jason 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).