[PATCH 2/8] fix error in bad conditional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit "b5867a33b (fix evaluation of a function or array symbol in conditionals)"
added a missing call to degenerate(epxr) but this must not be done
if the expression is erroneous.

fix this by bypassing the call to degenerate() if the ctype is NULL.

Fixes: b5867a33b62c04811784c6fc233c601a4f2b0841
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 evaluate.c                   | 4 +++-
 validation/bad-type-twice0.c | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index 402fa04af..027993983 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -894,7 +894,9 @@ static struct symbol *evaluate_conditional(struct expression *expr, int iterator
 			ctype = NULL;
 		}
 	}
-	ctype = degenerate(expr);
+
+	if (ctype)
+		ctype = degenerate(expr);
 
 	return ctype;
 }
diff --git a/validation/bad-type-twice0.c b/validation/bad-type-twice0.c
index 2dbc91b03..7a9073c52 100644
--- a/validation/bad-type-twice0.c
+++ b/validation/bad-type-twice0.c
@@ -5,7 +5,6 @@ static int foo(a)
 
 /*
  * check-name: bad-type-twice0
- * check-known-to-fail
  *
  * check-error-start
 bad-type-twice0.c:3:16: error: incorrect type in conditional
-- 
2.16.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux