fix null pointer constants
authorMatthias Braun <matze@braunis.de>
Wed, 19 Dec 2012 16:55:19 +0000 (17:55 +0100)
committerMatthias Braun <matze@braunis.de>
Wed, 19 Dec 2012 16:55:19 +0000 (17:55 +0100)
only a cast to void* gives a null pointer constant, casting to types
compatible with void* not necessarily.

parser.c

index 95a204f..74374c5 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -856,7 +856,7 @@ static bool is_null_pointer_constant(const expression_t *expression)
        /* skip void* cast */
        if (expression->kind == EXPR_UNARY_CAST) {
                type_t *const type = skip_typeref(expression->base.type);
-               if (types_compatible(type, type_void_ptr))
+               if (type == type_void_ptr)
                        expression = expression->unary.value;
        }