mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
c4698dfd07
Previously, the following rules were used for binary operators: * If one of the values is a long, the result is long. * If one of the values is unsigned, the result is also unsigned. * Otherwise the result is an int. C89 specifies the "usual arithmetic conversions" as: * The integral promotions are performed on both operands. * Then the following rules are applied: * If either operand has type unsigned long int, the other operand is converted to unsigned long int. * Otherwise, if one operand has type long int and the other has type unsigned int, if a long int can represent all values of an unsigned int, the operand of type unsigned int is converted to long int; if a long int cannot represent all the values of an unsigned int, both operands are converted to unsigned long int. * Otherwise, if either operand has type long int, the other operand is converted to long int. * Otherwise, if either operand has type unsigned int, the other operand is converted to unsigned int. * Otherwise, both operands have type int. https://port70.net/~nsz/c/c89/c89-draft.html#3.2.1.5 As one example, these rules give a different result for an operator with one long operand and one unsigned int operand. Previously, the result type was unsigned long. With C89 semantics, it is just long, since long can represent all unsigned ints. Integral promotions convert types shorter than int to int (or unsigned int). Both char and unsigned char are promoted to int since int can represent all unsigned chars. https://port70.net/~nsz/c/c89/c89-draft.html#3.2.1.1 Rename promoteint to ArithmeticConvert, since this is more accurate. Fixes #170
This directory contains test code for automatic regression testing of the CC65 compiler. /val - The bulk of tests are contained here, individual tests should exit with an exit code of EXIT_SUCCESS when they pass, or EXIT_FAILURE on error. /ref - These tests produce output that must be compared with reference output. /err - contains tests that MUST NOT compile /todo - These tests fail due to open compiler issues. The makefile in this directory _expects_ the tests to fail, because of that when an issue was fixed it will break the CI. The test should get moved to /var in the PR fixing the issue, which will make CI pass again. No changes to makefiles are required! /asm - contains the assembler regression tests /dasm - contains the disassembler regression tests /misc - a few tests that need special care of some sort Tests that (incorrectly) fail to compile and other tests that fail and do NOT return an exit code are collected here. The makefile _expects_ those tests to fail, so when an issue is fixed it will break the CI. When this happens, the PR fixing the issue should also "invert" the failing condition in the makefile by adding a $(NOT) before the offending line (or removing it when it is already there), which will make the CI pass again. The test should then be moved elsewhere later, which will require additional changes to the makefile(s). To run the tests use "make" in this (top) directory, the makefile should exit with no error. When a test failed you can use "make continue" to run further tests. -------------------------------------------------------------------------------- TODO: - reduce usage of "common.h" to a minimum - convert more tests from using reference output to returning an exit code