aboutsummaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix test for __*LP*__ predefined macrosChristian Jullien2016-09-251-11/+11
|
* Add test for __*LP*__ predefined macrosChristian Jullien2016-09-252-0/+39
|
* win64: fix va_arggrischka2016-07-101-0/+9
| | | | | | | | | | | fixes 5c35ba66c5ade4713bbd9c005e66889f6d7db293 Implementation was consistent within tcc but incompatible with the ABI (for example library functions vprintf etc) Also: - tccpp.c/get_tok_str() : avoid "unknown format "%llu" warning - x86_64_gen.c/gen_vla_alloc() : fix vstack leak
* x86-asm: Reject some invalid arith imm8 instructionMichael Matz2016-05-161-0/+16
| | | | | | | There were two errors in the arithmetic imm8 instruction. They accept only REGW, and in case the user write a xxxb opcode that variant needs to be rejected as well (it's not automatically rejected by REGW in case the destination is memory).
* x86-asm: Add .fill testMichael Matz2016-05-141-0/+1
|
* x86-asm: Fix signed constants and opcode orderMichael Matz2016-05-141-0/+7
| | | | | | | | Two things: negative constants were rejected (e.g. "add $-15,%eax"). Second the insn order was such that the arithmetic IM8S forms weren't used (always the IM32 ones). Switching them prefers those but requires a fix for size calculation in case the opcodes were OPC_ARITH and OPC_WLX (whose size starts with 1, not zero).
* x86-64-asm: Add mov[sz]xq opcodesMichael Matz2016-05-121-0/+7
| | | | This adds the zero/sign-extending opcodes with 64bit destinations.
* x86-64-asm: Clean up 64bit immediate supportMichael Matz2016-05-111-0/+10
| | | | | | | | | Fix it to actually be able to parse 64bit immediates (enlarge operand value type). Then, generally there's no need for accepting IM64 anywhere, except in the 0xba+r mov opcodes, so OP_IM is unnecessary, as is OPT_IMNO64. Improve the generated code a bit by preferring the 0xc7 opcode for im32->reg64, instead of the im64->reg64 form (which we therefore hardcode).
* x86-64: Run asmtest as wellMichael Matz2016-05-111-13/+27
| | | | | This fixes and activates the asm test that's part of tcctest.c also on x86-64, requiring a small fix for the 'm' constraint.
* tests: Compile asmtest.S without -m32Michael Matz2016-05-111-1/+1
| | | | | Don't hardcode that option, if you want it do make CC="gcc -m32". The test assembles with -m64 as well now.
* x86-64 asm: Remove useless jmp opcodeMichael Matz2016-05-111-0/+1
| | | | | Also remove the hacky mod/rm byte emission during disp/imm writing.
* x86: Improve cmov handlingMichael Matz2016-05-111-0/+4
| | | | | cmov can accept multi sizes, but is also a OPC_TEST opcode, deal with this.
* [x86] Fix some asm problemsMichael Matz2016-05-091-8/+67
| | | | | | | | | | | A bag of assembler fixes, to be either compatible with GAS (e.g. order of 'test' operands), accept more instructions, count correct foo{bwlq} variants on x86_64, fix modrm/sib bytes on x86_64 to not use %rip relative addressing mode, to not use invalid insns in tests/asmtest.S for x86_64. Result is that now output of GAS and of tcc on tests/asmtest.S is mostly the same.
* Insert spaces between certain tokens when tcc is invoked with -E.Edmund Grimley Evans2016-05-092-0/+25
| | | | | | Insert a space when it is required to prevent mistokenisation of the output, and also in a few cases where it is not strictly required, imitating GCC's behaviour.
* tccgen: scopes levels for local symbols (update 2)grischka2016-05-062-6/+7
| | | | | | | allow typedef int xxx; typedef int xxx; in the same scope as long as it is the same type
* tccgen: scopes levels for local symbols (update 1)grischka2016-05-051-0/+2
| | | | | | | Catch top level redeclarations too. Also fix mistakes in tcctest.c and the tcc sources (win32) showing up now.
* tests/tests2/Makefile: Make 85-asm-outside-function Intel-only.Edmund Grimley Evans2016-05-041-0/+3
|
* __asm__() outside functionseyko2016-05-012-0/+7
| | | | | | | | gcc/pcc allow __asm__() outside a function body: extern void vide(void); __asm__("vide: ret"); There is many such code in the Linux kernels.
* output space after TOK_PPNUM which followed by '+' or '-'seyko2016-05-018-5/+65
| | | | | | * correct -E output for the case ++ + ++ concatenation do this only for expanded from macro string and only when tcc_state->output_type == TCC_OUTPUT_PREPROCESS
* Run testcases in sorted orderMichael Matz2016-04-221-1/+1
| | | | | Without sorting they run in whatever order readdir returns, I like it better when the order is reliable (and alphanumeric).
* Revert "Fix tests Makefiles on Windows"Vlad Vissoultchev2016-04-173-14/+2
| | | | This reverts commit fa2472c17246206ce6947475782de17245eceeea.
* fix preprocessing *.S with ` ' chars in #commentsseyko2016-04-142-0/+12
| | | | | with a test program. Problem detected when trying to compile linux-2.4.37.9 with tcc.
* tccgen.c: Allow type attributes to prefix enum/struct/union nameVlad Vissoultchev2016-04-062-0/+14
| | | | | | From gcc docs: "You may also specify attributes between the enum, struct or union tag and the name of the type rather than after the closing brace." Adds `82_attribs_position.c` in `tests/tests2`
* utf8 in identifiersseyko2016-04-052-0/+11
| | | | | | | | | | | | | | made like in pcc (pcc.ludd.ltu.se/ftp/pub/pcc-docs/pcc-utf8-ver3.pdf) We treat all chars with high bit set as alphabetic. This allow code like #include <stdio.h> int Lefèvre=2; int main() { printf("Lefèvre=%d\n",Lefèvre); return 0; }
* nocode_wanted with while/for inside ({})seyko2016-04-052-0/+90
| | | | a test included.
* Identifiers can start and/or contain '.' in *.Sseyko2016-04-054-2/+26
| | | | | | | | | | | | | | | | | modified version of the old one which don't allow '.' in #define Identifiers. This allow correctly preprocess the following code in *.S #define SRC(y...) \ 9999: y; \ .section __ex_table, "a"; \ .long 9999b, 6001f ; \ // .previous SRC(1: movw (%esi), %bx) 6001: A test included.
* Fix assignment to/from volatile typesMichael Matz2016-03-261-0/+11
| | | | | | | | | Code like this was broken: char volatile vi = i; See testcase, happens in ideosyncratic legacy code sprinkling volatile all over.
* Fix tokenization of TOK_DOTSMichael Matz2016-03-241-0/+5
| | | | | We really need to use PEEKC during tokenization so as to skip line continuations automatically.
* Fix type parsingMichael Matz2016-03-243-1/+10
| | | | | | the check on incomplete struct/union/enum types was too early, disallowing mixed specifiers and qualifiers. Simply rely on the size (->c) field for that. See testcases.
* Fix tests Makefiles on WindowsVlad Vissoultchev2016-03-143-2/+14
| | | | Compiled tcc.exe location is under $(top_srcdir)/win32
* tccgen.c: Fix flex array members some moreMichael Matz2016-03-112-0/+25
| | | | Last fix didn't work for function f1int in the added testcase.
* tccgen.c: In parse_btype, handle type qualifiers applied to arrays.Edmund Grimley Evans2016-01-111-0/+16
| | | | Also add some test cases in tests/tests2/39_typedef.c.
* tccgen.c: Try to make sizeof(!x) work.Edmund Grimley Evans2015-11-222-0/+3
| | | | tests/tests2/27_sizeof.*: Add test.
* tccgen.c: Bug fix for 992cbda and 3ff77a1: set nocode_wanted.Edmund Grimley Evans2015-11-212-0/+13
| | | | tests/tests2/78_vla_label.*: Add test.
* Improve constant propagation with "&&" and "||".Edmund Grimley Evans2015-11-201-1/+5
|
* tccgen.c: Recognise constant expressions with conditional operator.Edmund Grimley Evans2015-11-201-3/+14
| | | | tests/tests2/78_vla_label.c: Check that int a[1 ? 1 : 1] is not a VLA.
* tests/tests2/79_vla_continue.c: Fix off-by-one error.Edmund Grimley Evans2015-11-131-2/+2
|
* tests/tcctest.c: Fix up format strings.Edmund Grimley Evans2015-11-041-28/+28
|
* Enable variable-length arrays on arm64.Edmund Grimley Evans2015-10-311-2/+1
| | | | | arm64-gen.c: Implement gen_vla_sp_save, gen_vla_sp_restore, gen_vla_alloc. tests/Makefile: Run vla_test on arm64.
* Revert "fix-mixed-struct (patch by Pip Cet)"gus knight2015-07-291-4/+4
| | | | This reverts commit 4e04f67c94c97b4f28a4d73759a0ad38fb3a10f7. Requested by grischka.
* Revert all of my changes to directories & codingstyle.gus knight2015-07-295-82/+82
|
* Reorganize the source tree.gus knight2015-07-273-9/+9
| | | | | | | | | | * Documentation is now in "docs". * Source code is now in "src". * Misc. fixes here and there so that everything still works. I think I got everything in this commit, but I only tested this on Linux (Make) and Windows (CMake), so I might've messed something up on other platforms...
* Trim trailing spaces everywhere.gus knight2015-07-272-73/+73
|
* fix-mixed-struct (patch by Pip Cet)seyko2015-05-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jsut for testing. It works for me (don't break anything) Small fixes for x86_64-gen.c in "tccpp: fix issues, add tests" are dropped in flavor of this patch. Pip Cet: Okay, here's a first patch that fixes the problem (but I've found another bug, yet unfixed, in the process), though it's not particularly pretty code (I tried hard to keep the changes to the minimum necessary). If we decide to actually get rid of VT_QLONG and VT_QFLOAT (please, can we?), there are some further simplifications in tccgen.c that might offset some of the cost of this patch. The idea is that an integer is no longer enough to describe how an argument is stored in registers. There are a number of possibilities (none, integer register, two integer registers, float register, two float registers, integer register plus float register, float register plus integer register), and instead of enumerating them I've introduced a RegArgs type that stores the offsets for each of our registers (for the other architectures, it's simply an int specifying the number of registers). If someone strongly prefers an enum, we could do that instead, but I believe this is a place where keeping things general is worth it, because this way it should be doable to add SSE or AVX support. There is one line in the patch that looks suspicious: } else { addr = (addr + align - 1) & -align; param_addr = addr; addr += size; - sse_param_index += reg_count; } break; However, this actually fixes one half of a bug we have when calling a function with eight double arguments "interrupted" by a two-double structure after the seventh double argument: f(double,double,double,double,double,double,double,struct { double x,y; },double); In this case, the last argument should be passed in %xmm7. This patch fixes the problem in gfunc_prolog, but not the corresponding problem in gfunc_call, which I'll try tackling next.
* tccpp: fix issues, add testsgrischka2015-05-0938-145/+266
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix some macro expansion issues * add some pp tests in tests/pp * improved tcc -E output for better diff'ability * remove -dD feature (quirky code, exotic feature, didn't work well) Based partially on ideas / researches from PipCet Some issues remain with VA_ARGS macros (if used in a rather tricky way). Also, to keep it simple, the pp doesn't automtically add any extra spaces to separate tokens which otherwise would form wrong tokens if re-read from tcc -E output (such as '+' '=') GCC does that, other compilers don't. * cleanups - #line 01 "file" / # 01 "file" processing - #pragma comment(lib,"foo") - tcc -E: forward some pragmas to output (pack, comment(lib)) - fix macro parameter list parsing mess from a3fc54345949535524d01319e1ca6378b7c2c201 a715d7143d9d17da17e67fec6af1c01409a71a31 (some coffee might help, next time ;) - introduce TOK_PPSTR - to have character constants as written in the file (similar to TOK_PPNUM) - allow '\' appear in macros - new functions begin/end_macro to: - fix switching macro levels during expansion - allow unget_tok to unget more than one tok - slight speedup by using bitflags in isidnum_table Also: - x86_64.c : fix decl after statements - i386-gen,c : fix a vstack leak with VLA on windows - configure/Makefile : build on windows (MSYS) was broken - tcc_warning: fflush stderr to keep output order (win32)
* VLA fix: save stack pointer right after modificationPhilip2015-04-283-3/+28
| | | | | | | | | | | | | | | | This patch disables the optimization of saving stack pointers lazily, which didn't fully take into account that control flow might not reach the stack-saving instructions. I've decided to leave in the extra calls to vla_sp_save() in case anyone wants to restore this optimization. Tests added and enabled. There are two remaining bugs: VLA variables can be modified, and jumping into the scope of a declared VLA will cause a segfault rather than a compiler error. Both of these do not affect correct C code, but should be fixed at some point. Once VLA variables have been made properly immutable, we can share them with the saved stack pointer and save stack and instructions.
* fix VLA/continue issuePhilip2015-04-273-2/+99
| | | | | | | | | | | | | | | | | | as reported in http://lists.nongnu.org/archive/html/tinycc-devel/2015-04/msg00131.html. Note that this is one of two separate VLA bugs: A. labels aren't reached by program execution, so the stack pointer is never saved B. continue doesn't restore the stack pointer as goto does This fixes only B. I'm not sure whether the same issue applies to break as well as continue. Add a test case, but disable tests #78 and #79 for now as they're not fully fixed until the issue described in http://lists.nongnu.org/archive/html/tinycc-devel/2015-04/msg00110.html is resolved.
* add test case for VLA segfaultsPhilip2015-04-273-1/+25
| | | | | | | | | This test obviously shouldn't segfault, but currently does so. The problem is in the VLA code, which fails to save the stack pointer before taking a conditional branch in some cases. See this thread: http://lists.nongnu.org/archive/html/tinycc-devel/2015-04/msg00130.html
* fix another x86_64 ABI bugPhilip2015-04-261-0/+68
| | | | | | | | | | | The old code assumed that if an argument doesn't fit into the available registers, none of the subsequent arguments do, either. But that's wrong: passing 7 doubles, then a two-double struct, then another double should generate code that passes the 9th argument in the 8th register and the two-double struct on the stack. We now do so. However, this patch does not yet fix the function calling code to do the right thing in the same case.
* x86_64 ABI tests, which currently cause failuresPhilip2015-04-251-0/+86
| | | | | | | | | | | | | | With the x86_64 Linux ELF ABI, we're currently failing two of these three tests, which have been disabled for now. The problem is mixed structures such as struct { double x; char c; }, which the x86_64 ABI specifies are to be passed/returned in one integer register and one SSE register; our current approach, marking the structure as VT_QLONG or VT_QFLOAT, fails in this case. (It's possible to fix this by getting rid of VT_QLONG and VT_QFLOAT entirely as at https://github.com/pipcet/tinycc, but the changes aren't properly isolated at present. Anyway, there might be a less disruptive fix.)