public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bthomas at brave dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/107023] New: [[gnu::stdcall]] Crashes the compiler, but __attribute__((stdcall)) and __stdcall worrks
Date: Sat, 24 Sep 2022 00:05:04 +0000	[thread overview]
Message-ID: <bug-107023-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2022-09-24  0:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-24  0:05 bthomas at brave dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107023-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).