[Home]

Summary:ASTERISK-29145: GCC Warnings with OPTIMIZE=-Os make
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2020-10-29 08:59:12Date Closed:2020-11-03 15:17:14.000-0600
Priority:TrivialRegression?
Status:Closed/CompleteComponents:Utilities/muted
Versions:16.14.0 18.0.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) muted.patch
Description:{code}./configure
OPTIMIZE=-Os make{code}gives the following warning in Ubuntu 20.10 with GCC 10.2:{code}muted.c: In function ‘load_config’:
muted.c:171:36: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 256 [-Wformat-truncation=]
 171 |      snprintf(pass, sizeof(pass), "%s", val);
     |                                    ^~
In file included from /usr/include/stdio.h:866,
                from muted.c:61:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:70:10: note: ‘__builtin_snprintf’ output between 1 and 1024 bytes into a destination of size 256
  70 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
     |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  71 |        __bos (__s), __fmt, __va_arg_pack ());
     |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
muted.c:166:36: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 256 [-Wformat-truncation=]
 166 |      snprintf(user, sizeof(user), "%s", val);
     |                                    ^~
In file included from /usr/include/stdio.h:866,
                from muted.c:61:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:70:10: note: ‘__builtin_snprintf’ output between 1 and 1024 bytes into a destination of size 256
  70 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
     |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  71 |        __bos (__s), __fmt, __va_arg_pack ());
     |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{code}The workaround is trivial because this warning can be ignored. However, when using {{./configure --enable-developer-mode}} that warning turns into an error. Surprisingly, that warning does 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 {{-Og}}, {{-O1}}, and {{-Os}} are affected.
Comments:By: Asterisk Team (asteriskteam) 2020-10-29 08:59:12.590-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 15:17:15.391-0600

Change 15107 merged by Friendly Automation:
Compiler fixes for GCC with -Os

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

By: Friendly Automation (friendly-automation) 2020-11-03 15:47:29.744-0600

Change 15106 merged by Kevin Harwell:
Compiler fixes for GCC with -Os

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

By: Friendly Automation (friendly-automation) 2020-11-03 15:47:56.523-0600

Change 15079 merged by Kevin Harwell:
Compiler fixes for GCC with -Os

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