aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
Commit message (Collapse)AuthorAgeFilesLines
* Add warning 4jiang2014-05-141-5/+29
| | | | | | | | num en{a1,a2,a3}; enum en ee; ee = 0xffffffffff; char a; a = 0xffff;
* Add warning 3jiang2014-05-141-0/+2
| | | | | | struct st {int a;} ss; int b; b = ss;
* clean '\t'jiang2014-05-141-3/+3
|
* restore 2dd8587c2f32d17a2cd0443a60a614a3fa9bbe29jiang2014-05-131-3/+3
|
* Modify tcc_error ("invalid type",);jiang2014-05-131-1/+1
|
* fix 14d0aa450f9a926a852ea01fbdecf27425264d14jiang2014-05-131-1/+1
|
* Add warning 2jiang2014-05-091-0/+2
| | | | | | | | | For example: struct A { int b: 16; int c: 16 }; sizeof (struct A);
* Add warningjiang2014-05-091-0/+2
| | | | | | | For example: struct A { int b []; };
* Return to: e20c1eb99e1003c1e59522c136dbb15c52d7cc7cjiang2014-05-041-480/+370
| | | | | | | | | | | | | | | | | | | | | | | 1: The new patch for the other machines still have the problem. 2: libcrt Rename (what if gcc had libcrt as well) 3: parse_number exact problem 4: VT_VLS is to allow tcc Compile the following int b = 9; struct st { int a; int b [b] }; struct st st1; st1.b [8] = 9; printf ("% d \ n", st1.b [8]); tcc a problem. Due to problems in front, and now can not be improved 5: they commit much, bug difficult to lock, you can not let other people help develop. 6: ('\ t') too Thanks to Michael and Ray Their criticism I have benefited!
* tcc on i386 are still having problems at work.Thank Roy report again. Struck ↵jiang2014-05-031-28/+7
| | | | on several variables can be connected to commit in the register. I am worried whether tcc can run the os. Since my machine is ubuntu 64 bits I can test my machine.
* forget commit tccge.c for i386jiang2014-05-031-1/+1
|
* Fix x86-64 vlajiang2014-05-021-172/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, it should look like this High stack ------------- ----- Func_ret_sub ------------ ---- Vla stack ------------- ---- Known loc -------------- Low Increased loc_stack () function is used for temporary stack management, call save_reg (), released by load () Like this Before use High ----- Known loc ---- --- ---- ---- Pop_stack Low loc_stack (size, 1) After use High ----- Known loc ---- Pop_stack --- ---- ---- Low
* Fixes include the double quotes bugjiang2014-05-021-3/+3
| | | | | Added push_macro, pop_macro support Fix pack bug, when output with-E will pack the bug
* gen_putz () and struct_copy (), is to reduce the third-party call thatjiang2014-05-021-23/+30
| | | | | | | generates faster code tcc Now only for x86-64 parse_number also to reduce the reliance on third-party libraries, allowing faster analysis tcc
* update for x86_64-gen.cjiang2014-05-011-24/+48
|
* cleanjiang2014-05-011-9/+0
|
* fix its own making bug. Improved init_putz (). Modify the tests / Makefile ↵jiang2014-05-011-4/+5
| | | | to make the test more secure
* Expansion code again for x86_64-genjiang2014-05-011-113/+73
|
* Fix va_arg bug, Fix type conversion bug, an increase of loc_stack () ↵jiang2014-04-301-72/+127
| | | | function is used to manage loc
* Restore eda2c756edc4dca004ba217d5bf361235dd9de1fjiang2014-04-301-33/+13
|
* Reduce the generation of machine code for x86_64, Less of sizejiang2014-04-291-1/+2
|
* Remove unused variableMichael Matz2014-04-141-1/+0
|
* Parse and emit hidden visibilityMichael Matz2014-04-141-3/+57
| | | | | | | This adds parsing of (GCC compatible) visibility attribute in order to mark selected global symbols as hidden. The generated .o files contain hidden symbols already, the TCC linker doesn't yet do the right thing.
* add missing prototypesUrs Janssen2014-04-101-4/+8
|
* Fix test for macro nestingThomas Preud'homme2014-04-071-0/+2
|
* Corrected spelling mistakes in comments and stringsVincent Lefevre2014-04-071-2/+2
|
* win32: warn people about using undeclared WINAPI functionsgrischka2014-04-061-4/+10
| | | | | | | | | | | *** UNCONDITIONALLY *** Esp. sihce tinycc winapi headers are not as complete as people might expect this can otherwise lead to obscure problems that are difficult to debug. (Originally 'warn_implicit_function_declaration' was set to 1 always for windows but someone must have deleted that line)
* tccgen: x86_64: fix garbage in the SValue upper bitsgrischka2014-04-041-21/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was going wrong (case TOK_LAND in unary: computed labels) - vset(&s->type, VT_CONST | VT_SYM, 0); - vtop->sym = s; This does the right thing and is shorter: + vpushsym(&s->type, s); Test case was: int main(int argc, char **argv) { int x; static void *label_return = &&lbl_return; printf("label_return = %p\n", label_return); goto *label_return; //<<<<< here segfault on linux X86_64 without the memset on vset printf("unreachable\n"); lbl_return: return 0; } Also:: - Rename "void* CValue.ptr" to more usable "addr_t ptr_offset" and start to use it in obvious cases. - use __attribute__ ((noreturn)) only with gnu compiler - Revert CValue memsets ("After several days searching ...") commit 4bc83ac3933efa565ae3326b55fcd711b63c073d Doesn't mean that the vsetX/vpush thingy isn't brittle and there still might be bugs as to differences in how the CValue union was set and is then interpreted later on. However the big memset hammer was just too slow (-3% overall).
* Allow local redefinition of enumeratorThomas Preud'homme2014-03-311-1/+1
|
* Fix typo in code added by b018bac9c8Thomas Preud'homme2014-03-291-1/+1
|
* Create bcheck region for argv and arge argumentThomas Preud'homme2014-03-291-0/+15
| | | | | | | | | | | For program manipulating argv or arge as pointer with construct such as: (while *argv++) { do_something_with_argv; } it is necessary to have argv and arge inside a region. This patch create regions argv and arge) if main is declared with those parameters.
* After several days searching why my code refactoring to remove globals was ↵mingodad2014-03-261-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | crashing, I found the problem it was because CValue stack variables have rubish as it inital values and assigning to a member that is smaller than the big union item and trying to recover it later as a different member gives bak garbage. ST_FUNC void vset(TCCState* tcc_state, CType *type, int r, int v) { CValue cval; memset(&cval, 0, sizeof(CValue)); cval.i = v; //,<<<<<<<<<<< here is the main bug that mix with garbage vsetc(tcc_state, type, r, &cval); } /* store a value or an expression directly in global data or in local array */ static void init_putv(TCCState* tcc_state, CType *type, Section *sec, unsigned long c, int v, int expr_type) { ... case VT_PTR: if (tcc_state->tccgen_vtop->r & VT_SYM) { greloc(tcc_state, sec, tcc_state->tccgen_vtop->sym, c, R_DATA_PTR); } //<<< on the next line is where we try to get the assigned value to cvalue.i as cvalue.ull *(addr_t *)ptr |= (tcc_state->tccgen_vtop->c.ull & bit_mask) << bit_pos; break; Also this patch makes vla tests pass on linux 32 bits
* Make parse_btype only accept one basic typeThomas Preud'homme2014-03-241-8/+15
| | | | | This makes int char c; and struct {} int c; generate an error. Thanks Mobi Phil for reporting.
* Fix type_to_str test for unsigned intThomas Preud'homme2014-03-091-1/+1
|
* Fix various errors uncovered by static analysisThomas Preud'homme2014-03-081-1/+0
| | | | Reported-by: Carlos Montiers <cmontiers@gmail.com>
* Def signedness != signed != unsigned for charThomas Preud'homme2014-02-061-13/+23
| | | | | | | | When checking for exact compatibility between types (such as in __builtin_types_compatible_p) consider the case of default signedness to be incompatible with both of the explicit signedness for char. That is, char is incompatible with signed char *and* unsigned char, no matter what the default signedness for char is.
* Fix parameter passing of long long bitfieldThomas Preud'homme2014-02-041-0/+3
|
* switch last 2 params of TOK_memset on ARMThomas Preud'homme2014-02-031-0/+5
| | | | | On ARM, TOK_memset is executed via __aeabi_memset which reverse the order of the last two parameters.
* Fix floating point unary minus and plusMichael Matz2014-01-121-17/+21
| | | | | | | negate(x) is subtract(-0,x), not subtract(+0,x), which makes a difference with signed zeros. Also +x was expressed as x+0, in order for the integer promotions to happen, but also mangles signed zeros, so just don't do that with floating types.
* Fix Fixes for PE x86_64 for fail in codeMichael Matz2014-01-111-27/+20
| | | | | | | Applying 64bit relocs assumes that the CVal is initialized to zero for the whole 64bit. Consolidate this a bit, at the same time zeroing the .ull member more consistently when needed. Fixes segfault on x86_64-linux using global vars in tcctest.c.
* Fixes previous fixesArchidemon2014-01-101-5/+5
|
* Fixes for PE x86_64 for fail in codeArchidemon2014-01-101-3/+15
| | | | | | | | | | | | int (*fn1)=0x13fde16b5; and int fn1(int a) {...} struct { int (*fn2)(int a); } b = { fn1 };
* be stricter with aliasinggrischka2014-01-071-47/+50
| | | | | | | | | | | | | | Refactoring (no logical changes): - use memcpy in tccgen.c:ieee_finite(double d) - use union to store attribute flags in Sym Makefile: "CFLAGS+=-fno-strict-aliasing" basically not necessary anymore but I left it for now because gcc sometimes behaves unexpectedly without. Also: - configure: back to mode 100755 - tcc.h: remove unused variables tdata/tbss_section - x86_64-gen.c: adjust gfunc_sret for prototype
* misc. fixesgrischka2014-01-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | - tccgen: error out for cast to void, as in void foo(void) { return 1; } This avoids an assertion failure in x86_64-gen.c, also. also fix tests2/03_struct.c accordingly - Error: "memory full" - be more specific - Makefiles: remove circular dependencies, lookup tcctest.c from VPATH - tcc.h: cleanup lib, include, crt and libgcc search paths" avoid duplication or trailing slashes with no CONFIG_MULTIARCHDIR (as from 9382d6f1a0e2d0104a82ed805207d9e742c6b068) - tcc.h: remove ";{B}" from PE search path in ce5e12c2f950052d8109b6b7a56d900547705c08 James Lyon wrote: "... I'm not sure this is the right way to fix this problem." And the answer is: No, please. (copying libtcc1.a for tests instead) - win32/build_tcc.bat: do not move away a versioned file
* Fix struct ret in variadic fct with ARM hardfloatThomas Preud'homme2014-01-061-3/+8
| | | | | | | | | | | | | The procedure calling standard for ARM architecture mandate the use of the base standard for variadic function. Therefore, hgen float aggregate must be returned via stack when greater than 4 bytes and via core registers else in case of variadic function. This patch improve gfunc_sret() to take into account whether the function is variadic or not and make use of gfunc_sret() return value to determine whether to pass a structure via stack in gfunc_prolog(). It also take advantage of knowing if a function is variadic or not move float result value from VFP register to core register in gfunc_epilog().
* Move logic for if (int value) to tccgen.cThomas Preud'homme2014-01-041-12/+32
| | | | | | | Move the logic to do a test of an integer value (ex if (0)) out of arch-specific code to tccgen.c to avoid code duplication. This also fixes test of long long value which was only testing the bottom half of such values on 32 bits architectures.
* Fix negation of 0.0 and -0.0Thomas Preud'homme2014-01-041-2/+15
|
* Fix "Add support for struct > 4B returned via registers"grischka2013-12-161-15/+28
| | | | | | | | | | | - avoid assumption "ret_align == register_size" which is false for non-arm targets - rename symbol "sret" to more descriptive "ret_nregs" This fixes commit dcec8673f21da86ae3dcf1ca3e9498127715b795 Also: - remove multiple definitions in win32/include/math.h
* Add support for struct > 4B returned via registersThomas Preud'homme2013-11-221-17/+29
| | | | | | | | On ARM with hardfloat calling convention, structure containing 4 fields or less of the same float type are returned via float registers. This means that a structure can be returned in up to 4 double registers in a structure is composed of 4 doubles. This commit adds support for return of structures in several registers.
* Revert "Add support for thread-local storage variables"Thomas Preud'homme2013-11-031-25/+4
| | | | | | | | | | TLS support in tinyCC is absolutely not ready: - segment register not select in load and store - no relocation added for computing offset of per-thread symbol - no support for TLS-specific relocations - no program header added as per Drepper document about TLS This reverts commit 1c4afd13501f07a673aed5f130166f2ee0f30927.