public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
@ 2022-09-24  0:05 bthomas at brave dot com
  2022-09-26 11:44 ` [Bug c++/107023] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bthomas at brave dot com @ 2022-09-24  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107023
           Summary: [[gnu::stdcall]] Crashes the compiler, but
                    __attribute__((stdcall)) and __stdcall worrks
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bthomas at brave dot com
  Target Milestone: ---

```
#include <iostream>

template<typename T>
void call(T&& fn)
{    
    std::cout<<typeid(decltype(fn)).name()<<"\n";
}

[[gnu::stdcall]] bool test(void* eios) noexcept
{    
    return false;
}

int main() {
    call(test);
    return 0;
}
```

Example: https://godbolt.org/z/jhdqWbaT3

---

Will give the error with O3 (12.2, Flags: -O3 -std=c++20 -m32):

g++: internal compiler error: Segmentation fault signal terminated program
cc1plus
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 4
g++: internal compiler error: Segmentation fault signal terminated program
cc1plus
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Execution build compiler returned: 4

---

Will give the error with O2 (12.2, Flags: -O2 -std=c++20 -m32):
g++: internal compiler error: Segmentation fault signal terminated program
cc1plus
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 4

cc1plus: out of memory allocating 18446744072522246992 bytes after a total of
2228224 bytes
Execution build compiler returned: 1

---

Will give the error with ANY flags (13.0 - Trunk, Flags: -O2 -std=c++20 -m32):

'
'
internal compiler error: error reporting routines re-entered.
0x2349dde internal_error(char const*, ...)
        ???:0
0x955fbc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0x2368dec pp_format(pretty_printer*, text_info*)
        ???:0
0x236a1d5 pp_printf(pretty_printer*, char const*, ...)
        ???:0
0x2348785 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ???:0
0x2349dde internal_error(char const*, ...)
        ???:0
0x955fbc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0x2368dec pp_format(pretty_printer*, text_info*)
        ???:0
0x236a1d5 pp_printf(pretty_printer*, char const*, ...)
        ???:0
0x2348785 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ???:0
0x2349dde internal_error(char const*, ...)
        ???:0
0x955fbc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xb992f8 lang_decl_name(tree_node*, int, bool)
        ???:0
0xb99346 lang_decl_dwarf_name(tree_node*, int, bool)
        ???:0
0xd8ab37 c_common_finalize_early_debug()
        ???:0
0xe78236 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 1
'
'
internal compiler error: error reporting routines re-entered.
0x2349dde internal_error(char const*, ...)
        ???:0
0x955fbc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0x2368dec pp_format(pretty_printer*, text_info*)
        ???:0
0x236a1d5 pp_printf(pretty_printer*, char const*, ...)
        ???:0
0x2348785 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ???:0
0x2349dde internal_error(char const*, ...)
        ???:0
0x955fbc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0x2368dec pp_format(pretty_printer*, text_info*)
        ???:0
0x236a1d5 pp_printf(pretty_printer*, char const*, ...)
        ???:0
0x2348785 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ???:0
0x2349dde internal_error(char const*, ...)
        ???:0
0x955fbc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xb992f8 lang_decl_name(tree_node*, int, bool)
        ???:0
0xb99346 lang_decl_dwarf_name(tree_node*, int, bool)
        ???:0
0xd8ab37 c_common_finalize_early_debug()
        ???:0
0xe78236 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Execution build compiler returned: 1

----

It's worth noting that `__attribute__((stdcall))` and `__stdcall` works just
fine.

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

* [Bug c++/107023] [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
  2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
@ 2022-09-26 11:44 ` marxin at gcc dot gnu.org
  2022-09-26 12:42 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-26 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Can't reproduce ..

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

* [Bug c++/107023] [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
  2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
  2022-09-26 11:44 ` [Bug c++/107023] " marxin at gcc dot gnu.org
@ 2022-09-26 12:42 ` redi at gcc dot gnu.org
  2022-09-26 12:45 ` [Bug c++/107023] [10/11/12/13 Regression] " redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-26 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-09-26
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reproduces for me with -m32 -g

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

* [Bug c++/107023] [10/11/12/13 Regression] [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
  2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
  2022-09-26 11:44 ` [Bug c++/107023] " marxin at gcc dot gnu.org
  2022-09-26 12:42 ` redi at gcc dot gnu.org
@ 2022-09-26 12:45 ` redi at gcc dot gnu.org
  2022-09-26 12:47 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-26 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.1.0, 10.4.1, 11.1.0,
                   |                            |11.3.1, 12.1.0, 12.2.1,
                   |                            |13.0
      Known to work|                            |9.5.0
            Summary|[[gnu::stdcall]] Crashes    |[10/11/12/13 Regression]
                   |the compiler, but           |[[gnu::stdcall]] Crashes
                   |__attribute__((stdcall))    |the compiler, but
                   |and __stdcall worrks        |__attribute__((stdcall))
                   |                            |and __stdcall worrks

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC 10/11/12 say:

cc1plus: out of memory allocating 18446744073537494608 bytes after a total of
3219456 bytes

GCC 9 is OK. Bisecting now...

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

* [Bug c++/107023] [10/11/12/13 Regression] [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
  2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
                   ` (2 preceding siblings ...)
  2022-09-26 12:45 ` [Bug c++/107023] [10/11/12/13 Regression] " redi at gcc dot gnu.org
@ 2022-09-26 12:47 ` redi at gcc dot gnu.org
  2022-09-26 14:57 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-26 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Started with r10-1214-g1bf32c1141e230

    PR c++/60364 - noreturn after first decl not diagnosed.

            * attribs.c (get_attribute_namespace): No longer static.
            (decl_attributes): Avoid shadowing.  Preserve the C++11 form for
C++11
            attributes.
            (attr_noreturn_exclusions): Make it extern.
            * attribs.h (get_attribute_namespace): Declare.
            * tree-inline.c (function_attribute_inlinable_p): Use
            get_attribute_name.

            * c-attribs.c (handle_noreturn_attribute): No longer static.
            * c-common.h (handle_noreturn_attribute, attr_noreturn_exclusions):
            Declare.
            * c-format.c (check_function_format): Use get_attribute_name.

            * decl.c (duplicate_decls): Give an error when a function is
            declared [[noreturn]] after its first declaration.
            * parser.c (cp_parser_std_attribute): Don't treat C++11 noreturn
            attribute as equivalent to GNU's.
            * tree.c (std_attribute_table): Add noreturn.

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

* [Bug c++/107023] [10/11/12/13 Regression] [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
  2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
                   ` (3 preceding siblings ...)
  2022-09-26 12:47 ` redi at gcc dot gnu.org
@ 2022-09-26 14:57 ` mpolacek at gcc dot gnu.org
  2022-09-26 14:57 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-09-26 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Mine then.

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

* [Bug c++/107023] [10/11/12/13 Regression] [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
  2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
                   ` (4 preceding siblings ...)
  2022-09-26 14:57 ` mpolacek at gcc dot gnu.org
@ 2022-09-26 14:57 ` mpolacek at gcc dot gnu.org
  2022-12-02 16:13 ` jakub at gcc dot gnu.org
  2023-03-07 16:33 ` [Bug c++/107023] [10/11/12 " mpolacek at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-09-26 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
   Target Milestone|---                         |10.5

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

* [Bug c++/107023] [10/11/12/13 Regression] [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
  2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
                   ` (5 preceding siblings ...)
  2022-09-26 14:57 ` mpolacek at gcc dot gnu.org
@ 2022-12-02 16:13 ` jakub at gcc dot gnu.org
  2023-03-07 16:33 ` [Bug c++/107023] [10/11/12 " mpolacek at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-02 16:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The ICE part with additional -g is fixed on the trunk with PR106937
r13-3202-g67efffec9436 fix.
Even just:
--- gcc/c-family/c-pretty-print.cc
+++ gcc/c-family/c-pretty-print.cc
@@ -901,7 +901,7 @@ pp_c_attributes_display (c_pretty_printer *pp, tree a)
        {
          pp_separate_with (pp, ',');
        }
-      pp_tree_identifier (pp, TREE_PURPOSE (a));
+      pp_tree_identifier (pp, get_attribute_name (a));
       if (TREE_VALUE (a))
        pp_c_call_argument_list (pp, TREE_VALUE (a));
     }
would prevent the ICE.
I can't reproduce any
cc1plus: out of memory allocating 18446744073537494608 bytes after a total of
3219456 bytes
nor any issue without -g though.

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

* [Bug c++/107023] [10/11/12 Regression] [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
  2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
                   ` (6 preceding siblings ...)
  2022-12-02 16:13 ` jakub at gcc dot gnu.org
@ 2023-03-07 16:33 ` mpolacek at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-03-07 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I cannot reproduce the OOM issue at all.  Assuming fixed then...

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

end of thread, other threads:[~2023-03-07 16:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-24  0:05 [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks bthomas at brave dot com
2022-09-26 11:44 ` [Bug c++/107023] " marxin at gcc dot gnu.org
2022-09-26 12:42 ` redi at gcc dot gnu.org
2022-09-26 12:45 ` [Bug c++/107023] [10/11/12/13 Regression] " redi at gcc dot gnu.org
2022-09-26 12:47 ` redi at gcc dot gnu.org
2022-09-26 14:57 ` mpolacek at gcc dot gnu.org
2022-09-26 14:57 ` mpolacek at gcc dot gnu.org
2022-12-02 16:13 ` jakub at gcc dot gnu.org
2023-03-07 16:33 ` [Bug c++/107023] [10/11/12 " mpolacek 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).