[PATCH v2] Add a trie to map quickly from address range to compilation unit.

Jan Beulich jbeulich@suse.com
Fri Apr 8 10:43:14 GMT 2022


On 08.04.2022 12:38, Alan Modra wrote:
> On Fri, Apr 08, 2022 at 10:05:55AM +0200, Jan Beulich via Binutils wrote:
>> On 04.04.2022 09:32, Steinar H. Gunderson via Binutils wrote:
>>> +  if (leaf != NULL)
>>> +    leaf->head.num_room_in_leaf = TRIE_LEAF_SIZE;
>>> +  return (struct trie_node *) leaf;
>>
>> Furthermore, with casts being somewhat risky in general (and there not
>> being more fine-grained C++-like casts in C), I think it would be better
>> to use &leaf->head in such cases.
> 
> Except that if leaf can be NULL then &leaf->head is undefined
> according to the C standard.  ubsan will complain.  I dislike casts
> too, but this is one annoying case where C requires one.

  if (leaf == NULL)
    return NULL;
  leaf->head.num_room_in_leaf = TRIE_LEAF_SIZE;
  return &leaf->head;

?

Jan



More information about the Binutils mailing list