aboutsummaryrefslogtreecommitdiff
path: root/tests/tcctest.c
Commit message (Collapse)AuthorAgeFilesLines
* Add ARM aeabi functions needed to run tcctestThomas Preud'homme2013-12-111-0/+67
| | | | | | | | | | | | Add implementation for float / integer conversion functions: __aeabi_d2lz, __aeabi_d2ulz, __aeabi_f2lz, __aeabi_f2ulz, __aeabi_l2d, __aeabi_l2f, __aeabi_ul2d, __aeabi_ul2f Add implementation for long long helper functions: __aeabi_ldivmod, __aeabi_uldivmod, __aeabi_llsl, __aeabi_llsr, __aeabi_lasr Add implementation for integer division functions: __aeabi_uidiv, __aeabi_uidivmod, __aeabi_idiv, __aeabi_idivmod,
* Fixed silly error in Windows build of tests (abitest-cc not linking to libtcc)James Lyon2013-04-261-30/+32
| | | | | | | | I really should do this when less tired; I keep breaking one platform while fixing another. I've also fixed some Windows issues with tcctest since Windows printf() uses different format flags to those on Linux, and removed some conditional compilation tests in tcctest since they now should work.
* Fixed tests on Windows (including out-of-tree problems)James Lyon2013-04-171-16/+31
| | | | | | | | | | | Modified tcctest.c so that it uses 'double' in place of 'long double' with MinGW since this is what TCC does, and what Visual C++ does. Added an option -norunsrc to tcc to allow argv[0] to be set independently of the compiled source when using tcc -run, which allows tests that rely on the value of argv[0] to work in out-of-tree builds. Also added Makefile rules to automatically update out-of-tree build Makefiles when in-tree Makefiles have changed.
* tests: cleanupgrischka2013-02-051-1/+4
| | | | | | | | | | | | | | | | tests: - add "hello" to test first basic compilation to file/memory - add "more" test (tests2 suite) - remove some tests tests2: - move into tests dir - Convert some files from DOS to unix LF - remove 2>&1 redirection win32: - tccrun.c: modify exception filter to exit correctly (needed for btest) - tcctest.c: exclude weak_test() (feature does not exist on win32)
* Don't do builtin_frame_address test with ARM gccThomas Preud'homme2013-01-261-0/+2
| | | | | | | | gcc fails the builtin_frame_address test on ARM so we disable it. As a consequence, the diff between gcc and tcc's output is unecessarily bigger. Given the big size of the diff currently, this doesn't make a big difference but may allow to detect a regression in tcc's implementation of builtin_frame_address.
* Stop returning 0 in cmp_comparison_testThomas Preud'homme2013-01-061-1/+0
| | | | cmp_comparison_test has no return value and should thus not return 0.
* Add support for __builtin_frame_address(level)Kirill Smelkov2012-11-161-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuing d6072d37 (Add __builtin_frame_address(0)) implement __builtin_frame_address for levels greater than zero, in order for tinycc to be able to compile its own lib/bcheck.c after cffb7af9 (lib/bcheck: Prevent __bound_local_new / __bound_local_delete from being miscompiled). I'm new to the internals, and used the most simple way to do it. Generated code is not very good for levels >= 2, compare gcc tcc level=0 mov %ebp,%eax lea 0x0(%ebp),%eax level=1 mov 0x0(%ebp),%eax mov 0x0(%ebp),%eax level=2 mov 0x0(%ebp),%eax mov 0x0(%ebp),%eax mov (%eax),%eax mov %eax,-0x10(%ebp) mov -0x10(%ebp),%eax mov (%eax),%eax level=3 mov 0x0(%ebp),%eax mov 0x0(%ebp),%eax mov (%eax),%eax mov (%eax),%ecx mov (%eax),%eax mov (%ecx),%eax But this is still an improvement and for bcheck we need level=1 for which the code is good. For the tests I had to force gcc use -O0 to not inline the functions. And -fno-omit-frame-pointer just in case. If someone knows how to improve the generated code - help is appreciated. Thanks, Kirill Cc: Michael Matz <matz@suse.de> Cc: Shinichiro Hamaji <shinichiro.hamaji@gmail.com>
* Disable callsave_test for armThomas Preud'homme2012-07-301-0/+2
| | | | | Disable callsave_test for arm since it uses alloca which is unavailable on this platform.
* x86-64: Fix call saved register restoreMichael Matz2012-06-101-0/+20
| | | | | | Loads of VT_LLOCAL values (which effectively represent saved addresses of lvalues) were done in VT_INT type, loosing the upper 32 bits. Needs to be done in VT_PTR type.
* x86_64: Fix compares with NaNs.Michael Matz2012-05-131-0/+66
| | | | | | Comparisons with unordered doubles was broken, NaNs always compare unequal (and unordered) to everything, including to itself.
* Fix comparing comparisonsMichael Matz2012-04-181-0/+30
| | | | | | | | | | | Sometimes the result of a comparison is not directly used in a jump, but in arithmetic or further comparisons. If those further things do a vswap() with the VT_CMP as current top, and then generate instructions for the new top, this most probably destroys the flags (e.g. if it's a bitfield load like in the example). vswap() must do the same like vsetc() and not allow VT_CMP vtops to be moved down.
* Make sizeof() be of type size_tMichael Matz2012-04-181-0/+16
| | | | | | | | This matters when sizeof is directly used in arithmetic, ala "uintptr_t t; t &= -sizeof(long)" (for alignment). When sizeof isn't size_t (as it's specified to be) this masking will truncate the high bits of the uintptr_t object (if uintptr_t is larger than uint).
* Fix parsing function macro invocationsMichael Matz2012-04-181-0/+4
| | | | | | If a function macro name is separated from the parentheses in an macro invocation the substitution doesn't take place. Fix this by handling comments.
* Fix detection of labels with a typedef nameMichael Matz2012-04-181-0/+3
| | | | | | | | | | | | | | This needs to be accepted: typedef int foo; void f (void) { foo: return; } namespaces for labels and types are different. The problem is that the block parser always tries to find a decl first and that routine doesn't peek enough to detect this case. Needs some adjustments to unget_tok() so that we can call it even when we already called it once, but next() didn't come around restoring the buffer yet. (It lazily does so not when the buffer becomes empty, but rather when the next call detects that the buffer is empty, i.e. it requires two next() calls until the unget buffer gets switched back).
* x86_64: Fix segfault for global dataMichael Matz2012-04-181-0/+30
| | | | | | | | | | | When offsetted addresses of global non-static data are computed multiple times in the same statement the x86_64 backend uses gen_gotpcrel with offset, which implements an add insn on the register given. load() uses the R member of the to-be-loaded value, which doesn't yet have a reg assigned in all cases. So use the register we're supposed to load the value into as that register.
* x86_64: Fix indirection in struct paramatersMichael Matz2012-04-181-12/+17
| | | | | | | | | | | | | The first loop setting up struct arguments must not remove elements from the vstack (via vtop--), as gen_reg needs them to potentially evict some argument still held in registers to stack. Swapping the arg in question to top (and back to its place) also simplifies the vstore call itself, as not funny save/restore or some "non-existing" stack elements need to be done. Generally for a stack a vop-- operation conceptually clobbers that element, so further references to it aren't allowed anymore.
* Fix bitfield loads into char/short.Michael Matz2012-04-181-0/+5
| | | | | | Removes a premature optimization of char/short loads rewriting the source type. It did so also for bitfield loads, thereby removing all the shifts/maskings.
* Fix conversion in a?0:ptr.Michael Matz2012-04-181-0/+13
| | | | | | (cond ? 0 : ptr)->member wasn't handled correctly. If one arm is a null pointer constant (which also can be a pointer) the result type is that of the other arm.
* tcctest: switch weak_toolate proto with implgrischka2011-08-061-1/+1
| | | | gcc -O0 didn't like this.
* re-added negative-array-size testcase and fixed fix for itJoe Soroka2011-07-221-0/+2
|
* Revert "better constant handling for expr_cond"grischka2011-07-161-2/+0
| | | | | It produced wrong code with one of my test projects. This reverts commit cd3d1a45f34be3c9a358f1743bcaf8aac897992e.
* Fix array_test: move params to local varsThomas Preud'homme2011-07-121-2/+2
| | | | | | | | | | array_test is declared and called with no parameters but defined with one parameter. Compilation succeed (definition is after the use so the compiler consider the declaration) as well as link (the function exist and has the right name) but running the test segfault on i386 platforms. This patch moves the parameter to local variable. If the intention was to call it with an array parameter then feel free to fix it again.
* handle arrays with a flexible member but no initializerJoe Soroka2011-07-111-1/+3
|
* better constant handling for expr_condJoe Soroka2011-07-111-0/+2
|
* fix self-referential token pastingJoe Soroka2011-07-081-0/+6
|
* fix end-of-scope for self-referential macrosJoe Soroka2011-07-081-2/+1
|
* VLA fix [1/3]: added testcase demonstrating VLA bugJoe Soroka2011-04-081-1/+6
|
* VLA bcheck works via bound alloca; add test, remove warningJoe Soroka2011-04-061-1/+33
|
* re-apply VLA by Thomas Preud'hommeJoe Soroka2011-04-061-0/+22
|
* sizeof(struct with "flexible array member") is wrongJoe Soroka2011-03-181-0/+1
|
* fix c99 for-loop init decl scope (thanks: grischka)Joe Soroka2011-03-081-0/+2
| | | | see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00005.html
* support c99 for-loop init declsJoe Soroka2011-03-071-0/+4
|
* use new weaken_symbol() to fix another real-world corner caseJoe Soroka2011-03-071-0/+3
|
* weak redefinition of a symbol should weaken the originalJoe Soroka2011-03-071-0/+4
|
* __typeof(t) should not include storage modifiers of tJoe Soroka2011-03-061-0/+5
|
* handle post-asm-label attributes on variablesJoe Soroka2011-03-031-0/+14
|
* tcc: fix weak attribute handlingJoe Soroka2011-03-021-0/+8
|
* fix warning for tcctest.c introduced with my last commitJaroslav Kysela2011-02-221-1/+1
|
* fix another static struct init issue (arrays with unknown size at end)Jaroslav Kysela2011-02-221-26/+43
|
* Fix complex static initializers (handle additional '}' and '{' brackets)Jaroslav Kysela2011-02-221-0/+26
| | | | | | - added an example to test suite - the "warning: assignment discards qualifiers from pointer target type" is present but harmless
* Revert "Implement C99 Variable Length Arrays"Thomas Preud'homme2011-02-051-22/+0
| | | | This reverts commit a5a50eaafeea0d3ca47bc8fb6baf983743470c60.
* Revert "Disable C99 VLA when alloca is unavailable."Thomas Preud'homme2011-02-051-2/+2
| | | | This reverts commit e3e5d4ad7a475e30ea13ad1ba9f23e6210d5d431.
* Disable C99 VLA when alloca is unavailable.Thomas Preud'homme2011-02-041-2/+2
| | | | | | | | | | | | | | | * Disable C99 VLA detection when alloca is unavailable and protect the new reference to TOK_alloca in decl_initializer in order to compile and run for architecture without working alloca. Not all code of C99 VLA is commented as it would required many ifdef stanza. Just the detection is commented so that VT_VLA is never set any type and the C99 VLA code is compiled but never called. However vpush_global_sym(&func_old_type, TOK_alloca) in decl_initializer needs to be protected by an ifdef stanza as well because it uses TOK_alloca. * include alloca and C99 VLA tests according to availability of TOK_alloca instead of relying on the current architecture
* Implement C99 Variable Length ArraysThomas Preud'homme2011-02-041-0/+22
| | | | | | | Implement C99 Variable Length Arrays in tinycc: - Support VLA with multiple level (nested vla) - Update documentation with regards to VT_VLA - Add a testsuite in tcctest.c
* tcctest: plugged memleak (was polluting valgrind reports)Joe Soroka2011-02-011-0/+1
|
* tccasm: allow one-line prefix+op things like "rep stosb"Joe Soroka2011-02-011-0/+43
|
* tccpp: fix bug in handling of recursive macrosJoe Soroka2011-02-011-0/+31
|
* weak definitions overrule non-weak prototypesJoe Soroka2011-02-011-0/+6
|
* support weak attribute on variablesJoe Soroka2011-02-011-0/+18
|
* Support struct arguments with stdarg.hShinichiro Hamaji2010-12-281-0/+23
| | | | | | | | - add __builtin_va_arg_types to check how arguments were passed - move most code of stdarg into libtcc1.c - remove __builtin_malloc and __builtin_free - add a test case based on the bug report (http://www.mail-archive.com/tinycc-devel@nongnu.org/msg03036.html)