Compile errors in beam/io.c on IRIX

Patrick Baggett baggett.patrick@REDACTED
Fri Oct 29 14:50:24 CEST 2010


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.

Specifically, I get these errors.

cc-3316 c99: ERROR File = beam/io.c, Line = 3343
  The expression must be a pointer to a complete object type.
            iov->iov_base += skip;
            ^

cc-3316 c99: ERROR File = beam/io.c, Line = 3795
  The expression must be a pointer to a complete object type.
            iov->iov_base += skip;
            ^

cc-3316 c99: ERROR File = beam/io.c, Line = 3858
  The expression must be a pointer to a complete object type.
            iov->iov_base += skip;
            ^

cc-3316 c99: ERROR File = beam/io.c, Line = 3918
  The expression must be a pointer to a complete object type.
            q->v_head->iov_base += size;

-----
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;


[I had sent a message a long time ago <sys/uio.h> not being
functional, but I was mistaken. Fortunately, it looks like nobody
implemented what I said, so there isn't anything to revert.]


More information about the erlang-bugs mailing list