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

Alan Modra amodra@gmail.com
Fri Apr 8 10:38:53 GMT 2022


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.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list