RFA: Fix assertion on replace_types()

Message ID 87eg812zps.fsf@redhat.com
State New, archived
Headers

Commit Message

Nick Clifton June 13, 2016, 9:41 a.m. UTC
  Hi Guys,

  Compiling GDB with gcc version 6.1.1 from the about to be released
  Fedora 24 produces a warning/error about a redundant comparison in
  gdbtypes.c:replace_types().  The fix appears obvious to me, but since
  I am not a regular contributor, I thought that I had better check here
  first.

  OK to apply ?
  
Cheers
  Nick

gdb/ChangeLog
2016-06-13  Nick Clifton  <nickc@redhat.com>

	* gdbtypes.c (replace_type): Fix assertion.
  

Comments

Yao Qi June 13, 2016, 10:21 a.m. UTC | #1
On Mon, Jun 13, 2016 at 10:41 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi Guys,
>
>   Compiling GDB with gcc version 6.1.1 from the about to be released
>   Fedora 24 produces a warning/error about a redundant comparison in
>   gdbtypes.c:replace_types().  The fix appears obvious to me, but since
>   I am not a regular contributor, I thought that I had better check here
>   first.
>
>   OK to apply ?

Yes, it is OK.  The comments say two types should be in the same objfile,
so your fix is right to me.
  

Patch

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 48f2cd3..0421cc5 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -756,7 +756,7 @@  replace_type (struct type *ntype, struct type *type)
      the assignment of one type's main type structure to the other
      will produce a type with references to objects (names; field
      lists; etc.) allocated on an objfile other than its own.  */
-  gdb_assert (TYPE_OBJFILE (ntype) == TYPE_OBJFILE (ntype));
+  gdb_assert (TYPE_OBJFILE (ntype) == TYPE_OBJFILE (type));
 
   *TYPE_MAIN_TYPE (ntype) = *TYPE_MAIN_TYPE (type);