[committed] Fix prop->const_val uses in gdbtypes.c

Message ID d17e07ac-a5e3-05bc-38d3-b441df1ddc46@suse.de
State New
Headers show
Series
  • [committed] Fix prop->const_val uses in gdbtypes.c
Related show

Commit Message

Tom de Vries Aug. 5, 2020, 10:33 a.m.
[ was: Re: [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR ]

On 8/5/20 11:20 AM, Tom de Vries wrote:
> On 8/2/20 1:59 AM, Simon Marchi via Gdb-patches wrote:

>> Remove TYPE_DYN_PROP_ADDR, replacing its uses with calling

>> dynamic_prop::const_val directly.

>>

>> gdb/ChangeLog:

>>

>> 	* gdbtypes.h (TYPE_DYN_PROP_ADDR): Remove, replace uses with

>> 	dynamic_prop::const_val.

>>

> 

> 

> This patch causes the following regression for me:

> ...

> FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b

> ...

> (and 185 more, all for fortran test-cases).

> 

>>    return (prop != nullptr && prop->kind () == PROP_CONST

>> -	  && !TYPE_DYN_PROP_ADDR (prop));

>> +	  && prop->const_val () != 0);

>>  }

>>

> 

> Hmm, isn't that supposed to be "== 0" ?


Committed patch that fixes the regressions.

Thanks,
- Tom

Comments

Christian Biesinger via Gdb-patches Aug. 5, 2020, 12:46 p.m. | #1
On 2020-08-05 6:33 a.m., Tom de Vries wrote:
> [ was: Re: [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR ]

> 

> On 8/5/20 11:20 AM, Tom de Vries wrote:

>> On 8/2/20 1:59 AM, Simon Marchi via Gdb-patches wrote:

>>> Remove TYPE_DYN_PROP_ADDR, replacing its uses with calling

>>> dynamic_prop::const_val directly.

>>>

>>> gdb/ChangeLog:

>>>

>>> 	* gdbtypes.h (TYPE_DYN_PROP_ADDR): Remove, replace uses with

>>> 	dynamic_prop::const_val.

>>>

>>

>>

>> This patch causes the following regression for me:

>> ...

>> FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b

>> ...

>> (and 185 more, all for fortran test-cases).

>>

>>>    return (prop != nullptr && prop->kind () == PROP_CONST

>>> -	  && !TYPE_DYN_PROP_ADDR (prop));

>>> +	  && prop->const_val () != 0);

>>>  }

>>>

>>

>> Hmm, isn't that supposed to be "== 0" ?

> 

> Committed patch that fixes the regressions.

> 

> Thanks,

> - Tom

> 


Arggh, thanks for fixing this.

Simon
Tom de Vries Aug. 5, 2020, 12:56 p.m. | #2
On 8/5/20 2:46 PM, Simon Marchi wrote:
> On 2020-08-05 6:33 a.m., Tom de Vries wrote:

>> [ was: Re: [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR ]

>>

>> On 8/5/20 11:20 AM, Tom de Vries wrote:

>>> On 8/2/20 1:59 AM, Simon Marchi via Gdb-patches wrote:

>>>> Remove TYPE_DYN_PROP_ADDR, replacing its uses with calling

>>>> dynamic_prop::const_val directly.

>>>>

>>>> gdb/ChangeLog:

>>>>

>>>> 	* gdbtypes.h (TYPE_DYN_PROP_ADDR): Remove, replace uses with

>>>> 	dynamic_prop::const_val.

>>>>

>>>

>>>

>>> This patch causes the following regression for me:

>>> ...

>>> FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b

>>> ...

>>> (and 185 more, all for fortran test-cases).

>>>

>>>>    return (prop != nullptr && prop->kind () == PROP_CONST

>>>> -	  && !TYPE_DYN_PROP_ADDR (prop));

>>>> +	  && prop->const_val () != 0);

>>>>  }

>>>>

>>>

>>> Hmm, isn't that supposed to be "== 0" ?

>>

>> Committed patch that fixes the regressions.

>>

>> Thanks,

>> - Tom

>>

> 

> Arggh, thanks for fixing this.


Np :)

Cheers,
- Tom

Patch

[gdb] Fix prop->const_val uses in gdbtypes.c

After commit 66d6346b25 "gdb: remove TYPE_DYN_PROP_ADDR", I run into:
...
FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b
...
(and 185 more FAILs, all for fortran test-cases).

The commit replaces "!x" by "x != 0".

Fix this by using "x == 0" instead.

Build and tested on x86_64-linux.

gdb/ChangeLog:

2020-08-05  Tom de Vries  <tdevries@suse.de>

	* gdbtypes.c (type_not_allocated, type_not_associated): Use
	"prop->const_val () == 0" instead of "prop->const_val () != 0".

---
 gdb/gdbtypes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 0cd4b194d9..da1c58c65c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4134,7 +4134,7 @@  type_not_allocated (const struct type *type)
   struct dynamic_prop *prop = TYPE_ALLOCATED_PROP (type);
 
   return (prop != nullptr && prop->kind () == PROP_CONST
-	  && prop->const_val () != 0);
+	  && prop->const_val () == 0);
 }
 
 /* Associated status of type TYPE.  Return zero if type TYPE is associated.
@@ -4146,7 +4146,7 @@  type_not_associated (const struct type *type)
   struct dynamic_prop *prop = TYPE_ASSOCIATED_PROP (type);
 
   return (prop != nullptr && prop->kind () == PROP_CONST
-	  && prop->const_val () != 0);
+	  && prop->const_val () == 0);
 }
 
 /* rank_one_type helper for when PARM's type code is TYPE_CODE_PTR.  */