From: Chris-Savinovich Date: Sat, 19 Jan 2019 21:55:20 +0000 (-0600) Subject: Test_cel: Fails when DONT_OPTIMIZE is off X-Git-Tag: 16.2.0-rc1~13^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05b79d16ab93b038b39412e2570a21205eb499c4;p=thirdparty%2Fasterisk.git Test_cel: Fails when DONT_OPTIMIZE is off A bug in GCC causes TEST_CEL to return failure under the following conditions: 1. TEST_FRAMEWORK on 2. DONT_OPTIMIZE off 3. Fedora and Ubuntu 4. GCC 8.2.1 5. Test name: test_cel_dial_pickup 6. There must exist a certain combination of multithreading. The bug affects arithmetic calculations when the optimization level is bigger than O1 and the -fpartial-inline flag is on. Provided these conditions, function ast_str_to_lower() fails to convert to lower case due to said function being of type force_inline. The solution is to remove the "force_inline" type declaration from function ast_str_to_lower() Change-Id: Ied32e0071f12ed9d5f3b4cdd878b2532a1c769d7 --- diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index e4bef5f0f3..aaf2737bff 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -1212,19 +1212,7 @@ static force_inline int attribute_pure ast_str_case_hash(const char *str) * * \retval str for convenience */ -static force_inline char *attribute_pure ast_str_to_lower(char *str) -{ - char *str_orig = str; - if (!str) { - return str; - } - - for (; *str; ++str) { - *str = tolower(*str); - } - - return str_orig; -} +char *attribute_pure ast_str_to_lower(char *str); /*! * \brief Convert a string to all upper-case diff --git a/main/strings.c b/main/strings.c index 640af61233..a18bb4843b 100644 --- a/main/strings.c +++ b/main/strings.c @@ -421,3 +421,18 @@ int ast_vector_string_split(struct ast_vector_string *dest, return 0; } + +char *attribute_pure ast_str_to_lower(char *str) +{ + char *str_orig = str; + if (!str) { + return str; + } + + for (; *str; ++str) { + *str = tolower(*str); + } + + return str_orig; +} +