<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">and I am in 64 bit.</p></blockquote><pre style="font-family: monospace,monospace; white-space: pre-wrap;">On amd64 regular ints tend to be 32 bits.<br>```<br>$ cat 1.c <br>int main() {<br> int x;<br> return sizeof(x);<br>}<br>$ ./a.out; echo $?<br>4<br>```</pre><p style="white-space: pre-wrap; word-wrap: break-word;">@walter, can you double-check the levels you are using by going for NOISY=YES or outputting the whole GCC options? Not that you have set OPTIMIZE as environment variable before you make.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">(gcc options)<br>```<br>gcc -o say.o -c say.c -MD -MT say.o -MF .say.o.d -MP -pthread -I/usr/src/asterisk/include -I/usr/include/libxml2 -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Werror -Wunused -Wdeclaration-after-statement -Wtrampolines -Wundef -Wmissing-format-attribute -Wformat=2 -O3 -fno-partial-inlining -march=native -DAST_MODULE=\"core\" -DAST_IN_CORE <br>say.c: In function ‘ast_say_number_full_zh’:<br>say.c:2502:24: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 10 [-Werror=format-truncation=]<br> 2502 | snprintf(buf, 10, "%d", num);<br> | ^~<br>```<br>- replacing -O3 with -O2 or -O1 doesn't help<br>- doing -O0 does help (as well as no-On at all)<br>- removing -match=native also helps (like mentioned earlier)</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">(relevant location)<br>```diff<br>--- a/main/say.c<br>+++ b/main/say.c<br>@@ -2496,7 +2496,11 @@ static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char<br> snprintf(fn, sizeof(fn), "digits/thousand");<br> playt = 0;<br> } else if (num < 10) {<br>+#if 0<br>+ snprintf(buf, 10, "%hhd", (char)num);<br>+#else<br> snprintf(buf, 10, "%d", num);<br>+#endif<br> if (last_length - strlen(buf) > 1 && last_length != 0) {<br> last_length = strlen(buf);<br> playz++;<br>```</pre><p style="white-space: pre-wrap; word-wrap: break-word;">(based on)<br>```<br>commit 6a0c47237480d750023561b004f2c4052bfab210 (HEAD -> 16)<br>Author: George Joseph <gjoseph@digium.com><br>Date: Thu May 14 12:24:19 2020 -0600<br>```</p><p style="white-space: pre-wrap; word-wrap: break-word;">I tried to read some asm.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">`say-o1-native.s` (the troublesome one) does:<br>```<br> .loc 1 2498 11 is_stmt 1 view .LVU17431<br> .loc 1 2498 14 is_stmt 0 view .LVU17432<br> cmpl $9, %ebx<br> .p2align 4,,2<br> jle .L4703<br> .loc 1 2511 11 is_stmt 1 view .LVU17433<br> .loc 1 2511 14 is_stmt 0 view .LVU17434<br> cmpl $99, %ebx<br> .p2align 4,,2<br> jle .L4704<br>...</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">.L4703:<br> .loc 1 2502 5 is_stmt 1 view .LVU17476<br>.LBB4632:<br>.LBI4632:<br> .loc 3 64 1 view .LVU17477<br>.LBB4633:<br> .loc 3 67 3 view .LVU17478<br> .loc 3 67 10 is_stmt 0 view .LVU17479<br> leaq 48(%rsp), %rbp<br>.LVL8105:<br> .loc 3 67 10 view .LVU17480<br> movl %ebx, %r9d<br> leaq .LC176(%rip), %r8<br> movl $20, %ecx<br> movl $1, %edx<br> movl $10, %esi<br> movq %rbp, %rdi<br> movl $0, %eax<br> call __snprintf_chk@PLT</pre><p style="white-space: pre-wrap; word-wrap: break-word;">```<br>Where it appears ebx holds num. But I haven't got the faintest idea why (or why not) it would assume that it might be larger in this case.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Compared to `say-o1-nonative.s` (no trouble):<br>```<br> .loc 1 2498 11 is_stmt 1 view .LVU15708<br> .loc 1 2498 14 is_stmt 0 view .LVU15709<br> cmpl $9, %ebp<br> jle .L4245<br> .loc 1 2511 11 is_stmt 1 view .LVU15710<br> .loc 1 2511 14 is_stmt 0 view .LVU15711<br> cmpl $99, %ebp<br> jle .L4246<br>...</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">.L4245:<br> .loc 1 2502 5 is_stmt 1 view .LVU15756<br>.LBB4808:<br>.LBI4808:<br> .loc 4 64 1 view .LVU15757<br>.LBB4809:<br> .loc 4 67 3 view .LVU15758<br> .loc 4 67 10 is_stmt 0 view .LVU15759<br> leaq 32(%rsp), %rbx<br>.LVL6969:<br> .loc 4 67 10 view .LVU15760<br> movl %ebp, %r9d<br> leaq .LC176(%rip), %r8<br> movl $20, %ecx<br> movl $1, %edx<br> movl $10, %esi<br> movq %rbx, %rdi<br> movl $0, %eax<br> call __snprintf_chk@PLT<br>```<br>Here num appears to be in ebp.</pre><p style="white-space: pre-wrap; word-wrap: break-word;">No helpful clues there I suppose..</p><p style="white-space: pre-wrap; word-wrap: break-word;">gcc version is still: gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14501">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14501">change 14501</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14501"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: Ic7a70120188c9aa525a6d70289385bfce878438a </div>
<div style="display:none"> Gerrit-Change-Number: 14501 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Walter Doekes <walter+asterisk@wjd.nu> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-CC: Alexander Traud <pabstraud@compuserve.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 27 Oct 2020 21:38:29 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>