[Home]

Summary:ASTERISK-29144: GCC Warnings with OPTIMIZE=-Og make
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2020-10-29 08:17:27Date Closed:2020-11-03 16:36:53.000-0600
Priority:TrivialRegression?
Status:Closed/CompleteComponents:Applications/app_directory Applications/app_voicemail Channels/General Functions/func_odbc
Versions:16.14.0 18.0.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) Og.patch
Description:{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}}.
Comments:By: Asterisk Team (asteriskteam) 2020-10-29 08:17:28.483-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Friendly Automation (friendly-automation) 2020-11-03 16:36:53.726-0600

Change 15078 merged by Friendly Automation:
Compiler fixes for GCC with -Og

[https://gerrit.asterisk.org/c/asterisk/+/15078|https://gerrit.asterisk.org/c/asterisk/+/15078]

By: Friendly Automation (friendly-automation) 2020-11-03 17:09:25.787-0600

Change 15102 merged by Kevin Harwell:
Compiler fixes for GCC with -Og

[https://gerrit.asterisk.org/c/asterisk/+/15102|https://gerrit.asterisk.org/c/asterisk/+/15102]

By: Friendly Automation (friendly-automation) 2020-11-03 17:09:52.228-0600

Change 15077 merged by Kevin Harwell:
Compiler fixes for GCC with -Og

[https://gerrit.asterisk.org/c/asterisk/+/15077|https://gerrit.asterisk.org/c/asterisk/+/15077]