[PATCH] D90708: [LangRef] Clarify GEP inbounds wrapping semantics

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 19:40:45 PST 2020


aqjune added a comment.

In D90708#2377237 <https://reviews.llvm.org/D90708#2377237>, @jrtc27 wrote:

> In D90708#2372698 <https://reviews.llvm.org/D90708#2372698>, @aqjune wrote:
>
>> It seems sbrk() assume an address space is unsigned:
>> https://code.woboq.org/userspace/glibc/misc/sbrk.c.html
>>
>> Since it is frequently used to implement malloc(), I guess malloc can in general return an allocation whose address is something like [0x7fffffff, 0x80000001]. Does this make sense?
>
> It's also an ancient deprecated interface, rather dodgy in terms of pointer provenance (sbrk returns the _old_ program break), and does not exist on some modern OS ports (notably, FreeBSD/arm64 and FreeBSD/riscv do not provide it). Whilst some best-of-1990s allocators that make use of it are still rather more pervasive than they should be, it really needs to be consigned to the history books...

Wow, thanks for the info! :) It seems the man page (https://www.freebsd.org/cgi/man.cgi?query=sbrk&sektion=2 ) is saying the same thing as well.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90708/new/

https://reviews.llvm.org/D90708



More information about the llvm-commits mailing list