public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982
@ 2020-03-26 19:02 jakub at gcc dot gnu.org
  2020-03-26 19:03 ` [Bug c++/94346] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-26 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94346
           Summary: [9/10 Regression] ICE due to handle_copy_attribute
                    since r9-3982
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

#define ATTR(...) __attribute__ ((__VA_ARGS__))

typedef struct ATTR (packed) A { ATTR (packed) unsigned bf: 1; } A;
int bar (void);

struct C
{
  ATTR (copy ((bar (), ((struct A *)(0))[0]))) int m;
};

ICEs since r9-3982-g79a2c4281c7dcaa6a138d24fd037c62453a12bde (before that it
has been accepted with a warning).

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

* [Bug c++/94346] [9/10 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
@ 2020-03-26 19:03 ` jakub at gcc dot gnu.org
  2020-03-26 20:13 ` msebor at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-26 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-03-26
           Priority|P3                          |P2
                 CC|                            |msebor at gcc dot gnu.org
   Target Milestone|---                         |9.4

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Ran into this with PR94339 fix on attr-copy-2.C testcase, but as this adjusted
testcase shows, the issue has been there before.

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

* [Bug c++/94346] [9/10 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
  2020-03-26 19:03 ` [Bug c++/94346] " jakub at gcc dot gnu.org
@ 2020-03-26 20:13 ` msebor at gcc dot gnu.org
  2020-03-26 20:17 ` msebor at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-03-26 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
diag_attr_exclusions() expects either a DECL or a TYPE but here it gets an
expression:

$ gcc -S pr94346.c
pr94346.c:8:33: internal compiler error: tree check: expected class ‘type’,
have ‘expression’ (compound_expr) in diag_attr_exclusions, at attribs.c:396
    8 |   ATTR (copy ((bar (), ((struct A *)(0))[0]))) int m;
      |                                 ^
pr94346.c:1:35: note: in definition of macro ‘ATTR’
    1 | #define ATTR(...) __attribute__ ((__VA_ARGS__))
      |                                   ^~~~~~~~~~~
0x16c3530 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /src/gcc/trunk/gcc/tree.c:9745
0x8c8271 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        /src/gcc/trunk/gcc/tree.h:3401
0x8c1c5c diag_attr_exclusions
        /src/gcc/trunk/gcc/attribs.c:396
0x8c1b67 diag_attr_exclusions
        /src/gcc/trunk/gcc/attribs.c:379
0x8c2b75 decl_attributes(tree_node**, tree_node*, int, tree_node*)
        /src/gcc/trunk/gcc/attribs.c:694
0xa45e02 handle_copy_attribute
        /src/gcc/trunk/gcc/c-family/c-attribs.c:2628
0x8c2c55 decl_attributes(tree_node**, tree_node*, int, tree_node*)
        /src/gcc/trunk/gcc/attribs.c:713
0x95422d c_parser_struct_declaration
        /src/gcc/trunk/gcc/c/c-parser.c:3620
0x953a6b c_parser_struct_or_union_specifier
        /src/gcc/trunk/gcc/c/c-parser.c:3413
0x9528fb c_parser_declspecs(c_parser*, c_declspecs*, bool, bool, bool, bool,
bool, bool, bool, c_lookahead_kind)
        /src/gcc/trunk/gcc/c/c-parser.c:2962
0x95031f c_parser_declaration_or_fndef
        /src/gcc/trunk/gcc/c/c-parser.c:1960
0x94fe3c c_parser_external_declaration
        /src/gcc/trunk/gcc/c/c-parser.c:1745
0x94f95d c_parser_translation_unit
        /src/gcc/trunk/gcc/c/c-parser.c:1618
0x98da25 c_parse_file()
        /src/gcc/trunk/gcc/c/c-parser.c:21718
0xa19299 c_common_parse_file()
        /src/gcc/trunk/gcc/c-family/c-opts.c:1186
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c++/94346] [9/10 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
  2020-03-26 19:03 ` [Bug c++/94346] " jakub at gcc dot gnu.org
  2020-03-26 20:13 ` msebor at gcc dot gnu.org
@ 2020-03-26 20:17 ` msebor at gcc dot gnu.org
  2020-03-26 20:25 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-03-26 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
      Known to fail|                            |10.0, 9.2.0
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
The change below avoids the ICE with no regressions in the attribute or warning
tests:

diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 9abf81d0248..c1294de2f49 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -2625,7 +2625,7 @@ handle_copy_attribute (tree *node, tree name, tree args,

   /* Copy type attributes from REF to DECL.  */
   for (tree at = attrs; at; at = TREE_CHAIN (at))
-    decl_attributes (node, at, flags, ref);
+    decl_attributes (node, at, flags, DECL_P (ref) ? ref : NULL_TREE);

   return NULL_TREE;
 }

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

* [Bug c++/94346] [9/10 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-26 20:17 ` msebor at gcc dot gnu.org
@ 2020-03-26 20:25 ` jakub at gcc dot gnu.org
  2020-03-27  1:56 ` msebor at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-26 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The COMPOUND_EXPRs should be handled like their second operand by
handle_copy_attribute.

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

* [Bug c++/94346] [9/10 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-03-26 20:25 ` jakub at gcc dot gnu.org
@ 2020-03-27  1:56 ` msebor at gcc dot gnu.org
  2020-03-27 20:35 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-03-27  1:56 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542782.html

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

* [Bug c++/94346] [9/10 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-03-27  1:56 ` msebor at gcc dot gnu.org
@ 2020-03-27 20:35 ` cvs-commit at gcc dot gnu.org
  2020-03-27 20:42 ` [Bug c++/94346] [9 " msebor at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-27 20:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:52f24a9e989300506f812bacb8cc302a8bf03a06

commit r10-7428-g52f24a9e989300506f812bacb8cc302a8bf03a06
Author: Martin Sebor <msebor@redhat.com>
Date:   Fri Mar 27 14:24:03 2020 -0600

    PR c++/94346 - [9/10 Regression] ICE due to handle_copy_attribute since
r9-3982

    gcc/c-family/ChangeLog:

            PR c++/94346
            * c-attribs.c (handle_copy_attribute): Avoid passing expressions
            to decl_attributes.  Make handling of different kinds of entities
            more robust.

    gcc/c-c++-common/ChangeLog:

            PR c++/94346
            * c-c++-common/attr-copy.c: New test.

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

* [Bug c++/94346] [9 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-03-27 20:35 ` cvs-commit at gcc dot gnu.org
@ 2020-03-27 20:42 ` msebor at gcc dot gnu.org
  2021-06-01  8:17 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-03-27 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.0
            Summary|[9/10 Regression] ICE due   |[9 Regression] ICE due to
                   |to handle_copy_attribute    |handle_copy_attribute since
                   |since r9-3982               |r9-3982
      Known to fail|10.0                        |

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
The ICE is resolved for GCC 10.  The patch should be safe enough to backport to
GCC 9 after a few days.

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

* [Bug c++/94346] [9 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-03-27 20:42 ` [Bug c++/94346] [9 " msebor at gcc dot gnu.org
@ 2021-06-01  8:17 ` rguenth at gcc dot gnu.org
  2022-03-17 19:54 ` msebor at gcc dot gnu.org
  2022-05-27  8:49 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug c++/94346] [9 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-06-01  8:17 ` rguenth at gcc dot gnu.org
@ 2022-03-17 19:54 ` msebor at gcc dot gnu.org
  2022-05-27  8:49 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-03-17 19:54 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

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

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'm no longer planning to backport the fix.

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

* [Bug c++/94346] [9 Regression] ICE due to handle_copy_attribute since r9-3982
  2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2022-03-17 19:54 ` msebor at gcc dot gnu.org
@ 2022-05-27  8:49 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  8:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.0
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 10.

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

end of thread, other threads:[~2022-05-27  8:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 19:02 [Bug c++/94346] New: [9/10 Regression] ICE due to handle_copy_attribute since r9-3982 jakub at gcc dot gnu.org
2020-03-26 19:03 ` [Bug c++/94346] " jakub at gcc dot gnu.org
2020-03-26 20:13 ` msebor at gcc dot gnu.org
2020-03-26 20:17 ` msebor at gcc dot gnu.org
2020-03-26 20:25 ` jakub at gcc dot gnu.org
2020-03-27  1:56 ` msebor at gcc dot gnu.org
2020-03-27 20:35 ` cvs-commit at gcc dot gnu.org
2020-03-27 20:42 ` [Bug c++/94346] [9 " msebor at gcc dot gnu.org
2021-06-01  8:17 ` rguenth at gcc dot gnu.org
2022-03-17 19:54 ` msebor at gcc dot gnu.org
2022-05-27  8:49 ` rguenth 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).