[asterisk-bugs] [JIRA] (ASTERISK-29144) GCC Warnings with OPTIMIZE=-Og make

Asterisk Team (JIRA) noreply at issues.asterisk.org
Thu Nov 12 07:02:18 CST 2020


     [ https://issues.asterisk.org/jira/browse/ASTERISK-29144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asterisk Team updated ASTERISK-29144:
-------------------------------------

    Target Release Version/s: 18.1.0

> GCC Warnings with OPTIMIZE=-Og make
> -----------------------------------
>
>                 Key: ASTERISK-29144
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29144
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Applications/app_directory, Applications/app_voicemail, Channels/General, Functions/func_odbc
>    Affects Versions: 16.14.0, 18.0.0
>            Reporter: Alexander Traud
>            Assignee: Alexander Traud
>            Severity: Trivial
>              Labels: patch
>      Target Release: 16.15.0, 18.1.0
>
>         Attachments: Og.patch
>
>
> {code}./configure
> OPTIMIZE=-Og make{code}gives the following five warnings in Ubuntu 20.10 with GCC 10.2:{code}chan_audiosocket.c: In function ‘audiosocket_request’:
> chan_audiosocket.c:261:4: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   261 |    close(fd);
>       |    ^~~~~~~~~
> app_directory.c: In function ‘select_item_menu’:
> app_directory.c:412:39: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 2 [-Wformat-truncation=]
>   412 |    snprintf(buf, sizeof(buf), "digits/%d", i + 1);
>       |                                       ^~
> app_directory.c:412:31: note: directive argument in the range [1, 2147483647]
>   412 |    snprintf(buf, sizeof(buf), "digits/%d", i + 1);
>       |                               ^~~~~~~~~~~
> In file included from /usr/include/stdio.h:866,
>                  from .../asterisk-18.0.0/include/asterisk/compat.h:49,
>                  from .../asterisk-18.0.0/include/asterisk.h:22,
>                  from app_directory.c:31:
> /usr/include/x86_64-linux-gnu/bits/stdio2.h:70:10: note: ‘__builtin___snprintf_chk’ output between 9 and 18 bytes into a destination of size 9
>    70 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    71 |        __bos (__s), __fmt, __va_arg_pack ());
>       |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> app_voicemail.c: In function ‘vm_authenticate’:
> app_voicemail.c:11284:15: warning: ‘passptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 11284 |   if (vmu && !strcmp(passptr, password))
>       |               ^~~~~~~~~~~~~~~~~~~~~~~~~
> func_odbc.c: In function ‘init_acf_query’:
> .../asterisk-18.0.0/include/asterisk/astmm.h:244:2: warning: ‘tmp2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   244 |  __ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)
>       |  ^~~~~~~~~~~~
> func_odbc.c:1184:14: note: ‘tmp2’ was declared here
>  1184 |  const char *tmp2;
>       |              ^~~~
> ooh323c/src/ooq931.c: In function ‘ooDecodeUUIE’:
> ooh323c/src/ooq931.c:620:27: error: ‘ie’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>   620 |    setPERBuffer (pctxt, ie->data, ie->length, aligned);
>       |                         ~~^~~~~~{code}The workaround is trivial because these warnings can be ignored. However, when using {{./configure --enable-developer-mode}} those warnings turn into errors. Surprisingly, those warnings do not happen with any other [optimization options|http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html] like ones normally used in Asterisk: {{-O0}} and {{-O3}}. Only {{./apps/app_directory.c}} also warns not only at {{-Og}} but also on {{-O1}}.



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



More information about the asterisk-bugs mailing list