public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tsqurt at outlook dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug compile/31508] compile not working for some programs
Date: Sun, 24 Mar 2024 11:07:01 +0000	[thread overview]
Message-ID: <bug-31508-4717-Y7QjSyEsbk@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31508-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31508

--- Comment #1 from Tan Senqi <tsqurt at outlook dot com> ---
A new test case to be added, which triggers a segmentation fault:

void break_point() {}
void foo(int n)
{
  struct S {
    int i[n];
    unsigned int b:1;
    int i2;
  } __attribute__ ((packed)) __attribute__ ((aligned (4)));

  struct S s;


break_point();; // break here and run; then command `expr s.i2 = 0`
}

int main(void)
{
  foo(4);

  return 0;
}



(gdb) expr s.i2=0
/tmp/gdbobj-FjNhCp/out1.c:50:43: error: redeclaration of ‘__gdb_prop_0x17c22c0’
with no linkage
   50 |   __attribute__ ((unused)) unsigned long  __gdb_prop_0x17c22c0;
      |                                           ^~~~~~~~~~~~~~~~~~~~
/tmp/gdbobj-FjNhCp/out1.c:30:43: note: previous declaration of
‘__gdb_prop_0x17c22c0’ with type ‘long unsigned int’
   30 |   __attribute__ ((unused)) unsigned long  __gdb_prop_0x17c22c0;
      |                                           ^~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/gdbtypes.h:627: internal-error: loc_bitpos: Assertion
`m_loc_kind == FIELD_LOC_KIND_BITPOS' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x4e81b2 gdb_internal_backtrace_1
        ../../binutils-gdb/gdb/bt-utils.c:122
0x4e81b2 _Z22gdb_internal_backtracev
        ../../binutils-gdb/gdb/bt-utils.c:168
0x8adea4 internal_vproblem
        ../../binutils-gdb/gdb/utils.c:421
0x8ae208 _Z15internal_verrorPKciS0_P13__va_list_tag
        ../../binutils-gdb/gdb/utils.c:501
0x9f9e31 _Z18internal_error_locPKciS0_z
        ../../binutils-gdb/gdbsupport/errors.cc:58
0x5324f8 _ZNK5field10loc_bitposEv
        ../../binutils-gdb/gdb/gdbtypes.h:627
0x5324f8 _ZNK5field10loc_bitposEv
        ../../binutils-gdb/gdb/gdbtypes.h:625
0x5324f8 convert_struct_or_union
        ../../binutils-gdb/gdb/compile/compile-c-types.c:118
0x5324f8 convert_type_basic
        ../../binutils-gdb/gdb/compile/compile-c-types.c:297
0x5324f8 _ZN18compile_c_instance12convert_typeEP4type
        ../../binutils-gdb/gdb/compile/compile-c-types.c:357
0x53138b convert_one_symbol
        ../../binutils-gdb/gdb/compile/compile-c-symbols.c:68
0x531a0d convert_symbol_sym
        ../../binutils-gdb/gdb/compile/compile-c-symbols.c:256
0x531a0d _Z18gcc_convert_symbolPvP13gcc_c_context20gcc_c_oracle_requestPKc
        ../../binutils-gdb/gdb/compile/compile-c-symbols.c:355
0x7f8fdcd399e7 c_call_binding_oracle
        ../../gcc/libcc1/libcc1.cc:79
0x7f8fdcd399e7 call<2, (anonymous namespace)::c_call_binding_oracle,
gcc_c_oracle_request, char const*>
        ../../gcc/libcc1/libcc1.cc:148
0x7f8fdcd399e7 call<1, (anonymous namespace)::c_call_binding_oracle,
gcc_c_oracle_request>
        ../../gcc/libcc1/rpc.hh:162
0x7f8fdcd399e7 call<0, (anonymous namespace)::c_call_binding_oracle>
        ../../gcc/libcc1/rpc.hh:162
0x7f8fdcd399e7 invoke<(anonymous namespace)::c_call_binding_oracle>
        ../../gcc/libcc1/rpc.hh:181
0x7f8fdcd43071 _ZN10cc1_plugin10connection7do_waitEb
        ../../gcc/libcc1/connection.cc:135
0x7f8fdcd3c70b _ZN10cc1_plugin10connection14wait_for_queryEv
        ../../gcc/libcc1/connection.hh:82
0x7f8fdcd3c70b
_ZN10cc1_plugin15base_gdb_pluginI13gcc_c_contextE9fork_execEPPcPiS5_
        ../../gcc/libcc1/gdbctx.hh:248
0x7f8fdcd3c70b
_ZN10cc1_plugin15base_gdb_pluginI13gcc_c_contextE10do_compileEP16gcc_base_contextPKc
        ../../gcc/libcc1/gdbctx.hh:315
0x541823 _ZN16compile_instance7compileEPKci
        ../../binutils-gdb/gdb/compile/compile.c:942
0x542333 compile_to_object
        ../../binutils-gdb/gdb/compile/compile.c:788
0x542333 _Z20eval_compile_commandP12command_linePKc21compile_i_scope_typesPv
        ../../binutils-gdb/gdb/compile/compile.c:817
0x5433bb compile_code_command
        ../../binutils-gdb/gdb/compile/compile.c:356
0x51b6f4 _Z8cmd_funcP16cmd_list_elementPKci
        ../../binutils-gdb/gdb/cli/cli-decode.c:2742
0x8438b6 _Z15execute_commandPKci
        ../../binutils-gdb/gdb/top.c:571
0x5f2f7f _Z15command_handlerPKc
        ../../binutils-gdb/gdb/event-top.c:567
0x5f450a _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE
        ../../binutils-gdb/gdb/event-top.c:803
0x5f378c gdb_rl_callback_handler
        ../../binutils-gdb/gdb/event-top.c:259
0x8f42a4 rl_callback_read_char
        ../../../binutils-gdb/readline/readline/callback.c:290
0x5f38ad gdb_rl_callback_read_char_wrapper_noexcept
        ../../binutils-gdb/gdb/event-top.c:195
0x5f3a2c gdb_rl_callback_read_char_wrapper
        ../../binutils-gdb/gdb/event-top.c:234
0x87e47f stdin_event_handler
        ../../binutils-gdb/gdb/ui.c:155
0x9faa45 gdb_wait_for_event
        ../../binutils-gdb/gdbsupport/event-loop.cc:716
0x9fb221 _Z16gdb_do_one_eventi
        ../../binutils-gdb/gdbsupport/event-loop.cc:264
0x6bcee9 start_event_loop
        ../../binutils-gdb/gdb/main.c:401
0x6bcee9 captured_command_loop
        ../../binutils-gdb/gdb/main.c:465
0x6bfa14 captured_main
        ../../binutils-gdb/gdb/main.c:1339
0x6bfa14 _Z8gdb_mainP18captured_main_args
        ../../binutils-gdb/gdb/main.c:1358
0x444d54 main
        ../../binutils-gdb/gdb/gdb.c:39
---------------------
../../binutils-gdb/gdb/gdbtypes.h:627: internal-error: loc_bitpos: Assertion
`m_loc_kind == FIELD_LOC_KIND_BITPOS' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)  y
Please answer y or n.
../../binutils-gdb/gdb/gdbtypes.h:627: internal-error: loc_bitpos: Assertion
`m_loc_kind == FIELD_LOC_KIND_BITPOS' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

This is a bug, please report it.  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2024-03-24 11:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  7:35 [Bug compile/31508] New: " tsqurt at outlook dot com
2024-03-24 11:07 ` tsqurt at outlook dot com [this message]
2024-03-24 17:20 ` [Bug compile/31508] " tromey at sourceware dot 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-31508-4717-Y7QjSyEsbk@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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).