-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUGS
76 lines (46 loc) · 1.74 KB
/
BUGS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
UNRESOLVED BUGS
Thanks to all submitters!
*** Submitted by Warren Toomey in 9/2019
//-comments in macros will mess up macro expansion. For
instance:
#define FOO 4 // 4 foos in every bar
expands to
printf("%d\n", 4 // 4 foos in every bar);
which is obviously a bad idea!
(So are //-comments. Just saying!)
*** Submitted by Volkmar Klatt in 12/2016
main() {
char c;
int i;
i = (c = -777);
printf("%d\n", i);
}
Prints -777, but should print 247, because c = (-777)&0xff.
*** Submitted by Alexey Frunze in 09/2016
printf("%x", -1); prints a negative decimal number, which it
shouldn't according to K&R2.
*** Submitted by Quan Tran in 10/2015
Dont miss his improved Go version of SubC at:
https://github.com/qeedquan/gosubc
The SubC bootstrap compiler generated by gcc/clang uses
4-byte int, so it will generate wrong code for x86_64
regarding numbers out of 4-byte range, so the asm will
mismatch against the compiler. However, the final scc built
from the scc0 and scc1 bootstrap will use 8-byte int on
x86_64, so that will be correct.
SubC does not support passing struct/unions as values, but it
allows you to declare it in function parameters, e.g.:
void f(struct foo x) {}
Switch statements may contain duplicate cases.
SubC allows externs in local declarations to be initialized:
void f() { extern int a = 10; } /* should not be allowed! */
SubC can only index arrays using indexes of int types, e.g.:
given
int a[10], b[2];
char x[10];
a[x[0]] does not work but a[b[0]] does work even though x[0]
does generate a valid integer index. Workaround: a[x[0]+0],
which will promote x[0] to int.
SubC currently allows any unary ops on any types, even on
structs: e.g.:
struct file f; !f;