[erlang-bugs] Compile errors in beam/io.c on IRIX

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Fri Oct 29 15:21:51 CEST 2010


On Fri, Oct 29, 2010 at 2:50 PM, Patrick Baggett
<baggett.patrick@REDACTED> wrote:
> Here's another problem I found when compiling beam/io.c for IRIX.
> Since The OpenGroup defines the struct iovec::iov_base field to be a
> void*, it is illegal to perform pointer arithmetic on it. I'm really
> surprised this didn't show up in GCC or any other compiler.

Good catch!

> -----
> The implied goal here is to increment an address by a certain number
> of bytes, so casting to a char* as follows will allow the compile to
> succeed:
>
>            iov->iov_base = (char*)iov->iov_base + skip;
>

This change looks reasonable to me. I might be wrong, but I think this
is what GCC is doing: assuming that void* aritmetic are 1-byte
increments. If not, the code would probably not have worked as
expected. I like the explicit behaviour. If Tuncer Ayaz or one of the
Erlang/OTP devs does not change this into a topic branch, I'd happily
volunteer to make it a topic branch on github.

-- 
J.


More information about the erlang-bugs mailing list