[asterisk-bugs] [JIRA] (ASTERISK-28792) codec_gsm: while building, optimization flag is overwritten

Alexander Traud (JIRA) noreply at issues.asterisk.org
Thu May 28 05:33:25 CDT 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=250963#comment-250963 ] 

Alexander Traud commented on ASTERISK-28792:
--------------------------------------------

bq. hope that -O0 -O3 gets -O0

Yes and no. The GCC documentation [states|https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html]: ‘If you use multiple -O options \[…\] the last such option is the one that is effective.’ Hopefully, this is true for other compilers. Anyway, Asterisk is appending the top-level optimization level again, resulting in three optimization flags. Is that another issue or intended? Okay, let me summarize:
* GCC 4.2 is given -Oi -O2 -Oi
* all other versions and compilers get -Oi -O3 -Oi

A) Let us assume that third -Oi is intended. Then we have two issues:
# OPTIMIZE from the top Makefile is given to GCC, regardless of the state of DONT_OPTIMIZE
# that special handling of GCC 4.2 does not work at all because GCC uses the last -Oi

B) Let us assume that third -Oi is *not* intended. Then we have two issues:
# OPTIMIZE from the top Makefile is given to GCC, regardless of the state of DONT_OPTIMIZE
# that additional = third -Oi

> codec_gsm: while building, optimization flag is overwritten
> -----------------------------------------------------------
>
>                 Key: ASTERISK-28792
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28792
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Codecs/codec_gsm, Core/BuildSystem
>    Affects Versions: 13.32.0, 16.9.0, 17.3.0
>            Reporter: Alexander Traud
>            Assignee: Unassigned
>            Severity: Minor
>
> Because of ASTERISK-28374, I found this issue here.
> With the Compiler Flag DONT_OPTIMIZE is enabled, Clang erred while compiling the file {{codecs/gsm/src/add.c}}. This happens, because the {{Makefile}} in the directory {{codecs/gsm}} checks for a specific GCC version as well. That check works correctly. However, the variable name OPTIMIZE is re-used. Because of that, the value of OPTIMIZE from the default {{Makefile.rules}} is used (even when DONT_OPTIMIZE is enabled).
> Consequently, this is not a Clang specific issue but also affects GCC.
> The related issues reports are:
> * Mantis 17688 (now ASTERISK-16408)
> * Mantis 11243 (now ASTERISK-10762)
> * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34216
> The easy fix would be to change the names of those two OPTIMIZE (and the hope that -O0 -O3 gets -O0). The correct fix would be to investigate that GCC -O3 issue finally and possibly remove that compiler switch completely. Not sure what to do. Therefore, I am just reporting this actual 13 year old software bug. Because ASTERISK-28374 is now fixed, the issue here is a no-care actually.



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



More information about the asterisk-bugs mailing list