1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-18 07:29:36 +00:00
Commit Graph

278 Commits

Author SHA1 Message Date
Jesse Rosenstock
81550ca1ee CS_MergeLabels: Keep labels referenced by data
Partial fix for ICE in #1211.  This may fix enough to allow #1049 to be
fixed.

When merging labels, keep the first label with a ref that has no JumpTo;
this is a data segment label, used by computed gotos.

The real fix is to track and rewrite labels in data, but this is more
involved.
2020-10-08 12:11:03 +02:00
Jesse Rosenstock
b931e65811 Fix ICE for bit-fields with typedef
Fixes #1267

Avoid ICE, but treat plain int bit-fields declared via typedef as
signed rather than unsigned.  It is more efficient to treat them
as unsigned, but this requires distinguishing int from signed int,
and this is curently not done.
2020-10-03 15:04:31 +02:00
Oliver Schmidt
4acdc9ced9 Fixed paramcount build. 2020-10-03 14:55:30 +02:00
mrdudz
b549e83fb2 move program from testcode/assembler to test/asm and remove testcode/assembler 2020-09-29 19:03:42 +02:00
mrdudz
34177d9edd test related to issue #1094 2020-09-25 20:08:32 +02:00
mrdudz
7ff08c85cf Merge branch 'master' of https://github.com/cc65/cc65 2020-09-25 16:25:53 +02:00
mrdudz
61d934fd7b test related to issue #1265 2020-09-25 16:25:32 +02:00
Greg King
47ee179273 Fixed a copy & paste error in the test/misc/ makefile.
Fixed a warning that's changed to an error in Travis CI tests.
2020-09-25 00:31:07 -04:00
mrdudz
5ba9d28488 test related to pr #1189 2020-09-24 16:16:16 +02:00
mrdudz
97a1093ee0 test related to issue #1222 2020-09-24 12:23:18 +02:00
mrdudz
a86644eff1 test related to issue #1221 2020-09-24 00:08:36 +02:00
mrdudz
b3491e3d9a test related to issue #1244 2020-09-23 23:57:36 +02:00
mrdudz
46ebb15c76 test related to issue #1245 2020-09-23 23:57:25 +02:00
mrdudz
6fdd90fa63 fix typo 2020-09-23 23:51:37 +02:00
mrdudz
99121688f8 added test related to issue #1263 2020-09-23 23:51:24 +02:00
Jesse Rosenstock
4e4e4c2d21 Allow char bit-fields
These are not required to be supported (only int, signed int, and
unsigned int are required), but most compilers support it.

https://port70.net/~nsz/c/c89/c89-draft.html#3.5.2.1
https://port70.net/~nsz/c/c89/c89-draft.html#A.6.5.8

For consistency with other integral types, plain `char` bit-fields
are unsigned, regardless of the `--signed-chars` option.

Fixes #1047
2020-09-08 14:24:04 +02:00
Jesse Rosenstock
9a0e4a35e1 Fix enum bit-field ICE #1244
This previously resulted in an ICE:
cc65: Check failed: (Entry->Type->C & T_MASK_SIGN) == T_SIGN_SIGNED,
file 'cc65/symtab.c', line 874

This CHECK is in the code that deals with changing `int` bitfields to
`unsigned int`.

Work around this by treating enum bit-fields as having their signedness
specified, so this type change code does not get called.

Fixes #1244.
2020-09-07 11:21:23 +02:00
Jesse Rosenstock
44b719d957 Change line endings from CRLF to LF
test/ref/pr1220.c was somehow added with CRLFs.
Other files use just LF.
2020-09-04 14:01:21 +02:00
acqn
2a3d996077 Improved test case for PR #1220. 2020-09-02 21:36:59 +02:00
acqn
492ee7fc45 Improved test/ref/pr1220.c. 2020-08-30 03:10:24 +08:00
acqn
504aee3835
Merge branch 'master' into StaticConst 2020-08-27 06:27:23 +08:00
mrdudz
c1a514c0f8 added test related to issue #1201 2020-08-26 23:20:28 +02:00
Oliver Schmidt
b0d3b19a6a The bug1209 test fails at link stage. 2020-08-26 21:01:02 +02:00
Oliver Schmidt
c658acbf85 Avoid cl65 in tests.
cl65 creates intermediate files based on the source file name in the source file directory. Calling cl65 in parallel with the same source file causes those intermediate files to get overwritten.

Fixes #1080
2020-08-26 20:39:34 +02:00
acqn
b6a4715a38 Added test/ref/pr1220 for testing constant AND/OR code generation. 2020-08-26 08:45:01 +08:00
acqn
d68925c6a8 Bug #1113 was fixed long ago. 2020-08-25 22:34:25 +08:00
Jesse Rosenstock
344aea0669 Add additional test cases for #1209
These test cases don't use dynamic labels.
https://github.com/cc65/cc65/issues/1209#issuecomment-678738971

Also update the original test case for consistency:
* Change failure message to just "FAIL", as there is only one failure
* Outdent label definitions
* Clarify description
2020-08-24 19:15:06 +02:00
Jesse Rosenstock
d38e5858f0 Add tests for #1211
CL_MoveRefs: Add CHECK (E->JumpTo != NULL) to make failure clearer.
2020-08-24 18:10:22 +02:00
Jesse Rosenstock
4b7cd491e3 Move #1209 test from err/ to misc/
misc/ is the correct place for tests that should compile
but do not.

Revert err/Makefile changes from #1210.
2020-08-24 18:07:31 +02:00
Jesse Rosenstock
23621f3299 Add test case for #1209
Change err/ tests to use cl65 and .prg instead of cc65 and .s
since this test only fails at the link stage.
2020-08-22 15:27:49 +02:00
acqn
0486d28abc Fixed Issue #327. 2020-08-22 13:44:18 +02:00
acqn
1abb9da2b2 Moved bug250.c to test/val as it is fixed. 2020-08-26 09:40:32 +08:00
acqn
b15ab348ba Moved bug250.c from test/misc as it is to be fixed. 2020-08-26 08:23:05 +08:00
mrdudz
794adcc512 remove unneeded rule 2020-08-19 22:33:10 +02:00
mrdudz
e6b8f4d715 move/fix bug264.c as suggested in issue #1122 2020-08-19 22:25:18 +02:00
mrdudz
1a92368aed rename bdiff.c to isequal.c, make it handle different line-endings as equal 2020-08-19 14:50:12 +02:00
mrdudz
0690a12ad2 change "the cc65 authors" to "The cc65 Authors" as per jmrs request 2020-08-18 22:41:42 +02:00
mrdudz
0c22d5011e added test related to pr #1190 2020-08-18 17:58:29 +02:00
mrdudz
ab89c168de replace "Copyright 2020 Google LLC" by "Copyright 2020 the cc65 authors" 2020-08-18 17:47:35 +02:00
Jesse Rosenstock
ff535b8e1a Treat signed int bit-fields as signed
Prior to this PR, `int`, `signed int`, and `unsigned int`
bitfields are all treated as `unsigned int`.

With this PR, `signed int` will be treated as `signed int`,
and the others remain unsigned.

Since `Type` does not distinguish between `int` and `signed int`,
add an extra `int* SignenessSpecified` param to `ParseTypeSpec`
so we can tell these apart for bit-fields and treat plain `int : N`
as `unsigned int : N` since it is more efficient to zero-extend
than sign-extend.

Fixes #1095
2020-08-18 12:23:20 +02:00
mrdudz
2663561c62 added test related to pr #1135 2020-08-18 00:41:35 +02:00
mrdudz
6d8860b9de added test related to issue #1145 2020-08-18 00:41:07 +02:00
mrdudz
cf41fccc0a added test related to issue #1143 2020-08-18 00:40:29 +02:00
Bob Andrews
531de44c95
Merge pull request #1193 from jmr/bitfield-union-bug
Add test of union of bit-field from mailing list
2020-08-17 14:33:51 +02:00
Jesse Rosenstock
6db93d58cf Add test of union of bit-field from mailing list
https://sourceforge.net/p/cc65/mailman/message/36152700/

This currently works, but add a test to prevent future regressions.
2020-08-17 09:54:31 +02:00
Jesse Rosenstock
1cf9404c19 Support C2X _Static_assert(expr) syntax
This makes the message in _Static_assert(expr, message) optional.

Fixes #1188.
2020-08-16 11:38:20 +02:00
Jesse Rosenstock
c4698dfd07 Use C89 semantics for integer conversions
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
2020-08-15 19:14:31 +02:00
mrdudz
f0e4053a0d added test related to issue #1178 2020-08-14 19:58:58 +02:00
acqn
1d28e8e3de Improved test case for Issue #191. 2020-08-14 18:33:54 +02:00
mrdudz
dc83eb15af added test related to issue #1181 2020-08-14 16:12:17 +02:00