* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
@ 2023-01-10 21:42 ` pawel_sikora at zoho dot com
2023-01-10 21:46 ` pawel_sikora at zoho dot com
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pawel_sikora at zoho dot com @ 2023-01-10 21:42 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--- Comment #1 from Paweł Sikora <pawel_sikora at zoho dot com> ---
Created attachment 14570
--> https://sourceware.org/bugzilla/attachment.cgi?id=14570&action=edit
testcase
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
2023-01-10 21:42 ` [Bug c++/29985] " pawel_sikora at zoho dot com
@ 2023-01-10 21:46 ` pawel_sikora at zoho dot com
2023-01-11 18:42 ` tromey at sourceware dot org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pawel_sikora at zoho dot com @ 2023-01-10 21:46 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--- Comment #2 from Paweł Sikora <pawel_sikora at zoho dot com> ---
looks like, fine tuned 'short nfields' (gdbtypes.h:839) is not enough for such
testcase. lldb works fine.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
2023-01-10 21:42 ` [Bug c++/29985] " pawel_sikora at zoho dot com
2023-01-10 21:46 ` pawel_sikora at zoho dot com
@ 2023-01-11 18:42 ` tromey at sourceware dot org
2023-01-11 19:33 ` pedro at palves dot net
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at sourceware dot org @ 2023-01-11 18:42 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I feel like we've been waiting for years for this to bite.
Hilariously I think this test case would work with 'unsigned short',
but at the same time, surely someone out there wants an enum
with 65537 constants.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (2 preceding siblings ...)
2023-01-11 18:42 ` tromey at sourceware dot org
@ 2023-01-11 19:33 ` pedro at palves dot net
2023-01-11 19:48 ` pawel_sikora at zoho dot com
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pedro at palves dot net @ 2023-01-11 19:33 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
Pedro Alves <pedro at palves dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pedro at palves dot net
--- Comment #4 from Pedro Alves <pedro at palves dot net> ---
Is this a real program (presumably auto generated code), or just some toolchain
testcase or some such? "ENUM_ID::ENUM_VAL_14" kind of hints at the latter.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (3 preceding siblings ...)
2023-01-11 19:33 ` pedro at palves dot net
@ 2023-01-11 19:48 ` pawel_sikora at zoho dot com
2023-01-11 20:44 ` tromey at sourceware dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pawel_sikora at zoho dot com @ 2023-01-11 19:48 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--- Comment #5 from Paweł Sikora <pawel_sikora at zoho dot com> ---
(In reply to Pedro Alves from comment #4)
> Is this a real program (presumably auto generated code), or just some
> toolchain testcase or some such? "ENUM_ID::ENUM_VAL_14" kind of hints at
> the latter.
original program is a real hdl compiler for complex fpga technology. testcase
is reduced and anonymized to ENUM_VAL_*. one way or another, assigning 'int
idx' to 'short' will not work forever...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (4 preceding siblings ...)
2023-01-11 19:48 ` pawel_sikora at zoho dot com
@ 2023-01-11 20:44 ` tromey at sourceware dot org
2023-01-11 20:45 ` tromey at sourceware dot org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at sourceware dot org @ 2023-01-11 20:44 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-01-11
Ever confirmed|0 |1
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (5 preceding siblings ...)
2023-01-11 20:44 ` tromey at sourceware dot org
@ 2023-01-11 20:45 ` tromey at sourceware dot org
2023-01-27 15:16 ` tromey at sourceware dot org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at sourceware dot org @ 2023-01-11 20:45 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2023-January/195572.html
That allows about 2 billion constants on typical arches.
We could boost it higher if we cared to.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (6 preceding siblings ...)
2023-01-11 20:45 ` tromey at sourceware dot org
@ 2023-01-27 15:16 ` tromey at sourceware dot org
2023-01-27 17:06 ` pedro at palves dot net
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at sourceware dot org @ 2023-01-27 15:16 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org
--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
Sent v2.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (7 preceding siblings ...)
2023-01-27 15:16 ` tromey at sourceware dot org
@ 2023-01-27 17:06 ` pedro at palves dot net
2023-01-30 20:09 ` tromey at sourceware dot org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pedro at palves dot net @ 2023-01-27 17:06 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--- Comment #8 from Pedro Alves <pedro at palves dot net> ---
> original program is a real hdl compiler for complex fpga technology. testcase
> is reduced and anonymized to ENUM_VAL_*. one way or another, assigning 'int
> idx' to 'short' will not work forever...
Thanks. I was asking because I had the impression that GCC dropped debug info
once some limit is reached or some such. Turns out it's worse than that -- it
fails to compile, as Tromey discovered while writing a testcase. So I guess
you must be using Clang or some other compiler.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (8 preceding siblings ...)
2023-01-27 17:06 ` pedro at palves dot net
@ 2023-01-30 20:09 ` tromey at sourceware dot org
2023-02-04 16:52 ` pawel_sikora at zoho dot com
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tromey at sourceware dot org @ 2023-01-30 20:09 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--- Comment #9 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Pedro Alves from comment #8)
> Thanks. I was asking because I had the impression that GCC dropped debug
> info once some limit is reached or some such. Turns out it's worse than
> that -- it fails to compile, as Tromey discovered while writing a testcase.
> So I guess you must be using Clang or some other compiler.
Actually it turned out that the supplied test does work in gcc, but
when I wrote one for the test suite I used a larger constant and that
caused a failure.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (9 preceding siblings ...)
2023-01-30 20:09 ` tromey at sourceware dot org
@ 2023-02-04 16:52 ` pawel_sikora at zoho dot com
2023-02-09 15:02 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pawel_sikora at zoho dot com @ 2023-02-04 16:52 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--- Comment #10 from Paweł Sikora <pawel_sikora at zoho dot com> ---
(In reply to Pedro Alves from comment #8)
> > original program is a real hdl compiler for complex fpga technology. testcase
> > is reduced and anonymized to ENUM_VAL_*. one way or another, assigning 'int
> > idx' to 'short' will not work forever...
>
> Thanks. I was asking because I had the impression that GCC dropped debug
> info once some limit is reached or some such. Turns out it's worse than
> that -- it fails to compile, as Tromey discovered while writing a testcase.
> So I guess you must be using Clang or some other compiler.
yes, we're currently using clang-15 (compiler/tools/thinlto/lld) +
libcxx.llvm.org + qtcreator-9.x + gdb for development and local
(x86_64)/remote(x86_64->arm64) debugging.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (10 preceding siblings ...)
2023-02-04 16:52 ` pawel_sikora at zoho dot com
@ 2023-02-09 15:02 ` cvs-commit at gcc dot gnu.org
2023-02-09 15:02 ` tromey at sourceware dot org
2023-03-15 18:23 ` simon.marchi at polymtl dot ca
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-09 15:02 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--- Comment #11 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1775f8b3804744c22611ed0c9fd2df4f5b4d8641
commit 1775f8b3804744c22611ed0c9fd2df4f5b4d8641
Author: Tom Tromey <tromey@adacore.com>
Date: Wed Jan 11 12:42:40 2023 -0700
Increase size of main_type::nfields
main_type::nfields is a 'short', and has been for many years. PR
c++/29985 points out that 'short' is too narrow for an enum that
contains more than 2^15 constants.
This patch bumps the size of 'nfields'. To verify that the field
isn't directly used, it is also renamed. Note that this does not
affect the size of main_type on x86-64 Fedora 36. And, if it does
have a negative effect somewhere, it's worth considering that types
could be shrunk more drastically by using subclasses for the different
codes.
This is v2 of this patch, which has these changes:
* I changed nfields to 'unsigned', per Simon's request. I looked at
changing all the uses, but this quickly fans out into a very large
patch. (One additional tweak was needed, though.)
* I wrote a test case. I discovered that GCC cannot compile a large
enough C test case, so I resorted to using the DWARF assembler.
This test doesn't reproduce the crash, but it does fail without the
patch.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29985
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (11 preceding siblings ...)
2023-02-09 15:02 ` cvs-commit at gcc dot gnu.org
@ 2023-02-09 15:02 ` tromey at sourceware dot org
2023-03-15 18:23 ` simon.marchi at polymtl dot ca
13 siblings, 0 replies; 15+ messages in thread
From: tromey at sourceware dot org @ 2023-02-09 15:02 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.1
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #12 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/29985] gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed.
2023-01-10 21:41 [Bug c++/29985] New: gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed pawel_sikora at zoho dot com
` (12 preceding siblings ...)
2023-02-09 15:02 ` tromey at sourceware dot org
@ 2023-03-15 18:23 ` simon.marchi at polymtl dot ca
13 siblings, 0 replies; 15+ messages in thread
From: simon.marchi at polymtl dot ca @ 2023-03-15 18:23 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29985
Simon Marchi <simon.marchi at polymtl dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |blue.swallow.71 at gmail dot com
--- Comment #13 from Simon Marchi <simon.marchi at polymtl dot ca> ---
*** Bug 30236 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 15+ messages in thread