@@ -55,6 +55,9 @@ class TestFunctions : public TestFixture {
5555 TEST_CASE (invalidFunctionUsage1);
5656 TEST_CASE (invalidFunctionUsageStrings);
5757
58+ // Invalid function argument
59+ TEST_CASE (invalidFunctionArg1);
60+
5861 // Math function usage
5962 TEST_CASE (mathfunctionCall_fmod);
6063 TEST_CASE (mathfunctionCall_sqrt);
@@ -755,6 +758,21 @@ class TestFunctions : public TestFixture {
755758 ASSERT_EQUALS (" [test.c:1]: (error) Invalid puts() argument nr 1. A nul-terminated string is required.\n " , errout_str ());
756759 }
757760
761+ void invalidFunctionArg1 () {
762+ const Settings settingsUnix32 = settingsBuilder (settings).platform (Platform::Unix32).build ();
763+ check (" int main() {\n "
764+ " char tgt[7];\n "
765+ " char src[7+1] = \" 7777777\" ;\n "
766+ " if (sizeof tgt <= sizeof src) {\n "
767+ " memmove(&tgt, &src, sizeof tgt);\n "
768+ " } else {\n "
769+ " memmove(&tgt, &src, sizeof src);\n "
770+ " memset(&tgt + sizeof src, ' ', sizeof tgt - sizeof src);\n "
771+ " }\n "
772+ " }\n " , false , &settingsUnix32);
773+ ASSERT_EQUALS (" " , errout_str ());
774+ }
775+
758776 void mathfunctionCall_sqrt () {
759777 // sqrt, sqrtf, sqrtl
760778 check (" void foo()\n "
0 commit comments