[Tinycc-devel] sleep() interprets argument as milliseconds instead of seconds

2016-11-29 Thread Hernán J . González
The POSIX sleep()  function ( ) should interpret is input
argument as seconds.
TinyC seems to interpret it as milliseconds.

Using tcc version 0.9.26

/***/
#include
#include 
int main() {
  int i;
  fputs("Looping ...\n",stdout);
  for(i=0;i<10;i++) {
fputs(".",stdout);
fflush(stdout);
sleep(3); // seconds?
  }
  return 0;
}
/***/

Expected behaviour: This should print a dot at 3 seconds interval, the loop
should take 30 seconds.
Result: The 10 dots are printed and the loop ends  almost instanteously.
Expected behaviour is attained when replacing '3' by '3000'
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] crash with simple bad macro

2015-09-14 Thread Hernán J . González
The following crashes tcc 0.9.26 :

/**/
typedef struct X { int len; } X;

#define init(s,len)  s.len = len;

int main(void) {
   X myX;
   init(myX,10);
   return 0;
}
/**/

Of course, the macro is wrong, because it uses the same field name of the
struct
as a placeholder id, hence the statement in main turns into
   myX.10 = 10 ;
instead of
   myX.len = 10 ;
as desired.

The issue, of course, is that the compiler should not crash.
gcc (3.4.5 in mingw) outputs: "error: syntax error before numeric constant"

Strangely, if I directly writes "myX.10 = 10 ;" in the main body, tcc does
not crash,
but the error message is quite strange:

" error: ';' expected (got "└")"




-- 
Hernán J. González
Buenos Aires, Argentina
hjg.com...@gmail.com
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] An issue with literal floats

2015-02-25 Thread Hernán J . González
I don't understand how this happens.

Notice that this is not an issue about floating point rounding, both
assignments (t2a t2b) should be exactly equivalent, but they are not.

//
#includestdio.h
int main() {
int t1 = 176401255;
float f = 0.25f;
int t2a = (int)(t1 * f);
int t2b = (int)(t1 * (float)0.25f);
printf(t2a=%d t2b=%d \n,t2a,t2b);
return 0;
}
//

prints

t2a=44100313 t2b=44100312

Using tcc version 0.9.26 (i386 Win32)


-- 
Hernán J. González




-- 
Hernán J. González
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] new compiler (0.9.26) crashes with undeclared struct

2013-07-23 Thread Hernán J . González
Example:



#includestdio.h
int main() {
struct asdasd x;
printf(%d\n, sizeof(x));
}



This should fail cleanly at compile, and it does in 0.9.25 ( unknown type
size)

In my version (tcc version 0.9.26 (i386 Win32)) in Win7-64 it crashes.

I was hit by this, not by mispelling a struct but because my code was
trying to use a struct from malloc.h (mallinfo) that is not declared in TCC
(which is right, that's a GCC thing)

---
Hernán
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] new tiny_libmaker.exe does not perform * expansion

2013-03-21 Thread Hernán J . González
The new version (0.9.26) tiny_libmaker.exe  does not perform expansion
as old version did:

compilers\tccold\tiny_libmaker.exe rc x.a *.o
lib1.o:
lib2.o:
lib3.o:

compilers\tccnew\tiny_libmaker.exe rc x.a *.o
Can't open file *.o

Not a big deal, but I wonder if this is intended behaviour?

 Hernán

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] unistd.h in new version

2013-03-19 Thread Hernán J . González
The new version (0.9.26) does not include the include/unistd.h file,
only include/sys/unistd.h
I know I can simply copy it (I've already done it) but I wonder if the
change was intentional,
I believe unistd.h is more standard than sys/unistd.h, and this
could break many compilations.

Hernán

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel