aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--Documentation/TODO.md29
-rw-r--r--Documentation/release-notes/v0.6.3.rst5
-rw-r--r--Makefile2
-rw-r--r--evaluate.c6
-rw-r--r--symbol.c2
-rw-r--r--validation/builtin-arith.c31
-rw-r--r--validation/crash-undef-in-parens.c9
-rw-r--r--validation/flex-array-nested.c4
8 files changed, 60 insertions, 28 deletions
diff --git a/Documentation/TODO.md b/Documentation/TODO.md
index e2043e48..4dc9e63a 100644
--- a/Documentation/TODO.md
+++ b/Documentation/TODO.md
@@ -4,13 +4,13 @@ TODO
Essential
---------
* SSA is broken by simplify_loads() & branches rewriting/simplification
-* attributes of struct, union & enums are ignored (and possibly in other
- cases too).
-* add support for bitwise enums
+* attributes of struct, union & enums are ignored (and maybe others too).
+ This requires correct support for __packed which itself needs partial
+ and unaligned loads & stores (wip)
+* add support for bitwise enums (wip)
Documentation
-------------
-* document the extensions
* document the API
* document the limitations of modifying ptrlists during list walking
* document the data structures
@@ -27,7 +27,7 @@ Core
Testsuite
---------
-* there are more than 50 failing tests. They should be fixed
+* there are 60 failing tests. They should be fixed
(but most are non-trivial to fix).
Misc
@@ -36,15 +36,26 @@ Misc
* parse __attribute_((fallthrough))
* add support for format(printf()) (WIP by Ben Dooks)
* make use of UNDEFs (issues warnings, simplification, ... ?)
-* add a pass to inline small functions during simplification.
+* make memory accesses more explicit: add EXPR_ACCESS (wip)
+* it would be nice to do our own parsing of floating point (wip)
+* some header files needed for crypto/ need __vector or __fp16
+* some even need __complex
Optimization
------------
+* a lot of small simplifications are waiting to be upstreamed
+* the domtree need to be rebuilt (or updated)
+* critical edges need to be split
* the current way of doing CSE uses a lot of time
* add SSA based DCE
* add SSA based PRE
* Add SSA based SCCP
+* add a pass to inline small functions during simplification.
* use better/more systematic use of internal verification framework
+* tracking of operands size should be improved (WIP)
+* OP_INLINE is sometimes in the way
+* would be nice to strictly separate phases that don't changes the
+ CFG and thus the dominance tree.
IR
--
@@ -60,13 +71,15 @@ LLVM
Internal backends
-----------------
-* add some basic register allocation
+* it would be nice the upstream the code generator
* add a pass to transform 3-addresses code to 2-addresses
+* add some basic register allocation
+* add a pass to order the BBs and changes 2-ways CBR into one-way branches
* what can be done for x86?
+* add support to add constraints in the MD rules
Longer term/to investigate
--------------------------
-* better architecture handling than current machine.h + target.c
* attributes are represented as ctypes's alignment, modifiers & contexts
but plenty of attributes doesn't fit, for example they need arguments.
* format(printf, ...),
diff --git a/Documentation/release-notes/v0.6.3.rst b/Documentation/release-notes/v0.6.3.rst
index 521c0063..7ec59eff 100644
--- a/Documentation/release-notes/v0.6.3.rst
+++ b/Documentation/release-notes/v0.6.3.rst
@@ -1,5 +1,5 @@
-v0.6.3 (Fall 2020)
-==================
+v0.6.3 (2020-10-17)
+===================
Bug fixes:
* fix missing inlining of _Generic expression
@@ -15,6 +15,7 @@ Bug fixes:
* fix access to defining instruction in simplify_unop()
* fix evaluation of pointer to bool conversions
* fix usual conversion of integers
+ * fix null pointer deref on return expression with invalid type
New features:
* add support for arch specific asm constraints
diff --git a/Makefile b/Makefile
index f7da0ded..31366446 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.6.3-rc1
+VERSION=0.6.3
########################################################################
# The following variables can be overwritten from the command line
diff --git a/evaluate.c b/evaluate.c
index 3ff76fa8..43a61169 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1787,6 +1787,8 @@ static struct symbol *degenerate(struct expression *expr)
expression_error(expr, "strange non-value function or array");
return &bad_ctype;
}
+ if (ctype->builtin)
+ sparse_error(expr->pos, "taking the address of built-in function '%s'", show_ident(ctype->ident));
*expr = *expr->unop;
ctype = create_pointer(expr, ctype, 1);
expr->ctype = ctype;
@@ -1807,6 +1809,8 @@ static struct symbol *evaluate_addressof(struct expression *expr)
return NULL;
}
ctype = op->ctype;
+ if (ctype->builtin)
+ sparse_error(expr->pos, "taking the address of built-in function '%s'", show_ident(ctype->ident));
*expr = *op->unop;
mark_addressable(expr);
@@ -3611,7 +3615,7 @@ static struct symbol *evaluate_return_expression(struct statement *stmt)
fntype = current_fn->ctype.base_type;
rettype = fntype->ctype.base_type;
if (!rettype || rettype == &void_ctype) {
- if (expr && !is_void_type(expr->ctype))
+ if (expr && expr->ctype && !is_void_type(expr->ctype))
expression_error(expr, "return expression in %s function", rettype?"void":"typeless");
if (expr && Wreturn_void)
warning(stmt->pos, "returning void-valued expression");
diff --git a/symbol.c b/symbol.c
index 5d4f078b..d6613524 100644
--- a/symbol.c
+++ b/symbol.c
@@ -200,7 +200,7 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance
if (has_flexible_array(member))
info.has_flex_array = 1;
if (has_flexible_array(member) && Wflexible_array_nested)
- warning(member->pos, "nested flexible arrays");
+ warning(member->pos, "nested flexible array");
fn(member, &info);
} END_FOR_EACH_PTR(member);
diff --git a/validation/builtin-arith.c b/validation/builtin-arith.c
index d08c93da..3ce59304 100644
--- a/validation/builtin-arith.c
+++ b/validation/builtin-arith.c
@@ -31,22 +31,27 @@ void test(void (*fun)(void))
/*
* check-name: builtin arithmetic
* check-command: sparse -Wno-decl $file
- * check-known-to-fail
*
* check-error-start
-builtin-arith.c:10:xx: error: ...
-builtin-arith.c:11:xx: error: ...
-builtin-arith.c:13:xx: error: arithmetics on pointers to functions
-builtin-arith.c:14:xx: error: arithmetics on pointers to functions
-builtin-arith.c:15:xx: error: arithmetics on pointers to functions
-builtin-arith.c:18:xx: error: ...
-builtin-arith.c:19:xx: error: ...
-builtin-arith.c:21:xx: error: ...
-builtin-arith.c:22:xx: error: ...
-builtin-arith.c:23:xx: error: ...
-builtin-arith.c:24:xx: error: ...
-builtin-arith.c:25:xx: error: ...
+builtin-arith.c:10:14: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:11:13: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:12:14: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:13:14: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:13:29: error: arithmetics on pointers to functions
+builtin-arith.c:14:14: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:14:29: error: arithmetics on pointers to functions
+builtin-arith.c:15:14: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:15:29: error: arithmetics on pointers to functions
+builtin-arith.c:18:21: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:19:29: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:21:14: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:22:14: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:23:14: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:24:21: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:25:21: error: taking the address of built-in function '__builtin_trap'
+builtin-arith.c:27:9: error: taking the address of built-in function '__builtin_trap'
builtin-arith.c:27:24: error: subtraction of functions? Share your drugs
+builtin-arith.c:28:15: error: taking the address of built-in function '__builtin_trap'
builtin-arith.c:28:13: error: subtraction of functions? Share your drugs
* check-error-end
*/
diff --git a/validation/crash-undef-in-parens.c b/validation/crash-undef-in-parens.c
new file mode 100644
index 00000000..5f05f88a
--- /dev/null
+++ b/validation/crash-undef-in-parens.c
@@ -0,0 +1,9 @@
+void foo(void) { return (UNDEF_STUFF_IN_PARENS); }
+
+/*
+ * check-name: crash-undef-in-parens
+ *
+ * check-error-start
+crash-undef-in-parens.c:1:26: error: undefined identifier 'UNDEF_STUFF_IN_PARENS'
+ * check-error-end
+ */
diff --git a/validation/flex-array-nested.c b/validation/flex-array-nested.c
index a82cbfc9..094de2fb 100644
--- a/validation/flex-array-nested.c
+++ b/validation/flex-array-nested.c
@@ -23,7 +23,7 @@ static int foo(struct s *s, union u *u)
* check-command: sparse -Wflexible-array-nested $file
*
* check-error-start
-flex-array-nested.c:7:18: warning: nested flexible arrays
-flex-array-nested.c:11:18: warning: nested flexible arrays
+flex-array-nested.c:7:18: warning: nested flexible array
+flex-array-nested.c:11:18: warning: nested flexible array
* check-error-end
*/