[asterisk-bugs] [JIRA] (ASTERISK-29306) Incorrect use of __attribute__((pure)) in ast_str_to_lower definition

Vitezslav Novy (JIRA) noreply at issues.asterisk.org
Sat Feb 20 07:40:15 CST 2021


Vitezslav Novy created ASTERISK-29306:
-----------------------------------------

             Summary: Incorrect use of __attribute__((pure)) in ast_str_to_lower definition
                 Key: ASTERISK-29306
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29306
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/General
    Affects Versions: 18.2.0, 16.16.1
         Environment: debian 10,
            Reporter: Vitezslav Novy


I am analysing  problem with case-insensivity of application names in cel.conf declared here
https://github.com/asterisk/asterisk/blob/18/main/cel.c#L75

In our configuration application CEL events are recorded only when applications are listed in cel.conf with uppercase first letter.

Looking to code in cel.c application  names read from configuration shoud be converted to lowercase in function apps_handler and in function   cel_track_app app name is also converted to lowercase before it is searched in app list

But it does not happen. Using few extra  logging lines I can see app name before and after calling ast_str_to_lower has first letter uppercase and ast_str_to_lower just does not work.
Looking to dissasembled binary I can see the function was completely optimized out. I believe it is because of it is declared with attrribute_pure 
which declares no side effects. But it is not true for the function ast_str_to_lower, there are side effects. 
In combination with fact that function always returns value its parameter
compiler is right if skips it completely and only uses the parameter of the function as its result.




--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list