forked from Imagelibrary/binutils-gdb
compile: Warn for old GCC on cv-qualified self-reference
GDB could: compile code struct_object.selffield = &struct_object ./compile/compile-c-types.c:83: internal-error: insert_type: Assertion `add == NULL || add->gcc_type == gcc_type' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) FAIL: gdb.compile/compile.exp: compile code struct_object.selffield = &struct_object (GDB internal error) The bug was not in GDB but in the GCC part interfacing with GDB. Alexandre Oliva has fixed it the right way: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;a=commitdiff;h=072dfdba0ea62abb65514cb3a90cdf3868efe286 git://gcc.gnu.org/git/gcc.git aoliva/libcp1 Attaching this GDB testsuite update + info to user s/he should upgrade GCC. After Alex upstreams the fix I can update the message to contain the specific GCC release. gdb/ChangeLog 2015-07-08 Jan Kratochvil <jan.kratochvil@redhat.com> PR compile/18484 * compile/compile-c-types.c (insert_type): Change gdb_assert to error. gdb/testsuite/ChangeLog 2015-07-08 Jan Kratochvil <jan.kratochvil@redhat.com> PR compile/18484 * gdb.compile/compile.c (struct struct_type): Add volatile to selffield's type. * gdb.compile/compile.exp (compile code struct_object.selffield = &struct_object): Skip further struct_object tests if this one xfails.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2015-07-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
PR compile/18484
|
||||||
|
* compile/compile-c-types.c (insert_type): Change gdb_assert to error.
|
||||||
|
|
||||||
2015-07-08 Robert O'Callahan <robert@ocallahan.org>
|
2015-07-08 Robert O'Callahan <robert@ocallahan.org>
|
||||||
|
|
||||||
PR exp/18617
|
PR exp/18617
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ insert_type (struct compile_c_instance *context, struct type *type,
|
|||||||
add = *slot;
|
add = *slot;
|
||||||
/* The type might have already been inserted in order to handle
|
/* The type might have already been inserted in order to handle
|
||||||
recursive types. */
|
recursive types. */
|
||||||
gdb_assert (add == NULL || add->gcc_type == gcc_type);
|
if (add != NULL && add->gcc_type != gcc_type)
|
||||||
|
error (_("Unexpected type id from GCC, check you use recent enough GCC."));
|
||||||
|
|
||||||
if (add == NULL)
|
if (add == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
2015-07-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
PR compile/18484
|
||||||
|
* gdb.compile/compile.c (struct struct_type): Add volatile to
|
||||||
|
selffield's type.
|
||||||
|
* gdb.compile/compile.exp
|
||||||
|
(compile code struct_object.selffield = &struct_object): Skip further
|
||||||
|
struct_object tests if this one xfails.
|
||||||
|
|
||||||
2015-07-08 Robert O'Callahan <robert@ocallahan.org>
|
2015-07-08 Robert O'Callahan <robert@ocallahan.org>
|
||||||
|
|
||||||
PR exp/18617
|
PR exp/18617
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ struct struct_type {
|
|||||||
float floatfield;
|
float floatfield;
|
||||||
double doublefield;
|
double doublefield;
|
||||||
const union union_type *ptrfield;
|
const union union_type *ptrfield;
|
||||||
struct struct_type *selffield;
|
volatile struct struct_type *selffield;
|
||||||
int arrayfield[5];
|
int arrayfield[5];
|
||||||
_Complex double complexfield;
|
_Complex double complexfield;
|
||||||
_Bool boolfield;
|
_Bool boolfield;
|
||||||
|
|||||||
@@ -189,15 +189,23 @@ gdb_test "p localvar" " = 1"
|
|||||||
# Test setting fields and also many different types.
|
# Test setting fields and also many different types.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set skip_struct_object 0
|
||||||
set test "compile code struct_object.selffield = &struct_object"
|
set test "compile code struct_object.selffield = &struct_object"
|
||||||
gdb_test_multiple $test $test {
|
gdb_test_multiple $test $test {
|
||||||
-re "^$test\r\n$gdb_prompt $" {
|
-re "^$test\r\n$gdb_prompt $" {
|
||||||
pass "$test"
|
pass "$test"
|
||||||
}
|
}
|
||||||
-re "gdb command line:1:25: warning: assignment discards 'volatile' qualifier from pointer target type \\\[-Wdiscarded-qualifiers\\\]\r\n$gdb_prompt $" {
|
-re " error: Unexpected type id from GCC, check you use recent enough GCC\\.\r\n.*\r\n$gdb_prompt $" {
|
||||||
xfail "$test (PR compile/18202)"
|
xfail "$test (PR compile/18202)"
|
||||||
|
|
||||||
|
# All following tests will break with the same error message.
|
||||||
|
set skip_struct_object 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if {$skip_struct_object} {
|
||||||
|
untested "all struct_object tests"
|
||||||
|
} else {
|
||||||
gdb_test "print struct_object.selffield == &struct_object" " = 1"
|
gdb_test "print struct_object.selffield == &struct_object" " = 1"
|
||||||
|
|
||||||
gdb_test_no_output "compile code struct_object.charfield = 1"
|
gdb_test_no_output "compile code struct_object.charfield = 1"
|
||||||
@@ -235,6 +243,8 @@ gdb_test_no_output "compile code struct_object.vectorfield\[2\] = 7"
|
|||||||
gdb_test "print struct_object.vectorfield" \
|
gdb_test "print struct_object.vectorfield" \
|
||||||
" = \\{0, 0, 7, 0\\}"
|
" = \\{0, 0, 7, 0\\}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
gdb_test_no_output "compile code union_object.typedeffield = 7"
|
gdb_test_no_output "compile code union_object.typedeffield = 7"
|
||||||
gdb_test "print union_object.typedeffield" " = 7"
|
gdb_test "print union_object.typedeffield" " = 7"
|
||||||
gdb_test "print union_object.intfield" " = 7"
|
gdb_test "print union_object.intfield" " = 7"
|
||||||
|
|||||||
Reference in New Issue
Block a user