This issue exists only in 0.9.25 version (
http://download.savannah.nongnu.org/releases/tinycc/0.9.25.tar.bz2)
I've installed tcc from git (git://repo.or.cz/tinycc.git) and this bug
dissapeared
Thanks!


2013/1/28 Андрей Аладьев <[email protected]>

> test.c
>
> #define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
>
> void read_file ( FILE * file ) {
>     size_t  len = 0;
>     char *  line = NULL;
>     ssize_t bytes_read;
>     while ( ( bytes_read = getline ( &line, &len, file ) ) != -1 ) {
>         printf ( "%s", line );
>     }
>     free ( line );
> }
> int main ( void ) {
>     FILE *  file;
>     file = fopen ( "/etc/fstab", "r" );
>     read_file ( file );
>     fclose ( file );
>     return 0;
> }
>
> tcc -run test.c
> # /etc/fstab: static file system information.
> Segmentation fault
>
> Then swap lines from:
> size_t  len = 0;
> char *  line = NULL;
> to:
> char *  line = NULL;
> size_t  len = 0;
>
> tcc -run test.c
> # /etc/fstab: static file system information.
> #
> # noatime turns off ...
>
> So this swap fixed the problem. It is real magick
>
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to