Re: message_test fails on powerpc and i386
Dominique Pellé wrote: > Bram Moolenaar wrote: > > > Elimar Riesebieter wrote: > > > > > message_test fails on powerpc and i386 (32bit arch): > > > > > > message_test: message_test.c:170: void test_vim_snprintf(void): Assertion > > > `n == 6' failed. > > > Aborted > > > make[1]: *** [Makefile:2242: run_message_test] Error 1 > > > > > > Building on amd64 just runs fine. > > > > This should not be platform-dependent. In the build where it fails, can > > you try: > > :echo printf("-%06b-", 12) > > > > What does it show? > > > > Unfortunately assert() doesn't show what the actual value was. You > > could add a printf() to show it. > > I can reproduce the assert failure after > building vim-8.2.116 with -m32 to build > for 32-bits x86 (after adding a few :i386 ubuntu > packages). > > :echo printf("-%06b-", 12) > -001100- > > The output looks as expected at least. > But the test fails indeed: > > message_test: message_test.c:170: test_vim_snprintf: Assertion `n == 6' > failed. > > Putting the following fprintf just before that assert... > >fprintf(stderr, "*** n=%d bsize=%d buf=[%s]\n", n, bsize, buf); > > It shows: > > *** n=63 bsize=0 buf=[] > > Value of n is completely wrong!? I see why the test fails. The test at message_test.c:169 calls: 169 n = vim_snprintf(buf, bsize, fmt_06b, 12); So the vararg 12 is an int (32-bits). The vararg value corresponding to %b is found using va_arg(ap, uvarnumber_T) at message.c:4540: 4533 else if (fmt_spec == 'b' || fmt_spec == 'B') 4534 { 4535 bin_arg = 4536 # if defined(FEAT_EVAL) 4537 tvs != NULL ? 4538 (uvarnumber_T)tv_nr(tvs, _idx) : 4539 # endif !!4540 va_arg(ap, uvarnumber_T); 4541 if (bin_arg != 0) 4542 arg_sign = 1; 4543 } There is a type mismatch between value 12 (an int) and expected type uvarnumber_T which is a uint64_t (actually the type can depend on platform and on whether FEAT_NUM64 is defined). Adding a cast in the test fixes it. See attached patch fix-message-test.patch. Regards Dominique -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAON-T_jW3tkFOju%2BOU45%3DNkq8E%2BPXsrzUaVLDA6xj8OO_UO_GA%40mail.gmail.com. diff --git a/src/message_test.c b/src/message_test.c index 38e52c5f8..3397a9cb4 100644 --- a/src/message_test.c +++ b/src/message_test.c @@ -166,7 +166,7 @@ test_vim_snprintf(void) assert(bsize == 0 || STRNCMP(buf, "deadbeef", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_06b, 12); + n = vim_snprintf(buf, bsize, fmt_06b, (uvarnumber_T)12); assert(n == 6); assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0');
Re: message_test fails on powerpc and i386
Elimar Riesebieter wrote: > > > message_test fails on powerpc and i386 (32bit arch): > > > > > > message_test: message_test.c:170: void test_vim_snprintf(void): Assertion > > > `n == 6' failed. > > > Aborted > > > make[1]: *** [Makefile:2242: run_message_test] Error 1 > > > > > > Building on amd64 just runs fine. > > > > This should not be platform-dependent. In the build where it fails, can > > you try: > > :echo printf("-%06b-", 12) > > > > What does it show? > > -001100- That is correct. So why does the test fail? -- Corn oil comes from corn and olive oil comes from olives, so where does baby oil come from? /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202001141923.00EJNgaL023644%40masaka.moolenaar.net.
Re: message_test fails on powerpc and i386
Bram Moolenaar wrote: > Elimar Riesebieter wrote: > > > message_test fails on powerpc and i386 (32bit arch): > > > > message_test: message_test.c:170: void test_vim_snprintf(void): Assertion > > `n == 6' failed. > > Aborted > > make[1]: *** [Makefile:2242: run_message_test] Error 1 > > > > Building on amd64 just runs fine. > > This should not be platform-dependent. In the build where it fails, can > you try: > :echo printf("-%06b-", 12) > > What does it show? > > Unfortunately assert() doesn't show what the actual value was. You > could add a printf() to show it. I can reproduce the assert failure after building vim-8.2.116 with -m32 to build for 32-bits x86 (after adding a few :i386 ubuntu packages). :echo printf("-%06b-", 12) -001100- The output looks as expected at least. But the test fails indeed: message_test: message_test.c:170: test_vim_snprintf: Assertion `n == 6' failed. Putting the following fprintf just before that assert... fprintf(stderr, "*** n=%d bsize=%d buf=[%s]\n", n, bsize, buf); It shows: *** n=63 bsize=0 buf=[] Value of n is completely wrong!? The recently added test in vim-8.2.66 finds a bug. I will debug it soon. Dominique -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAON-T_gb4MyJrK6zXR_5nf3vf%2BskQKMSh4ioBFYxgQMBee1d3A%40mail.gmail.com.
Re: message_test fails on powerpc and i386
* Bram Moolenaar [2020-01-14 19:06 +0100]: > > Elimar Riesebieter wrote: > > > message_test fails on powerpc and i386 (32bit arch): > > > > message_test: message_test.c:170: void test_vim_snprintf(void): Assertion > > `n == 6' failed. > > Aborted > > make[1]: *** [Makefile:2242: run_message_test] Error 1 > > > > Building on amd64 just runs fine. > > This should not be platform-dependent. In the build where it fails, can > you try: > :echo printf("-%06b-", 12) > > What does it show? -001100- > Unfortunately assert() doesn't show what the actual value was. You > could add a printf() to show it. Elimar -- >what IMHO then? IMHO - Inhalation of a Multi-leafed Herbal Opiate ;) --posting from alex in debian-user-- -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20200114183153.2fzwoprsa32v5hmd%40toy.home.lxtec.de.
Re: message_test fails on powerpc and i386
Elimar Riesebieter wrote: > message_test fails on powerpc and i386 (32bit arch): > > message_test: message_test.c:170: void test_vim_snprintf(void): Assertion `n > == 6' failed. > Aborted > make[1]: *** [Makefile:2242: run_message_test] Error 1 > > Building on amd64 just runs fine. This should not be platform-dependent. In the build where it fails, can you try: :echo printf("-%06b-", 12) What does it show? Unfortunately assert() doesn't show what the actual value was. You could add a printf() to show it. -- A disclaimer for the disclaimer: "and before I get a huge amount of complaints , I have no control over the disclaimer at the end of this mail :-)" (Timothy Aldrich) /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202001141806.00EI67ab007322%40masaka.moolenaar.net.
message_test fails on powerpc and i386
Hi all, message_test fails on powerpc and i386 (32bit arch): message_test: message_test.c:170: void test_vim_snprintf(void): Assertion `n == 6' failed. Aborted make[1]: *** [Makefile:2242: run_message_test] Error 1 Building on amd64 just runs fine. Elimar -- Never make anything simple and efficient when a way can be found to make it complex and wonderful ;-) -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20200114134406.kxtfcbpemzludcso%40toy.home.lxtec.de.