It happened using binaries from
http://download.savannah.gnu.org/releases/tinycc/.

Tried also via libtcc and the same happened: on win32, it works fine; on
win64, a segfault happens. Here's the code:


#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "libtcc.h"

char my_program[] = "\n";

int main(int argc, char **argv)
{
    TCCState *s = tcc_new();
    tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
    tcc_compile_string(s, my_program);
    tcc_relocate(s, TCC_RELOCATE_AUTO); // <-- segfault here
    return 0;
}


2017-07-05 0:18 GMT-03:00 André Willik Valenti <[email protected]>:

> Hello,
>
> I believe I've found a bug. It happens on 64-bit version of tcc for
> Windows. No problems were found on 32-bit Windows or 64-bit Linux
> (installed from apt-get).
>
> To reproduce, run on a terminal:
>
> REM Creates an empty file
> type nul > empty.c
>
> REM win32 tcc works normally
> win32\tcc empty.c
> tcc: error: undefined symbol 'main'
>
> REM win32 tcc works normally
> win32\tcc -run empty.c
> tcc: error: main not defined
>
> REM win64 tcc works normally when generating file output
> win64\tcc empty.c
> tcc: error: undefined symbol 'main'
>
> REM ...but crashes with a segfault when running source code directly
> win64\tcc -run empty.c
>
>
> The same happens with a file containing just
>
> #
>
> or
>
> #inclu
>
>
> Regards,
> André
>
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to