public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104031] New: [12 regression] Global nested constructors generate invalid code.
@ 2022-01-14 14:51 slyfox at gcc dot gnu.org
  2022-01-14 14:56 ` [Bug c++/104031] [12 regression] Global nested constructors generate invalid code since r12-6329-g4f6bc28fc7dd86bd marxin at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-01-14 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104031
           Summary: [12 regression] Global nested constructors generate
                    invalid code.
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Extracted from original example of nix-2.4 where global constructors register
invalid primops. Single-file example:

// $ cat main.cc
#include <string>
#include <vector>

struct Info {
    std::vector<std::string> args;
    size_t arity = 0;
};

struct RegisterPrimOp
{
    RegisterPrimOp(Info && info) __attribute__((noipa, noinline)) {
        if (info.arity != 0)
            __builtin_trap();
    }
};

static RegisterPrimOp s_op({
    .args = {"path"},
    .arity = 0,
});

int main() {}

# ok:
$ g++-11.2.0 main.cc -o main -O2 && ./main
# bad:
$ g++-12.0.0 main.cc -o main -O2 && ./main
Illegal instruction (core dumped)

Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-12.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-12.0.0/libexec/gcc/x86_64-unknown-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20220109 (experimental) (GCC)

Must be a recent regression. Possibly a close sibling of diagnostic false
positive: https://gcc.gnu.org/PR103984

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

end of thread, other threads:[~2022-01-17 17:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 14:51 [Bug c++/104031] New: [12 regression] Global nested constructors generate invalid code slyfox at gcc dot gnu.org
2022-01-14 14:56 ` [Bug c++/104031] [12 regression] Global nested constructors generate invalid code since r12-6329-g4f6bc28fc7dd86bd marxin at gcc dot gnu.org
2022-01-14 18:14 ` pinskia at gcc dot gnu.org
2022-01-14 18:27 ` pinskia at gcc dot gnu.org
2022-01-14 22:27 ` slyfox at gcc dot gnu.org
2022-01-14 22:46 ` slyfox at gcc dot gnu.org
2022-01-14 23:23 ` slyfox at gcc dot gnu.org
2022-01-15 18:31 ` jakub at gcc dot gnu.org
2022-01-16 20:32 ` jakub at gcc dot gnu.org
2022-01-16 20:37 ` jakub at gcc dot gnu.org
2022-01-16 22:50 ` pinskia at gcc dot gnu.org
2022-01-17 17:11 ` cvs-commit at gcc dot gnu.org
2022-01-17 17:11 ` jakub at gcc dot gnu.org
2022-01-17 17:34 ` slyfox 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).