From 0259b4a6723508faad9a83d6d3118c643607ee8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 7 Jan 2015 16:24:33 +0100 Subject: [PATCH] testgarbage: add code example from #6361 to testrunner --- test/testgarbage.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/testgarbage.cpp b/test/testgarbage.cpp index e3b1f1721..da4cc7fbb 100644 --- a/test/testgarbage.cpp +++ b/test/testgarbage.cpp @@ -54,7 +54,7 @@ private: TEST_CASE(garbageCode11); TEST_CASE(garbageCode12); TEST_CASE(garbageCode13); // Ticket #2607 - crash - TEST_CASE(garbageCode14); // TIcket #5595 - crash + TEST_CASE(garbageCode14); // Ticket #5595 - crash TEST_CASE(garbageCode15); // Ticket #5203 TEST_CASE(garbageCode16); TEST_CASE(garbageCode17); @@ -64,6 +64,7 @@ private: TEST_CASE(garbageCode21); TEST_CASE(garbageCode22); TEST_CASE(garbageCode23); + TEST_CASE(garbageCode24); // Ticket #6361 - crash TEST_CASE(garbageValueFlow); TEST_CASE(garbageSymbolDatabase); @@ -328,6 +329,17 @@ private: ASSERT_EQUALS("", errout.str()); } + void garbageCode24() { + // don't crash (example from #6361) + checkCode("float buffer[64];\n" + "main (void)\n" + "{\n" + " char *cptr;\n" + " cptr = (char *)buffer;\n" + " cptr += (-(long int) buffer & (16 * sizeof (float) - 1));\n" + "}\n"); + } + void garbageValueFlow() { // #6089 const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"