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

            Bug ID: 117466
           Summary: brk #1000 rsp. ud2
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hans.buchmann.wantuch at gmail dot com
  Target Milestone: ---

Created attachment 59546
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59546&action=edit
The code, the assembler outputs and the compiler versions

The code 'brk-1000.cc'

------8<------8<------8<------8<------
struct R
{
 static const unsigned N=1;
 unsigned v[N];
 R(const unsigned in[])
 {
  for(unsigned i=0;auto& d:v)d=in[i++];
 }
};

struct Card
{
 R rca={0};
};

Card card;
------8<------8<------8<------8<------

compiled with:

CC=aarch64-linux-gnu-g++
${CC} -O2 -freport-bug -std=c++2a -Wall -Wextra \
-S -o brk-1000.s brk-1000.cc

results in the assembler output:

_GLOBAL__sub_I_card:
.LFB7:
        .cfi_startproc
        mov     x0, 0
        ldr     w0, [x0]
        brk #1000   //<---------------- why
        .cfi_endproc

compiling the same code with g++ 

_GLOBAL__sub_I_card:
.LFB7:
        .cfi_startproc
        movl    0, %eax
        ud2       //<---------------- why
        .cfi_endproc


Sincerely

Hans Buchmann
  • [Bug c++/117466] New: ... hans.buchmann.wantuch at gmail dot com via Gcc-bugs

Reply via email to