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

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).