diff options
author | Kavitha Natarajan <kavitha.natarajan@amd.com> | 2021-10-28 10:51:32 +0530 |
---|---|---|
committer | Kavitha Natarajan <kavitha.natarajan@amd.com> | 2021-10-28 10:51:32 +0530 |
commit | fed5a5acc523097a03d9e543cb3f968c5a542606 (patch) | |
tree | d8dbb1f97805578ee5a28e9b14c281ebf6827d4d /gdb | |
parent | 0a0ff9d931ea7b2f0bc3c7c9ef6029f3d08e5a90 (diff) | |
download | gdb-fed5a5acc523097a03d9e543cb3f968c5a542606.zip gdb-fed5a5acc523097a03d9e543cb3f968c5a542606.tar.gz gdb-fed5a5acc523097a03d9e543cb3f968c5a542606.tar.bz2 |
[gdb/testsuite] Initialize anonymous union in gdb.cp/koenig.cc
GDB test fails while running the test case gdb.cp/koenig.exp using
clang compiler:
[...]
p foo (p_union)
No symbol "p_union" in current context.
(gdb) FAIL: gdb.cp/koenig.exp: p foo (p_union)
[...]
In the testcase, "p_union" is an unused/uninitialized variable of
anonymous union type. Clang does not emit symbol for unused anonymous
union/struct variables at any optimization level. Since the compiler
itself is not emitting the symbol for "p_union", debug info is also
not emitted when built with debug option. If the anonymous union is
initialized (or used), then clang emits the symbol "p_union" which
enables emitting debug info for "p_union".
[...]
p foo (p_union)
Cannot resolve function foo to any overloaded instance
(gdb) PASS: gdb.cp/koenig.exp: p foo (p_union)
[...]
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.cp/koenig.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/koenig.cc b/gdb/testsuite/gdb.cp/koenig.cc index 01e2637..f7dd083 100644 --- a/gdb/testsuite/gdb.cp/koenig.cc +++ b/gdb/testsuite/gdb.cp/koenig.cc @@ -305,6 +305,8 @@ main () TTOA ttoa; foo (ttoa, 'a'); + p_union = {0}; + P::Q q; q == 5; q == 5.0f; |