public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219
@ 2022-02-23 18:00 gscfq@t-online.de
  2022-02-23 19:44 ` [Bug c++/104669] " mpolacek at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gscfq@t-online.de @ 2022-02-23 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104669
           Summary: [11/12 Regression] ICE in is_function_default_version,
                    at attribs.cc:1219
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20210314 and 20210328 :


$ cat z1.cc
void bar()
{
  int foo();
  int foo() __attribute__((target("sse")));
  int foo() __attribute__((target("avx")));
  int (*p)() = &foo;
  return;
}


$ g++-12-20220220 -c z1.cc
z1.cc: In function 'void bar()':
z1.cc:3:10: warning: empty parentheses were disambiguated as a function
declaration [-Wvexing-parse]
    3 |   int foo();
      |          ^~
z1.cc:3:10: note: remove parentheses to default-initialize a variable
    3 |   int foo();
      |          ^~
      |          --
z1.cc:3:10: note: or replace parentheses with braces to value-initialize a
variable
z1.cc:4:10: warning: empty parentheses were disambiguated as a function
declaration [-Wvexing-parse]
    4 |   int foo() __attribute__((target("sse")));
      |          ^~
z1.cc:4:10: note: remove parentheses to default-initialize a variable
    4 |   int foo() __attribute__((target("sse")));
      |          ^~
      |          --
z1.cc:4:10: note: or replace parentheses with braces to value-initialize a
variable
z1.cc:5:10: warning: empty parentheses were disambiguated as a function
declaration [-Wvexing-parse]
    5 |   int foo() __attribute__((target("avx")));
      |          ^~
z1.cc:5:10: note: remove parentheses to default-initialize a variable
    5 |   int foo() __attribute__((target("avx")));
      |          ^~
      |          --
z1.cc:5:10: note: or replace parentheses with braces to value-initialize a
variable
z1.cc:6:17: internal compiler error: in is_function_default_version, at
attribs.cc:1219
    6 |   int (*p)() = &foo;
      |                 ^~~
0x89edb3 is_function_default_version(tree_node*)
        ../../gcc/attribs.cc:1219
0x115c284 ix86_get_function_versions_dispatcher(void*)
        ../../gcc/config/i386/i386-features.cc:2770
0x6ce48b get_function_version_dispatcher(tree_node*)
        ../../gcc/cp/call.cc:8836
0x6e7057 resolve_address_of_overloaded_function
        ../../gcc/cp/class.cc:8607
0x6cfa8d standard_conversion
        ../../gcc/cp/call.cc:1227
0x6d1d4d implicit_conversion_1
        ../../gcc/cp/call.cc:2031
0x6d1d4d implicit_conversion
        ../../gcc/cp/call.cc:2132
0x6d6b9c can_convert_arg_bad(tree_node*, tree_node*, tree_node*, int, int)
        ../../gcc/cp/call.cc:12625
0x893291 convert_for_assignment
        ../../gcc/cp/typeck.cc:9831
0x893acb convert_for_initialization(tree_node*, tree_node*, tree_node*, int,
impl_conv_rhs, tree_node*, int, int)
        ../../gcc/cp/typeck.cc:10062
0x899ffd digest_init_r
        ../../gcc/cp/typeck2.cc:1357
0x89b7e0 digest_init_flags(tree_node*, tree_node*, int, int)
        ../../gcc/cp/typeck2.cc:1370
0x89b7e0 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/cp/typeck2.cc:842
0x74ad20 check_initializer
        ../../gcc/cp/decl.cc:7279
0x74c201 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/cp/decl.cc:8247
0x80ecdf cp_parser_init_declarator
        ../../gcc/cp/parser.cc:22823
0x7ecec2 cp_parser_simple_declaration
        ../../gcc/cp/parser.cc:15286
0x7ee769 cp_parser_declaration_statement
        ../../gcc/cp/parser.cc:14367
0x7eed6b cp_parser_statement
        ../../gcc/cp/parser.cc:12452
0x7efcb4 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.cc:12856

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

* [Bug c++/104669] [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
@ 2022-02-23 19:44 ` mpolacek at gcc dot gnu.org
  2022-02-23 22:03 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-02-23 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
   Target Milestone|---                         |11.3
   Last reconfirmed|                            |2022-02-23
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r11-7693.

commit 1c7bec8bfbc5457c1b57d0e3b67f5d6bc8812e57
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Mar 3 09:38:55 2021 +0100

    c++: support target attr for DECL_LOCAL_DECL_P fns [PR99108]

    We crash when target attribute get_function_versions_dispatcher is called
    for a function that is not registered in call graph.  This was happening
    because we were calling it for the function-local decls that aren't in the
    symbol table, instead of the corresponding namespace-scope decls that are.

    gcc/cp/ChangeLog:

            PR c++/99108
            * call.c (get_function_version_dispatcher): Handle
            DECL_LOCAL_DECL_P.
            * decl.c (maybe_version_functions): Likewise.
            (maybe_mark_function_versioned): New.
            * name-lookup.c (push_local_extern_decl_alias): No longer static.
            * name-lookup.h (push_local_extern_decl_alias): Adjust.

    gcc/testsuite/ChangeLog:

            PR c++/99108
            * g++.target/i386/pr99108.C: New test.

    Co-authored-by: Jason Merrill <jason@redhat.com>

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

* [Bug c++/104669] [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
  2022-02-23 19:44 ` [Bug c++/104669] " mpolacek at gcc dot gnu.org
@ 2022-02-23 22:03 ` pinskia at gcc dot gnu.org
  2022-03-03 11:47 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-23 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note here is the valid C++ code:
void bar()
{
  int foo(void);
  int foo(void) __attribute__((target("sse")));
  int foo(void) __attribute__((target("default")));
  int (*p)(void) = &foo;
  return;
}

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

* [Bug c++/104669] [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
  2022-02-23 19:44 ` [Bug c++/104669] " mpolacek at gcc dot gnu.org
  2022-02-23 22:03 ` pinskia at gcc dot gnu.org
@ 2022-03-03 11:47 ` jakub at gcc dot gnu.org
  2022-03-09 12:59 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-03 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
These push_local_extern_decl_alias created aliases are an endless source of
problems :(.
What happens is we create foo as a FUNCTION_DECL local to the function, then
push_local_extern_decl_alias creates another FUNCTION_DECL for it.
Then duplicate_decls is called on the local decl and another new local decl,
during that duplicate_decls e.g. DECL_ATTRIBUTES and other flags on the local
FUNCTION_DECL are tweaked, but doesn't update DECL_ATTRIBUTES etc. on the
extern alias.
The only spot in duplicate_decls that deals with this is:
  if (VAR_OR_FUNCTION_DECL_P (newdecl) && DECL_LOCAL_DECL_P (newdecl))
    {
      if (!DECL_LOCAL_DECL_P (olddecl))
        /* This can happen if olddecl was brought in from the
           enclosing namespace via a using-decl.  The new decl is
           then not a block-scope extern at all.  */
        DECL_LOCAL_DECL_P (newdecl) = false;
      else
        {
          retrofit_lang_decl (newdecl);
          DECL_LOCAL_DECL_ALIAS (newdecl) = DECL_LOCAL_DECL_ALIAS (olddecl);
        }
    }
So, how do we synchronize changes from the local FUNCTION_DECL to
DECL_LOCAL_DECL_ALIAS when they are made?

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

* [Bug c++/104669] [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-03-03 11:47 ` jakub at gcc dot gnu.org
@ 2022-03-09 12:59 ` rguenth at gcc dot gnu.org
  2022-04-12 14:35 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-09 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/104669] [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-03-09 12:59 ` rguenth at gcc dot gnu.org
@ 2022-04-12 14:35 ` jason at gcc dot gnu.org
  2022-04-12 21:09 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-12 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

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] 11+ messages in thread

* [Bug c++/104669] [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-04-12 14:35 ` jason at gcc dot gnu.org
@ 2022-04-12 21:09 ` cvs-commit at gcc dot gnu.org
  2022-04-21  7:51 ` [Bug c++/104669] [11 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-12 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:791a968630b3846b614a435b9a75a52f29147a08

commit r12-8115-g791a968630b3846b614a435b9a75a52f29147a08
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 12 16:40:14 2022 -0400

    c++: local function versioning [PR104669]

    There were two problems with this testcase: we weren't copying the target
    attribute from the second declaration to the global alias for the first
    one (duplicate_decls hunk), and then we were treating the third one as
    matching the earlier one even though both are versioned (decls_match hunk).
    The latter change required a fix to find_last_decl (used for attribute
    mismatch warnings) to give up if we see a versioned function, as in that
    case we can't determine whether the decls match, because we are still in
the
    process of setting the attributes on the new decl.

            PR c++/104669

    gcc/cp/ChangeLog:

            * decl.cc (decls_match): Compare versions even if not recording.
            (duplicate_decls): Propagate attributes to alias.
            * decl2.cc (find_last_decl): Give up if versioned.

    gcc/testsuite/ChangeLog:

            * g++.target/i386/mv31.C: New test.

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

* [Bug c++/104669] [11 Regression] ICE in is_function_default_version,  at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2022-04-12 21:09 ` cvs-commit at gcc dot gnu.org
@ 2022-04-21  7:51 ` rguenth at gcc dot gnu.org
  2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |11.4

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

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

* [Bug c++/104669] [11 Regression] ICE in is_function_default_version,  at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2022-04-21  7:51 ` [Bug c++/104669] [11 " rguenth at gcc dot gnu.org
@ 2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org
  2022-05-12 20:22 ` jason at gcc dot gnu.org
  2024-03-11  5:17 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-12 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:0c45820ead85b8bc6f8283f7692a85d0c12ded4f

commit r11-9983-g0c45820ead85b8bc6f8283f7692a85d0c12ded4f
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 12 16:40:14 2022 -0400

    c++: local function versioning [PR104669]

    There were two problems with this testcase: we weren't copying the target
    attribute from the second declaration to the global alias for the first
    one (duplicate_decls hunk), and then we were treating the third one as
    matching the earlier one even though both are versioned (decls_match hunk).
    The latter change required a fix to find_last_decl (used for attribute
    mismatch warnings) to give up if we see a versioned function, as in that
    case we can't determine whether the decls match, because we are still in
the
    process of setting the attributes on the new decl.

            PR c++/104669

    gcc/cp/ChangeLog:

            * decl.c (decls_match): Compare versions even if not recording.
            (duplicate_decls): Propagate attributes to alias.
            * decl2.c (find_last_decl): Give up if versioned.

    gcc/testsuite/ChangeLog:

            * g++.target/i386/mv31.C: New test.

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

* [Bug c++/104669] [11 Regression] ICE in is_function_default_version,  at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org
@ 2022-05-12 20:22 ` jason at gcc dot gnu.org
  2024-03-11  5:17 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-12 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug c++/104669] [11 Regression] ICE in is_function_default_version, at attribs.cc:1219
  2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2022-05-12 20:22 ` jason at gcc dot gnu.org
@ 2024-03-11  5:17 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-11  5:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 100643 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2024-03-11  5:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 18:00 [Bug c++/104669] New: [11/12 Regression] ICE in is_function_default_version, at attribs.cc:1219 gscfq@t-online.de
2022-02-23 19:44 ` [Bug c++/104669] " mpolacek at gcc dot gnu.org
2022-02-23 22:03 ` pinskia at gcc dot gnu.org
2022-03-03 11:47 ` jakub at gcc dot gnu.org
2022-03-09 12:59 ` rguenth at gcc dot gnu.org
2022-04-12 14:35 ` jason at gcc dot gnu.org
2022-04-12 21:09 ` cvs-commit at gcc dot gnu.org
2022-04-21  7:51 ` [Bug c++/104669] [11 " rguenth at gcc dot gnu.org
2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org
2022-05-12 20:22 ` jason at gcc dot gnu.org
2024-03-11  5:17 ` 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).