This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, DWARF] Ignore address spaces for get_nearest_type_subqualifiers


On 8/6/19 1:58 AM, SenthilKumar.Selvaraj@microchip.com wrote:
> Hi,
> 
>   r254484 explicitly added previously ignored address space 
>   qualifiers, when
>   emitting DWARF dies for types.
> 
>   Adding address spaces to cv_qual_mask, however, breaks
>   nearest_type_subqualifier, which uses the number of bits set 
>   (i.e
>   popcount_hwi) to find the type variant that has the largest 
>   strict subset of a
>   given type's qualifiers. Address spaces are simply represented 
>   as 16 bits, and
>   therefore the number of set bits there has no relevance when 
>   finding
>   nearest_type_subqualifier. This also causes 
>   gcc.target/avr/pr52472.c to ICE.
> 
>   This patch fixes that by excluding address space quals from 
>   cv_qual_mask.
>   Bootstrap and reg test for x86_64-linux in progress. Ok to 
>   commit to trunk
>   if the tests pass?
> 
> Regards
> Senthil
> 
> gcc/ChangeLog:
> 
> 2019-08-06  Senthil Kumar Selvaraj 
> <senthilkumar.selvaraj@microchip.com>
> 
> 	* dwarf2out.c (modified_type_die): CLEAR_QUAL_ADDR_SPACE from
>     cv_qual_mask before calling get_nearest_type_subqualifiers.
> 
> 
> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index aa7fd7eb465..157c970d729 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -13295,8 +13295,9 @@ modified_type_die (tree type, int 
> cv_quals, bool reverse,
>        /* Determine a lesser qualified type that most closely 
>        matches
>  	 this one.  Then generate DW_TAG_* entries for the remaining
>  	 qualifiers.  */
> +      int nearest_qual_mask = CLEAR_QUAL_ADDR_SPACE 
> (cv_qual_mask);
>        sub_quals = get_nearest_type_subqualifiers (type, cv_quals,
> -						  cv_qual_mask);
> +						  nearest_qual_mask);
>        if (sub_quals && use_debug_types)
>  	{
>  	  bool needed = false;
Is there some reason we couldn't initialize nearest_qual_mask in the
same place we initialize cv_qual_mask and just not include the address
space qualifiers?  ie something like this:

  const int cv_qual_mask = (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE
                            | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC |
                            ENCODE_QUAL_ADDR_SPACE(~0U));
  const int nearest_qual_mask = (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE
			        | TYPE_QUAL_RESTRICT | TYPE_QUAL_ATOMIC);


I realize your approach would handle any qualifier outside of the
address space bits.  But it may be better in this code to be explicit
about what we handle and what we don't.

Thoughts?

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]