tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Found Bug when compiling to memory ?!


From: jo gaspode
Subject: [Tinycc-devel] Found Bug when compiling to memory ?!
Date: Sun, 16 Nov 2003 13:37:37 +0000

Hello,

i'm not sure but there could be a bug in tinycc (tcc-0.9.20) when using the compile to memory feature
(linux and win32). I am trying to compile this program to memory:

int function1() { in2t compiler_should_print_error=0; }

so the compiler should see, that the type in2t is undefined.

When starting the following example program (compiled with gcc), only the first compile to memory is completed. On the second call the program exits at tcc_new() when trying to do the tcc_define_symbol(s, "__STDC__", NULL) function call.

Output of the example Program:

    before tcc_new()
    after tcc_new()
    <string>:1: 'in2t' undeclared
    EOCompile 1

    before tcc_new()
    :1: invalid macro name ''

It would be great if someone could have a look at this problem (haven't found the solution myself :( )

Thanks, Jo

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

#include <libtcc.h>

int main(int argc, char **argv)
{
   TCCState *s;
   int (*func)(int);
   unsigned long val;

   printf ("before tcc_new()\n");
   s = tcc_new();
   printf ("after tcc_new()\n");

   tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
tcc_compile_string(s, "int function1() { in2t compiler_should_print_error=0; }");
   tcc_delete(s);
   printf ("EOCompile 1\n\n");

   printf ("before tcc_new()\n");
   s = tcc_new();
   printf ("after tcc_new()\n");

   tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
tcc_compile_string(s, "int function2() { in2t compiler_should_print_error=0; }");
   tcc_delete(s);
   printf ("EOCompile 2\n\n");

   return 0;
}

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963





reply via email to

[Prev in Thread] Current Thread [Next in Thread]