[Asterisk-code-review] Test cel: Fails when DONT OPTIMIZE is off (asterisk[master])

Joshua C. Colp asteriskteam at digium.com
Wed Jan 23 11:26:35 CST 2019


Joshua C. Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10890 )

Change subject: Test_cel: Fails when DONT_OPTIMIZE is off
......................................................................

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
---
M include/asterisk/strings.h
M main/strings.c
2 files changed, 16 insertions(+), 13 deletions(-)

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua C. Colp: Looks good to me, approved; Approved for Submit



diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index e4bef5f..aaf2737 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -1212,19 +1212,7 @@
  *
  * \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 640af61..a18bb48 100644
--- a/main/strings.c
+++ b/main/strings.c
@@ -421,3 +421,18 @@
 
 	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;
+}
+

-- 
To view, visit https://gerrit.asterisk.org/10890
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ied32e0071f12ed9d5f3b4cdd878b2532a1c769d7
Gerrit-Change-Number: 10890
Gerrit-PatchSet: 4
Gerrit-Owner: Chris Savinovich <csavinovich at digium.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190123/fdc9667b/attachment.html>


More information about the asterisk-code-review mailing list