public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/31852] New: [gdb/symtab, 1-byte complex float] gdbtypes.c:244: internal-error: new_type: Assertion `(bit % TARGET_CHAR_BIT) == 0' failed
@ 2024-06-06 14:56 vries at gcc dot gnu.org
0 siblings, 0 replies; only message in thread
From: vries at gcc dot gnu.org @ 2024-06-06 14:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=31852
Bug ID: 31852
Summary: [gdb/symtab, 1-byte complex float] gdbtypes.c:244:
internal-error: new_type: Assertion `(bit %
TARGET_CHAR_BIT) == 0' failed
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: symtab
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
FTR, I wrote the following dwarf assembly test-case:
...
load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
standard_testfile main.c -debug.S
# Create the DWARF.
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
declare_labels unspecified_type_label
cu { version 2 } {
compile_unit {} {
declare_labels int_type
int_type: DW_TAG_base_type {
{DW_AT_byte_size 4 DW_FORM_sdata}
{DW_AT_encoding @DW_ATE_signed}
{DW_AT_name int}
}
DW_TAG_subprogram {
{MACRO_AT_func {main}}
{type :$int_type}
}
DW_TAG_base_type {
{DW_AT_byte_size 1 DW_FORM_sdata}
{DW_AT_encoding @DW_ATE_complex_float}
{DW_AT_name "complex long double"}
}
}
}
}
if [prepare_for_testing "failed to prepare" $testfile \
"${asm_file} ${srcfile}" {}] {
return -1
}
if ![runto_main] {
return -1
}
gdb_test "ptype complex long double"
...
which produces:
...
<1><39>: Abbrev Number: 4 (DW_TAG_base_type)
<3a> DW_AT_byte_size : 1
<3b> DW_AT_encoding : 3 (complex float)
<3c> DW_AT_name : complex long double
...
We run into:
...
(gdb) break -qualified main^M
/data/vries/gdb/src/gdb/gdbtypes.c:244: internal-error: new_type: Assertion
`(bit % TARGET_CHAR_BIT) == 0' failed.^M
A problem internal to GDB has been detected,^M
...
Could be fixed by:
...
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index f39fe3de6a4..1216b69d67a 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -241,6 +241,8 @@ type_allocator::new_type (enum type_code code, int bit,
const char *name)
{
struct type *type = new_type ();
set_type_code (type, code);
+ if (code == TYPE_CODE_ERROR && bit % TARGET_CHAR_BIT != 0)
+ bit = 0;
gdb_assert ((bit % TARGET_CHAR_BIT) == 0);
type->set_length (bit / TARGET_CHAR_BIT);
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-06 14:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-06 14:56 [Bug symtab/31852] New: [gdb/symtab, 1-byte complex float] gdbtypes.c:244: internal-error: new_type: Assertion `(bit % TARGET_CHAR_BIT) == 0' failed vries 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).