public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31532] New: gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed.
@ 2024-03-22 15:30 dmitry.neverov at jetbrains dot com
  2024-03-22 15:49 ` [Bug gdb/31532] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dmitry.neverov at jetbrains dot com @ 2024-03-22 15:30 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 31532
           Summary: gdb/gmp-utils.c:169: internal-error: export_bits:
                    Assertion `word_countp == 1' failed.
           Product: gdb
           Version: 14.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: dmitry.neverov at jetbrains dot com
  Target Milestone: ---

Got this error on several linux machines, but the same gdb build works fine on
other machines. 

What could be a reason for this assertion?

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

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

* [Bug gdb/31532] gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed.
  2024-03-22 15:30 [Bug gdb/31532] New: gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed dmitry.neverov at jetbrains dot com
@ 2024-03-22 15:49 ` vries at gcc dot gnu.org
  2024-03-22 16:14 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-22 15:49 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
https://youtrack.jetbrains.com/issue/CPP-38097

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

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

* [Bug gdb/31532] gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed.
  2024-03-22 15:30 [Bug gdb/31532] New: gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed dmitry.neverov at jetbrains dot com
  2024-03-22 15:49 ` [Bug gdb/31532] " vries at gcc dot gnu.org
@ 2024-03-22 16:14 ` tromey at sourceware dot org
  2024-03-22 19:31 ` dmitry.neverov at jetbrains dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2024-03-22 16:14 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
This assert is a "shouldn't happen".
So, it might be a bug elsewhere in that function,
or it could be that your GMP is built in some
unusual way.

The function tries to export an MPZ value to a byte array.
It tries to be careful to ensure the value will actually
fit into the array.  This checking is expected to rule
out the case where more space is needed than what has
been provided.

The case where the result is 0 (and so word_countp==0)
is also handled explicitly by

  /* It's possible that one of the above results in zero, which has to
     be handled specially.  */
  if (exported_val->sgn () == 0)
    {
      memset (buf.data (), 0, buf.size ());
      return;
    }

Since I don't know how to reproduce this, best would be
if you could debug gdb and stop on the failure.  Then we
can see the actual value of word_countp, the other arguments,
and perhaps even the input data -- that would let us even
write a small reproducer invoking just mpz_export so we could
see if some assumption about GMP is wrong.

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

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

* [Bug gdb/31532] gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed.
  2024-03-22 15:30 [Bug gdb/31532] New: gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed dmitry.neverov at jetbrains dot com
  2024-03-22 15:49 ` [Bug gdb/31532] " vries at gcc dot gnu.org
  2024-03-22 16:14 ` tromey at sourceware dot org
@ 2024-03-22 19:31 ` dmitry.neverov at jetbrains dot com
  2024-03-23 15:47 ` dmitry.neverov at jetbrains dot com
  2024-03-23 18:49 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: dmitry.neverov at jetbrains dot com @ 2024-03-22 19:31 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Dmitry Neverov <dmitry.neverov at jetbrains dot com> ---
So far I cannot reproduce it in debug build on the same machine.

If I understand disasm correctly, word_countp is 2:

(gdb) bt
#0  0x00007f33cb0bdbbf in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x000000000109c43f in ?? ()
#2  0x000000000109ccbe in gdb_do_one_event(int) ()
#3  0x0000000000b59734 in gdb_readline_wrapper(char const*) ()
#4  0x0000000000b78898 in ?? ()
#5  0x0000000000b78c5b in query(char const*, ...) ()
#6  0x0000000000b7af25 in ?? ()
#7  0x0000000000b7b139 in internal_verror(char const*, int, char const*,
__va_list_tag*) ()
#8  0x000000000109babf in internal_error_loc(char const*, int, char const*,
...) ()
#9  0x00000000008321fb in gdb_mpz::export_bits(gdb::array_view<unsigned char>,
int, bool, bool) const ()
#10 0x0000000000b9633e in value_from_mpz(type*, gdb_mpz const&) ()
#11 0x00000000007e215e in expression::evaluate(type*, noside) ()
#12 0x00000000007e2353 in parse_and_eval_long(char const*) ()
#13 0x000000000070e871 in parse_cli_var_integer(var_types, literal_def const*,
char const**, bool) ()
#14 0x000000000070fae3 in do_set_command(char const*, int, cmd_list_element*)
()
#15 0x0000000000b5bbb4 in execute_command(char const*, int) ()
#16 0x00000000007e941d in command_handler(char const*) ()
#17 0x00000000007ea4dd in command_line_handler(std::unique_ptr<char,
gdb::xfree_deleter<char> >&&) ()
#18 0x00000000007e9dcd in ?? ()
#19 0x0000000000bd7d08 in rl_callback_read_char ()
#20 0x00000000007e8fae in ?? ()
#21 0x00000000007e9c8e in ?? ()
#22 0x0000000000b753e0 in ?? ()
#23 0x000000000109c4d6 in ?? ()
#24 0x000000000109ccbe in gdb_do_one_event(int) ()
#25 0x00000000008f8c9a in ?? ()
#26 0x00000000008fad95 in gdb_main(captured_main_args*) ()
#27 0x00000000005b8c75 in main ()

(gdb) frame 9

(gdb) info frame
Stack level 9, frame at 0x7ffe0d0c01b0:
 rip = 0x8321fb in gdb_mpz::export_bits(gdb::array_view<unsigned char>, int,
bool, bool) const; saved rip = 0xb9633e
 called by frame at 0x7ffe0d0c0200, caller of frame at 0x7ffe0d0c00e0
 Arglist at 0x7ffe0d0c01a0, args:
 Locals at 0x7ffe0d0c01a0, Previous frame's sp is 0x7ffe0d0c01b0
 Saved registers:
  rbx at 0x7ffe0d0c0178, rbp at 0x7ffe0d0c01a0, r12 at 0x7ffe0d0c0180, r13 at
0x7ffe0d0c0188, r14 at 0x7ffe0d0c0190, r15 at 0x7ffe0d0c0198, rip at
0x7ffe0d0c01a8

(gdb) disas
Dump of assembler code for function
_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb:
   0x0000000000831d20 <+0>:     push   rbp
   0x0000000000831d21 <+1>:     mov    rbp,rsp
   0x0000000000831d24 <+4>:     push   r15
   0x0000000000831d26 <+6>:     push   r14
   0x0000000000831d28 <+8>:     push   r13
   0x0000000000831d2a <+10>:    push   r12
   0x0000000000831d2c <+12>:    mov    r12,rdx
   0x0000000000831d2f <+15>:    push   rbx
   0x0000000000831d30 <+16>:    mov    ebx,ecx
   0x0000000000831d32 <+18>:    sub    rsp,0x98
   0x0000000000831d39 <+25>:    mov    DWORD PTR [rbp-0x9c],r9d
   0x0000000000831d40 <+32>:    mov    r9d,DWORD PTR [rdi+0x4]
   0x0000000000831d44 <+36>:    mov    QWORD PTR [rbp-0x98],rdi
   0x0000000000831d4b <+43>:    mov    QWORD PTR [rbp-0xa8],rsi
   0x0000000000831d52 <+50>:    mov    DWORD PTR [rbp-0xa0],r8d
   0x0000000000831d59 <+57>:    mov    rax,QWORD PTR fs:0x28
   0x0000000000831d62 <+66>:    mov    QWORD PTR [rbp-0x38],rax
   0x0000000000831d66 <+70>:    xor    eax,eax
   0x0000000000831d68 <+72>:    test   r9d,r9d
   0x0000000000831d6b <+75>:    js     0x831eb0
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+400>
   0x0000000000831d71 <+81>:    je     0x831e78
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+344>
   0x0000000000831d77 <+87>:    test   rdx,rdx
   0x0000000000831d7a <+90>:    je     0x8321a9
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1161>
   0x0000000000831d80 <+96>:    cmp    BYTE PTR [rbp-0x9c],0x0
   0x0000000000831d87 <+103>:   jne    0x8320a0
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+896>
   0x0000000000831d8d <+109>:   lea    r13,[rbp-0x70]
   0x0000000000831d91 <+113>:   lea    rax,[rdx*8+0x0]
   0x0000000000831d99 <+121>:   mov    rdi,r13
   0x0000000000831d9c <+124>:   mov    r15,rax
   0x0000000000831d9f <+127>:   mov    QWORD PTR [rbp-0xb0],rax
   0x0000000000831da6 <+134>:   call   0x10ef720 <__gmpz_init>
   0x0000000000831dab <+139>:   mov    rdi,QWORD PTR [rbp-0x98]
   0x0000000000831db2 <+146>:   mov    esi,0x2
   0x0000000000831db7 <+151>:   call   0x10f09f0 <__gmpz_sizeinbase>
   0x0000000000831dbc <+156>:   cmp    r15,rax
   0x0000000000831dbf <+159>:   jae    0x831de8
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+200>
   0x0000000000831dc1 <+161>:   mov    rsi,QWORD PTR [rbp-0x98]
   0x0000000000831dc8 <+168>:   mov    rdi,r13
   0x0000000000831dcb <+171>:   call   0x10f05d0 <__gmpz_set>
   0x0000000000831dd0 <+176>:   mov    edx,DWORD PTR [rbp-0xb0]
   0x0000000000831dd6 <+182>:   mov    rsi,r13
   0x0000000000831dd9 <+185>:   mov    rdi,r13
   0x0000000000831ddc <+188>:   call   0x10f1ad0 <__gmpz_tdiv_r_2exp>
   0x0000000000831de1 <+193>:   mov    QWORD PTR [rbp-0x98],r13
   0x0000000000831de8 <+200>:   mov    rax,QWORD PTR [rbp-0x98]
   0x0000000000831def <+207>:   mov    ecx,DWORD PTR [rax+0x4]
   0x0000000000831df2 <+210>:   test   ecx,ecx
   0x0000000000831df4 <+212>:   je     0x8320b0
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+912>
   0x0000000000831dfa <+218>:   sub    rsp,0x8
   0x0000000000831dfe <+222>:   push   QWORD PTR [rbp-0x98]
   0x0000000000831e04 <+228>:   xor    r9d,r9d
   0x0000000000831e07 <+231>:   mov    r8d,ebx
   0x0000000000831e0a <+234>:   mov    rcx,r12
   0x0000000000831e0d <+237>:   mov    edx,0xffffffff
   0x0000000000831e12 <+242>:   lea    rsi,[rbp-0x78]
   0x0000000000831e16 <+246>:   xor    edi,edi
   0x0000000000831e18 <+248>:   call   0x10eec20 <__gmpz_export>
   0x0000000000831e1d <+253>:   cmp    QWORD PTR [rbp-0x78],0x1
   0x0000000000831e22 <+258>:   mov    r15,rax
   0x0000000000831e25 <+261>:   pop    rax
   0x0000000000831e26 <+262>:   pop    rdx
   0x0000000000831e27 <+263>:   jne    0x8321d2
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1202>
   0x0000000000831e2d <+269>:   mov    rdi,QWORD PTR [rbp-0xa8]
   0x0000000000831e34 <+276>:   mov    rdx,r12
   0x0000000000831e37 <+279>:   mov    rsi,r15
   0x0000000000831e3a <+282>:   call   0x57ed80 <memcpy@plt>
   0x0000000000831e3f <+287>:   mov    rdi,r15
   0x0000000000831e42 <+290>:   call   0x10d0f10 <rpl_free>
   0x0000000000831e47 <+295>:   mov    rdi,r13
   0x0000000000831e4a <+298>:   call   0x10ee8c0 <__gmpz_clear>
   0x0000000000831e4f <+303>:   mov    rax,QWORD PTR [rbp-0x38]
   0x0000000000831e53 <+307>:   sub    rax,QWORD PTR fs:0x28
   0x0000000000831e5c <+316>:   jne    0x832109
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1001>
   0x0000000000831e62 <+322>:   lea    rsp,[rbp-0x28]
   0x0000000000831e66 <+326>:   pop    rbx
   0x0000000000831e67 <+327>:   pop    r12
   0x0000000000831e69 <+329>:   pop    r13
   0x0000000000831e6b <+331>:   pop    r14
   0x0000000000831e6d <+333>:   pop    r15
   0x0000000000831e6f <+335>:   pop    rbp
   0x0000000000831e70 <+336>:   ret
   0x0000000000831e71 <+337>:   nop    DWORD PTR [rax+0x0]
   0x0000000000831e78 <+344>:   test   rdx,rdx
   0x0000000000831e7b <+347>:   je     0x831e4f
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+303>
   0x0000000000831e7d <+349>:   mov    rax,QWORD PTR [rbp-0x38]
   0x0000000000831e81 <+353>:   sub    rax,QWORD PTR fs:0x28
   0x0000000000831e8a <+362>:   jne    0x832109
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1001>
   0x0000000000831e90 <+368>:   mov    rdi,QWORD PTR [rbp-0xa8]
   0x0000000000831e97 <+375>:   lea    rsp,[rbp-0x28]
   0x0000000000831e9b <+379>:   xor    esi,esi
   0x0000000000831e9d <+381>:   pop    rbx
   0x0000000000831e9e <+382>:   pop    r12
   0x0000000000831ea0 <+384>:   pop    r13
   0x0000000000831ea2 <+386>:   pop    r14
   0x0000000000831ea4 <+388>:   pop    r15
   0x0000000000831ea6 <+390>:   pop    rbp
   0x0000000000831ea7 <+391>:   jmp    0x57e7d0 <memset@plt>
   0x0000000000831eac <+396>:   nop    DWORD PTR [rax+0x0]
   0x0000000000831eb0 <+400>:   test   rdx,rdx
   0x0000000000831eb3 <+403>:   je     0x8321a9
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1161>
   0x0000000000831eb9 <+409>:   cmp    BYTE PTR [rbp-0x9c],0x0
   0x0000000000831ec0 <+416>:   jne    0x831f70
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+592>
   0x0000000000831ec6 <+422>:   lea    r13,[rbp-0x70]
   0x0000000000831eca <+426>:   lea    rax,[rdx*8+0x0]
   0x0000000000831ed2 <+434>:   mov    rdi,r13
   0x0000000000831ed5 <+437>:   mov    QWORD PTR [rbp-0xb0],rax
   0x0000000000831edc <+444>:   lea    r14,[rbp-0x60]
   0x0000000000831ee0 <+448>:   call   0x10ef720 <__gmpz_init>
   0x0000000000831ee5 <+453>:   mov    rdi,r14
   0x0000000000831ee8 <+456>:   call   0x10ef720 <__gmpz_init>
   0x0000000000831eed <+461>:   mov    rdx,QWORD PTR [rbp-0xb0]
   0x0000000000831ef4 <+468>:   mov    esi,0x2
   0x0000000000831ef9 <+473>:   mov    rdi,r14
   0x0000000000831efc <+476>:   call   0x10f1c40 <__gmpz_ui_pow_ui>
   0x0000000000831f01 <+481>:   lea    r15,[rbp-0x50]
   0x0000000000831f05 <+485>:   mov    rdi,r15
   0x0000000000831f08 <+488>:   call   0x10ef720 <__gmpz_init>
   0x0000000000831f0d <+493>:   mov    rsi,QWORD PTR [rbp-0x98]
   0x0000000000831f14 <+500>:   mov    rdx,r14
   0x0000000000831f17 <+503>:   mov    rdi,r15
   0x0000000000831f1a <+506>:   call   0x10ed830 <__gmpz_add>
   0x0000000000831f1f <+511>:   mov    rsi,r15
   0x0000000000831f22 <+514>:   mov    rdi,r13
   0x0000000000831f25 <+517>:   call   0x10f10b0 <__gmpz_swap>
   0x0000000000831f2a <+522>:   mov    rdi,r15
   0x0000000000831f2d <+525>:   call   0x10ee8c0 <__gmpz_clear>
   0x0000000000831f32 <+530>:   mov    rdi,r14
   0x0000000000831f35 <+533>:   call   0x10ee8c0 <__gmpz_clear>
   0x0000000000831f3a <+538>:   cmp    BYTE PTR [rbp-0x9c],0x0
   0x0000000000831f41 <+545>:   jne    0x831de1
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+193>
   0x0000000000831f47 <+551>:   mov    esi,0x2
   0x0000000000831f4c <+556>:   mov    rdi,r13
   0x0000000000831f4f <+559>:   call   0x10f09f0 <__gmpz_sizeinbase>
   0x0000000000831f54 <+564>:   cmp    rax,QWORD PTR [rbp-0xb0]
   0x0000000000831f5b <+571>:   ja     0x831dd0
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+176>
   0x0000000000831f61 <+577>:   jmp    0x831de1
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+193>
   0x0000000000831f66 <+582>:   cs nop WORD PTR [rax+rax*1+0x0]
   0x0000000000831f70 <+592>:   mov    DWORD PTR [rbp-0xb4],0xffffffff
   0x0000000000831f7a <+602>:   lea    r13,[rbp-0x70]
   0x0000000000831f7e <+606>:   lea    r14,[rbp-0x60]
   0x0000000000831f82 <+610>:   mov    rdi,r13
   0x0000000000831f85 <+613>:   call   0x10ef720 <__gmpz_init>
   0x0000000000831f8a <+618>:   mov    rdi,r14
   0x0000000000831f8d <+621>:   call   0x10ef720 <__gmpz_init>
   0x0000000000831f92 <+626>:   lea    rax,[r12*8+0x0]
   0x0000000000831f9a <+634>:   cmp    BYTE PTR [rbp-0xa0],0x0
   0x0000000000831fa1 <+641>:   mov    QWORD PTR [rbp-0xb0],rax
   0x0000000000831fa8 <+648>:   jne    0x832048
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+808>
   0x0000000000831fae <+654>:   mov    rax,QWORD PTR [rbp-0xb0]
   0x0000000000831fb5 <+661>:   mov    esi,0x2
   0x0000000000831fba <+666>:   mov    rdi,r13
   0x0000000000831fbd <+669>:   lea    r15,[rax-0x1]
   0x0000000000831fc1 <+673>:   mov    rdx,r15
   0x0000000000831fc4 <+676>:   call   0x10f1c40 <__gmpz_ui_pow_ui>
   0x0000000000831fc9 <+681>:   mov    rdx,r15
   0x0000000000831fcc <+684>:   mov    esi,0x2
   0x0000000000831fd1 <+689>:   mov    rdi,r14
   0x0000000000831fd4 <+692>:   neg    DWORD PTR [rbp-0x6c]
   0x0000000000831fd7 <+695>:   call   0x10f1c40 <__gmpz_ui_pow_ui>
   0x0000000000831fdc <+700>:   mov    edx,0x1
   0x0000000000831fe1 <+705>:   mov    rsi,r14
   0x0000000000831fe4 <+708>:   mov    rdi,r14
   0x0000000000831fe7 <+711>:   call   0x10f0e70 <__gmpz_sub_ui>
   0x0000000000831fec <+716>:   mov    r15,QWORD PTR [rbp-0x98]
   0x0000000000831ff3 <+723>:   mov    rsi,r13
   0x0000000000831ff6 <+726>:   mov    rdi,r15
   0x0000000000831ff9 <+729>:   call   0x10ee8e0 <__gmpz_cmp>
   0x0000000000831ffe <+734>:   test   eax,eax
   0x0000000000832000 <+736>:   js     0x83210e
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1006>
   0x0000000000832006 <+742>:   mov    rsi,r14
   0x0000000000832009 <+745>:   mov    rdi,r15
   0x000000000083200c <+748>:   call   0x10ee8e0 <__gmpz_cmp>
   0x0000000000832011 <+753>:   test   eax,eax
   0x0000000000832013 <+755>:   jg     0x83210e
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1006>
   0x0000000000832019 <+761>:   mov    rdi,r14
   0x000000000083201c <+764>:   call   0x10ee8c0 <__gmpz_clear>
   0x0000000000832021 <+769>:   mov    rdi,r13
   0x0000000000832024 <+772>:   call   0x10ee8c0 <__gmpz_clear>
   0x0000000000832029 <+777>:   mov    rdi,r13
   0x000000000083202c <+780>:   call   0x10ef720 <__gmpz_init>
   0x0000000000832031 <+785>:   cmp    DWORD PTR [rbp-0xb4],0xffffffff
   0x0000000000832038 <+792>:   jne    0x831de8
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+200>
   0x000000000083203e <+798>:   jmp    0x831ee5
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+453>
   0x0000000000832043 <+803>:   nop    DWORD PTR [rax+rax*1+0x0]
   0x0000000000832048 <+808>:   sub    rsp,0x8
   0x000000000083204c <+812>:   lea    rax,[rbp-0x78]
   0x0000000000832050 <+816>:   xor    r9d,r9d
   0x0000000000832053 <+819>:   xor    r8d,r8d
   0x0000000000832056 <+822>:   push   rax
   0x0000000000832057 <+823>:   mov    ecx,0x4
   0x000000000083205c <+828>:   mov    edx,0xffffffff
   0x0000000000832061 <+833>:   mov    esi,0x1
   0x0000000000832066 <+838>:   mov    rdi,r13
   0x0000000000832069 <+841>:   mov    DWORD PTR [rbp-0x78],0x0
   0x0000000000832070 <+848>:   call   0x10ef3c0 <__gmpz_import>
   0x0000000000832075 <+853>:   mov    r8d,DWORD PTR [rbp-0x78]
   0x0000000000832079 <+857>:   pop    rsi
   0x000000000083207a <+858>:   pop    rdi
   0x000000000083207b <+859>:   test   r8d,r8d
   0x000000000083207e <+862>:   js     0x8320d0
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+944>
   0x0000000000832080 <+864>:   mov    rdx,QWORD PTR [rbp-0xb0]
   0x0000000000832087 <+871>:   mov    esi,0x2
   0x000000000083208c <+876>:   mov    rdi,r14
   0x000000000083208f <+879>:   call   0x10f1c40 <__gmpz_ui_pow_ui>
   0x0000000000832094 <+884>:   jmp    0x831fdc
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+700>
   0x0000000000832099 <+889>:   nop    DWORD PTR [rax+0x0]
   0x00000000008320a0 <+896>:   mov    DWORD PTR [rbp-0xb4],0x1
   0x00000000008320aa <+906>:   jmp    0x831f7a
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+602>
   0x00000000008320af <+911>:   nop
   0x00000000008320b0 <+912>:   mov    rdi,QWORD PTR [rbp-0xa8]
   0x00000000008320b7 <+919>:   mov    rdx,r12
   0x00000000008320ba <+922>:   xor    esi,esi
   0x00000000008320bc <+924>:   call   0x57e7d0 <memset@plt>
   0x00000000008320c1 <+929>:   mov    rdi,r13
   0x00000000008320c4 <+932>:   call   0x10ee8c0 <__gmpz_clear>
   0x00000000008320c9 <+937>:   jmp    0x831e4f
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+303>
   0x00000000008320ce <+942>:   xchg   ax,ax
   0x00000000008320d0 <+944>:   lea    r15,[rbp-0x50]
   0x00000000008320d4 <+948>:   mov    rdi,r15
   0x00000000008320d7 <+951>:   call   0x10ef720 <__gmpz_init>
   0x00000000008320dc <+956>:   mov    edx,0x20
   0x00000000008320e1 <+961>:   mov    esi,0x2
   0x00000000008320e6 <+966>:   mov    rdi,r15
   0x00000000008320e9 <+969>:   call   0x10f1c40 <__gmpz_ui_pow_ui>
   0x00000000008320ee <+974>:   mov    rdx,r15
   0x00000000008320f1 <+977>:   mov    rsi,r13
   0x00000000008320f4 <+980>:   mov    rdi,r13
   0x00000000008320f7 <+983>:   call   0x10f0ba0 <__gmpz_sub>
   0x00000000008320fc <+988>:   mov    rdi,r15
   0x00000000008320ff <+991>:   call   0x10ee8c0 <__gmpz_clear>
   0x0000000000832104 <+996>:   jmp    0x832080
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+864>
   0x0000000000832109 <+1001>:  call   0x57f260 <__stack_chk_fail@plt>
   0x000000000083210e <+1006>:  mov    rdx,r14
   0x0000000000832111 <+1009>:  mov    esi,0x11af192
   0x0000000000832116 <+1014>:  lea    rdi,[rbp-0x78]
   0x000000000083211a <+1018>:  xor    eax,eax
   0x000000000083211c <+1020>:  call   0x831b20 <_Z17gmp_string_printfPKcz>
   0x0000000000832121 <+1025>:  mov    rdx,r13
   0x0000000000832124 <+1028>:  mov    esi,0x11af192
   0x0000000000832129 <+1033>:  lea    rdi,[rbp-0x80]
   0x000000000083212d <+1037>:  xor    eax,eax
   0x000000000083212f <+1039>:  mov    rbx,QWORD PTR [rbp-0x78]
   0x0000000000832133 <+1043>:  call   0x831b20 <_Z17gmp_string_printfPKcz>
   0x0000000000832138 <+1048>:  cmp    BYTE PTR [rbp-0xa0],0x0
   0x000000000083213f <+1055>:  mov    r15,QWORD PTR [rbp-0x80]
   0x0000000000832143 <+1059>:  je     0x8321fb
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1243>
   0x0000000000832149 <+1065>:  mov    edi,0x114d1cb
   0x000000000083214e <+1070>:  call   0x57e2d0 <gettext@plt>
   0x0000000000832153 <+1075>:  mov    r12,rax
   0x0000000000832156 <+1078>:  mov    rdx,QWORD PTR [rbp-0x98]
   0x000000000083215d <+1085>:  mov    esi,0x11af192
   0x0000000000832162 <+1090>:  lea    rdi,[rbp-0x88]
   0x0000000000832169 <+1097>:  xor    eax,eax
   0x000000000083216b <+1099>:  call   0x831b20 <_Z17gmp_string_printfPKcz>
   0x0000000000832170 <+1104>:  mov    rax,QWORD PTR [rbp-0x88]
   0x0000000000832177 <+1111>:  mov    edi,0x11be148
   0x000000000083217c <+1116>:  mov    QWORD PTR [rbp-0x98],rax
   0x0000000000832183 <+1123>:  call   0x57e2d0 <gettext@plt>
   0x0000000000832188 <+1128>:  mov    r9,rbx
   0x000000000083218b <+1131>:  mov    r8,r15
   0x000000000083218e <+1134>:  mov    rcx,r12
   0x0000000000832191 <+1137>:  mov    rdx,QWORD PTR [rbp-0xb0]
   0x0000000000832198 <+1144>:  mov    rsi,QWORD PTR [rbp-0x98]
   0x000000000083219f <+1151>:  mov    rdi,rax
   0x00000000008321a2 <+1154>:  xor    eax,eax
   0x00000000008321a4 <+1156>:  call   0x109b990 <_Z5errorPKcz>
   0x00000000008321a9 <+1161>:  mov    edi,0x1122010
   0x00000000008321ae <+1166>:  call   0x57e2d0 <gettext@plt>
   0x00000000008321b3 <+1171>:  mov    r8d,0x11be0fa
   0x00000000008321b9 <+1177>:  mov    ecx,0x11be10a
   0x00000000008321be <+1182>:  mov    esi,0x55
   0x00000000008321c3 <+1187>:  mov    rdx,rax
   0x00000000008321c6 <+1190>:  mov    edi,0x11be128
   0x00000000008321cb <+1195>:  xor    eax,eax
   0x00000000008321cd <+1197>:  call   0x109ba30
<_Z18internal_error_locPKciS0_z>
   0x00000000008321d2 <+1202>:  mov    edi,0x1122010
   0x00000000008321d7 <+1207>:  call   0x57e2d0 <gettext@plt>
   0x00000000008321dc <+1212>:  mov    r8d,0x11be116
   0x00000000008321e2 <+1218>:  mov    ecx,0x11be10a
   0x00000000008321e7 <+1223>:  mov    esi,0xa9
   0x00000000008321ec <+1228>:  mov    rdx,rax
   0x00000000008321ef <+1231>:  mov    edi,0x11be128
   0x00000000008321f4 <+1236>:  xor    eax,eax
   0x00000000008321f6 <+1238>:  call   0x109ba30
<_Z18internal_error_locPKciS0_z>
=> 0x00000000008321fb <+1243>:  mov    edi,0x114d1b3
   0x0000000000832200 <+1248>:  call   0x57e2d0 <gettext@plt>
   0x0000000000832205 <+1253>:  mov    r12,rax
   0x0000000000832208 <+1256>:  jmp    0x832156
<_ZNK7gdb_mpz11export_bitsEN3gdb10array_viewIhEEibb+1078>
   0x000000000083220d <+1261>:  mov    rbx,rax
   0x0000000000832210 <+1264>:  jmp    0x5935ca
   0x0000000000832215 <+1269>:  mov    rbx,rax
   0x0000000000832218 <+1272>:  jmp    0x5935d2
   0x000000000083221d <+1277>:  mov    rbx,rax
   0x0000000000832220 <+1280>:  jmp    0x593614
   0x0000000000832225 <+1285>:  mov    rbx,rax
   0x0000000000832228 <+1288>:  jmp    0x5935fa
   0x000000000083222d <+1293>:  mov    rbx,rax
   0x0000000000832230 <+1296>:  jmp    0x593629
   0x0000000000832235 <+1301>:  mov    rbx,rax
   0x0000000000832238 <+1304>:  jmp    0x5935ea
   0x000000000083223d <+1309>:  mov    rbx,rax
   0x0000000000832240 <+1312>:  jmp    0x593620
   0x0000000000832245 <+1317>:  mov    rbx,rax
   0x0000000000832248 <+1320>:  jmp    0x59360a
   0x000000000083224d <+1325>:  mov    rbx,rax
   0x0000000000832250 <+1328>:  jmp    0x593634

(gdb) x $rbp-0x78
0x7ffe0d0c0128: 0x00000002

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

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

* [Bug gdb/31532] gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed.
  2024-03-22 15:30 [Bug gdb/31532] New: gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed dmitry.neverov at jetbrains dot com
                   ` (2 preceding siblings ...)
  2024-03-22 19:31 ` dmitry.neverov at jetbrains dot com
@ 2024-03-23 15:47 ` dmitry.neverov at jetbrains dot com
  2024-03-23 18:49 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: dmitry.neverov at jetbrains dot com @ 2024-03-23 15:47 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Dmitry Neverov <dmitry.neverov at jetbrains dot com> ---
Turns out it was gmp build problem. Gmp was build without an
explicit --build option, and it guessed it to
be "skylake-pc-linux-gnu". In this configuration gmp uses LZCNT
instruction. When gdb was launched on a CPU without LZCNT
support, the BSR instruction is executed instead. BSR produces a
different result from LZCNT which triggers the assertion. That's
why same gdb build was working fine on some (newer) machines, but
failed on others. Building gmp with --build=x86_64-pc-linux-gnu
fixes the problem.

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

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

* [Bug gdb/31532] gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed.
  2024-03-22 15:30 [Bug gdb/31532] New: gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed dmitry.neverov at jetbrains dot com
                   ` (3 preceding siblings ...)
  2024-03-23 15:47 ` dmitry.neverov at jetbrains dot com
@ 2024-03-23 18:49 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2024-03-23 18:49 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOTABUG
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Dmitry Neverov from comment #4)
> Turns out it was gmp build problem.

Thanks for letting us know.
I'm going to close this now.

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

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

end of thread, other threads:[~2024-03-23 18:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22 15:30 [Bug gdb/31532] New: gdb/gmp-utils.c:169: internal-error: export_bits: Assertion `word_countp == 1' failed dmitry.neverov at jetbrains dot com
2024-03-22 15:49 ` [Bug gdb/31532] " vries at gcc dot gnu.org
2024-03-22 16:14 ` tromey at sourceware dot org
2024-03-22 19:31 ` dmitry.neverov at jetbrains dot com
2024-03-23 15:47 ` dmitry.neverov at jetbrains dot com
2024-03-23 18:49 ` tromey at sourceware dot 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).