From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3BF72394443F; Sat, 19 Dec 2020 12:43:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BF72394443F From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug exp/27070] gdb crashes when comparing 2 instances of the same enum Date: Sat, 19 Dec 2020 12:43:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: exp X-Bugzilla-Version: 10.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Dec 2020 12:43:43 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27070 --- Comment #1 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Hannes Domani : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dfa639f555afb= e6bf670c27d161c42974740987cb commit fa639f555afbe6bf670c27d161c42974740987cb Author: Hannes Domani Date: Mon Dec 14 19:06:38 2020 +0100 Don't compare types of enum fields Comparing types of enum fields results in a crash, because they don't have a type. It can be reproduced by comparing the types of 2 instances of the same enum type in different objects: enum.h: enum e { zero, one, }; enum-1.c: #include int func(); enum e e1; int main() { return e1 + func(); } enum-2.c: #include enum e e2; int func() { return e2; } $ gcc -g -oenum enum-1.c enum-2.c $ gdb -q enum.exe Reading symbols from enum.exe... (gdb) py print(gdb.parse_and_eval("e1").type=3D=3Dgdb.parse_and_eval("e2").type) Thread 1 received signal SIGSEGV, Segmentation fault. [Switching to Thread 6184.0x1cc4] check_typedef (type=3D0x0) at C:/src/repos/binutils-gdb.git/gdb/gdbtypes.c:2745 2745 while (type->code () =3D=3D TYPE_CODE_TYPEDEF) gdb/ChangeLog: 2020-12-19 Hannes Domani PR exp/27070 * gdbtypes.c (check_types_equal): Don't compare types of enum fields. gdb/testsuite/ChangeLog: 2020-12-19 Hannes Domani PR exp/27070 * gdb.python/compare-enum-type-a.c: New test. * gdb.python/compare-enum-type-b.c: New test. * gdb.python/compare-enum-type.exp: New file. * gdb.python/compare-enum-type.h: New test. --=20 You are receiving this mail because: You are on the CC list for the bug.=