On Sat, Nov 2, 2013 at 8:21 AM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > On 2 November 2013 13:20, Jonathan Wakely wrote: >> On 28 October 2013 18:22, Cyd Haselton <chaselton@xxxxxxxxx> wrote: >>> On Sun, Oct 27, 2013 at 6:36 PM, Cyd Haselton <chaselton@xxxxxxxxx> wrote: >>> >>> On Oct 27, 2013 6:36 PM, "Cyd Haselton" <chaselton@xxxxxxxxx> wrote: >>>> >>>> Android apparently doesn't support implicit conversion so had to do a >>>> cast before the argument is passed. >>>> >>>> I added >>>> >>>> off_t ot = (off_t) &file->st.st_size; >>>> >>>> before _cpp_convert_input, and passed &ot to argument 7 in _cpp_convert_input. >>>> >>> >>> UPDATE: The above modification allowed the build to complete but results in a >>> bad address error when resulting binaries are run on device. >>> Will revise and try again...and email gcc-bugs if necessary. >> >> Not surprising, that modification is utterly broken. You're casting >> the address of st_size to an off_t, when you should be using it's >> value, not its address. I realized this soon after I read a couple of pages of 'C in a Nutshell'. Unfortunately, and confusingly, this didn't help. >> >> You could try: >> >> off_t ot = file->st.st_size; >> Then pass &ot into the function and then: >> file->st.st_size; = ot; > > Without the first semi-colon in the line above, that was a copy'n'paste error. > Noted. I'll omit when adding I'm pretty sure I tried that...as well as other variants of the above with the same result: "bad address" errors thrown by the cc1 binary. However, since it was late and I was tired I'm also sure I made mistakes. I'll try the above again. >> >> But I have to wonder why Android's struct stat has the wrong type for >> the st_size member, is it not meant to be a POSIX conforming library? That is a question I have yet to figure out...in spite of hours spent parsing the headers and working my way through 'C in a Nutshell' As I mentioned in a previous response, st_size is defined as an off_t in one place, unsigned long in another, and long long everywhere else. I vaguely remember reading something about Android's libc and POSIX compliance in the bionic OVERVIEW.html included in the NDK, but I don't remember off the top of my head. Hopefully the answer is out there somewhere.