kripken/emscripten — Issue #146: feof does not work when using emcc
Author: l1am9111
Created: 2011-12-20 20:16:40+00:00
State: open

When using emcc, feof does not work. Using this code:

```c
int eof(FILE *file)
{
return feof(file);
}
```

When using emcc I get:

```javascript
function _eof($file) {
;
var __label__;

var $1;
$1=$file;
var $2=$1;
var $3=(($2+12)|0);
var $4=HEAP16[(($3)>>1)];
var $5=((($4) << 16) >> 16);
var $6=($5) & 32;
var $7=((($6))|0)!=0;
var $8=((($7))&1);
;
return $8;
}
```

But when using:

```
clang -emit-llvm -c eof.c
llvm-dis eof.o -show-annotations
~/emscripten/emscripten.py eof.o.ll -o eof.js
```

I get:

```javascript
function _eof($file) {
;
var __label__;

var $1;
$1=$file;
var $2=$1;
var $3=_feof($2);
;
return $3;
}
```

Which works.