Ok, to try and work out why it might be segfaulting I reviewed the code. I still can't get it to segfault and there are some parts of the code that I don't yet understand. Since I reviewed it I may as well offer some observations that I made, but apart from the seemingly uninitalised variable previously mentioned these observations would not cause a segfault and are not "errors" per se, but merely things I found odd or interesting.
next.c
Code:
int fu16nextc( FILE *file, char8_t *c, size_t leng ) {
int ret = open_std_encodings(); /* line 172 */
ret is assigned the result of open_std_encodings() and then there's a few more lines, none of which seem to use 'ret', and then on line 177 there is 'ret = ERANGE', so I'm unsure what line 172 (the initial assignment to ret) is for. There is a similar thing done on line 208:
Code:
int fu32nextc( FILE *file, char8_t *c, size_t leng ) {
int ret = open_std_encodings(); /* line 208 */
// ...
ret = ERANGE; /* line 212 */
char.c
Code:
if ( sizeof(char32_t) & 1 ) abort(); /* line 254 */
What does line 254 of char.c do? I am guessing it's making sure that sizeof(char32_t) is an even number but I don't know why. The C standard (section 7.28) says that it's the same as uint_least32_t so I guess it's possible that the type has an odd number of "bytes" but why would that matter? Dunno.