public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/84900] [9/10/11/12 Regression] cast of compound literal does not cause the code to become a non-lvalue
       [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
@ 2022-01-03 20:45 ` pinskia at gcc dot gnu.org
  2022-01-21 13:51 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-03 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
      Known to fail|                            |4.5.3, 4.6.4, 4.7.1, 4.9.0,
                   |                            |5.1.0
            Summary|Compiler report a error     |[9/10/11/12 Regression]
                   |unexpectedly.               |cast of compound literal
                   |                            |does not cause the code to
                   |                            |become a non-lvalue
      Known to work|                            |4.1.2, 4.4.7

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

* [Bug c/84900] [9/10/11/12 Regression] cast of compound literal does not cause the code to become a non-lvalue
       [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
  2022-01-03 20:45 ` [Bug c/84900] [9/10/11/12 Regression] cast of compound literal does not cause the code to become a non-lvalue pinskia at gcc dot gnu.org
@ 2022-01-21 13:51 ` rguenth at gcc dot gnu.org
  2022-05-27  9:38 ` [Bug c/84900] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-21 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c/84900] [10/11/12/13 Regression] cast of compound literal does not cause the code to become a non-lvalue
       [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
  2022-01-03 20:45 ` [Bug c/84900] [9/10/11/12 Regression] cast of compound literal does not cause the code to become a non-lvalue pinskia at gcc dot gnu.org
  2022-01-21 13:51 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:38 ` rguenth at gcc dot gnu.org
  2022-06-28 10:34 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug c/84900] [10/11/12/13 Regression] cast of compound literal does not cause the code to become a non-lvalue
       [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-05-27  9:38 ` [Bug c/84900] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:34 ` jakub at gcc dot gnu.org
  2023-03-23  1:52 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c/84900] [10/11/12/13 Regression] cast of compound literal does not cause the code to become a non-lvalue
       [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-06-28 10:34 ` jakub at gcc dot gnu.org
@ 2023-03-23  1:52 ` pinskia at gcc dot gnu.org
  2023-03-23  1:55 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-23  1:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Caused by r0-92187-g2ec5deb5c3146c .

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

* [Bug c/84900] [10/11/12/13 Regression] cast of compound literal does not cause the code to become a non-lvalue
       [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2023-03-23  1:52 ` pinskia at gcc dot gnu.org
@ 2023-03-23  1:55 ` pinskia at gcc dot gnu.org
  2023-03-23 17:26 ` cvs-commit at gcc dot gnu.org
  2023-03-23 17:28 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-23  1:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Obvious one line fix:
```
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 02a24c5fe65..5b9982e3651 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -2646,6 +2646,7 @@ maybe_lvalue_p (const_tree x)
   case LABEL_DECL:
   case FUNCTION_DECL:
   case SSA_NAME:
+  case COMPOUND_LITERAL_EXPR:

   case COMPONENT_REF:
   case MEM_REF:

```
Basically when COMPOUND_LITERAL_EXPR was made a non-language specific tree, the
check inside maybe_lvalue_p dealing with language specific trees became ignored
and we just need to mark COMPOUND_LITERAL_EXPR as being a maybe_lvalue now.

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

* [Bug c/84900] [10/11/12/13 Regression] cast of compound literal does not cause the code to become a non-lvalue
       [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2023-03-23  1:55 ` pinskia at gcc dot gnu.org
@ 2023-03-23 17:26 ` cvs-commit at gcc dot gnu.org
  2023-03-23 17:28 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-23 17:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:80ed2a6471a39dd95192a334789fd63d5efd2e8a

commit r13-6836-g80ed2a6471a39dd95192a334789fd63d5efd2e8a
Author: Andrew Pinski <apinski@marvell.com>
Date:   Thu Mar 23 02:10:11 2023 +0000

    c: [PR84900] cast of compound literal does not cause the code to become a
non-lvalue

    The problem here is after r0-92187-g2ec5deb5c3146c, maybe_lvalue_p would
    return false for compound literals which causes non_lvalue_loc not
    to wrap the expression with a NON_LVALUE_EXPR unlike before when it
    return true as it returns true for all language specific tree codes.

    This fixes that oversight and fixes the testcase to have the cast as
    a non-lvalue.

    Committed to the trunk as obvious after a bootstrap/test on
x86_64-linux-gnu.

            PR c/84900

    gcc/ChangeLog:

            * fold-const.cc (maybe_lvalue_p): Treat COMPOUND_LITERAL_EXPR
            as a lvalue.

    gcc/testsuite/ChangeLog:

            * gcc.dg/compound-literal-cast-lvalue-1.c: New test.

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

* [Bug c/84900] [10/11/12/13 Regression] cast of compound literal does not cause the code to become a non-lvalue
       [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2023-03-23 17:26 ` cvs-commit at gcc dot gnu.org
@ 2023-03-23 17:28 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-23 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |13.0
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 13. This has been broken since GCC 4.5 almost 14 years ago and
since it is just an accepts invalid I am going to close it as fixed for GCC 13.

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

end of thread, other threads:[~2023-03-23 17:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-84900-4@http.gcc.gnu.org/bugzilla/>
2022-01-03 20:45 ` [Bug c/84900] [9/10/11/12 Regression] cast of compound literal does not cause the code to become a non-lvalue pinskia at gcc dot gnu.org
2022-01-21 13:51 ` rguenth at gcc dot gnu.org
2022-05-27  9:38 ` [Bug c/84900] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:34 ` jakub at gcc dot gnu.org
2023-03-23  1:52 ` pinskia at gcc dot gnu.org
2023-03-23  1:55 ` pinskia at gcc dot gnu.org
2023-03-23 17:26 ` cvs-commit at gcc dot gnu.org
2023-03-23 17:28 ` 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).