hello
batch procedure compil :
nim c -f --gc:arc -d:forceGtk -d:useMalloc --verbosity:0 --hints:off --threads:on --app:GUI --passc:-flto -d:release -o:termvte termvte.nim
Dans la fonction « nimCopyMem »,
mis en ligne depuis « copyMem_system_1709 » à /home/soleil/.cache/nim/termvte_r/stdlib_system.nim.c:655:2,
mis en ligne depuis « appendString » à /home/soleil/.cache/nim/termvte_r/stdlib_system.nim.c:1030:3,
mis en ligne depuis « gintro_gobjectInit000 » à /home/soleil/.cache/nim/termvte_r/@[email protected]@[email protected]@[email protected]:274:1,
mis en ligne depuis « PreMainInner » à /home/soleil/.cache/nim/termvte_r/@mtermvte.nim.c:1029:2:
/home/soleil/.cache/nim/termvte_r/stdlib_system.nim.c:652:15: attention: « memcpy » écrire 5 octet dans une région de taille 0 déborde de la destination [-Wstringop-overflow=]
652 | T1_ = memcpy(dest, source, ((size_t) (size)));
| ^
Dans la fonction « nimCopyMem »,
mis en ligne depuis « copyMem_system_1709 » à /home/soleil/.cache/nim/termvte_r/stdlib_system.nim.c:655:2,
mis en ligne depuis « appendString » à /home/soleil/.cache/nim/termvte_r/stdlib_system.nim.c:1030:3,
mis en ligne depuis « gintro_gobjectInit000 » à /home/soleil/.cache/nim/termvte_r/@[email protected]@[email protected]@[email protected]:255:1,
mis en ligne depuis « PreMainInner » à /home/soleil/.cache/nim/termvte_r/@mtermvte.nim.c:1029:2:
/home/soleil/.cache/nim/termvte_r/stdlib_system.nim.c:652:15: attention: « memcpy » écrire 5 octet dans une région de taille 0 déborde de la destination [-Wstringop-overflow=]
652 | T1_ = memcpy(dest, source, ((size_t) (size)));
| ^
BUILD PROD termvte.nim-> termvte size : 68K
nim c -f --gc:arc -d:useMalloc --verbosity:0 --hints:off --threads:on -d:release -o:termvte termvte.nim
BUILD PROD termvte.nim-> termvte size : 95K
the nim code is exactly the same, but when I compile with --passc: -flto it screams nonsense;)
can someone help me
in nim 1.4.8 I did not have this problem
Sorry, I have the feeling this is more an issue for the Nim core devs -- which may be tired now after the 1.6 release.
cat label.nim
import gintro/gobject
proc main =
echo "OK"
main()
salewski@nuc /tmp/nim $ nim c -f --gc:arc -d:useMalloc -d:release -d:lto label.nim
Hint: used config file '/home/salewski/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/salewski/Nim/config/config.nims' [Conf]
..............................................................................
/tmp/nim/label.nim(1, 14) Warning: imported and not used: 'gobject' [UnusedImport]
CC: stdlib_digitsutils.nim
CC: stdlib_formatfloat.nim
CC: stdlib_dollars.nim
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: ../../home/salewski/.nimble/pkgs/gintro-#v0.9.2/gintro/glib.nim
CC: stdlib_times.nim
CC: ../../home/salewski/.nimble/pkgs/gintro-#v0.9.2/gintro/gobject.nim
CC: label.nim
Hint: [Link]
In function ‘memcpy’,
inlined from ‘nimCopyMem’ at /tmp/salewski/.cache/nim/label_r/stdlib_system.nim.c:588:8,
inlined from ‘copyMem_system_1709’ at /tmp/salewski/.cache/nim/label_r/stdlib_system.nim.c:591:2,
inlined from ‘appendString’ at /tmp/salewski/.cache/nim/label_r/stdlib_system.nim.c:954:3,
inlined from ‘gintro_gobjectInit000’ at /tmp/salewski/.cache/nim/label_r/@m..@s..@shome@[email protected]@spkgs@[email protected]@[email protected]:137:1,
inlined from ‘PreMainInner’ at /tmp/salewski/.cache/nim/label_r/@mlabel.nim.c:65:2:
/usr/include/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ writing 5 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
29 | return __builtin___memcpy_chk (__dest, __src, __len,
| ^
In function ‘memcpy’,
inlined from ‘nimCopyMem’ at /tmp/salewski/.cache/nim/label_r/stdlib_system.nim.c:588:8,
inlined from ‘copyMem_system_1709’ at /tmp/salewski/.cache/nim/label_r/stdlib_system.nim.c:591:2,
inlined from ‘appendString’ at /tmp/salewski/.cache/nim/label_r/stdlib_system.nim.c:954:3,
inlined from ‘gintro_gobjectInit000’ at /tmp/salewski/.cache/nim/label_r/@m..@s..@shome@[email protected]@spkgs@[email protected]@[email protected]:118:1,
inlined from ‘PreMainInner’ at /tmp/salewski/.cache/nim/label_r/@mlabel.nim.c:65:2:
/usr/include/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ writing 5 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
29 | return __builtin___memcpy_chk (__dest, __src, __len,
| ^
Hint: gc: arc; opt: speed; options: -d:release
58070 lines; 1.076s; 75.496MiB peakmem; proj: /tmp/nim/label.nim; out: /tmp/nim/label [SuccessX]
So only importing the gobject module shows this issue. But can we create a module that is wrong by its own, when noting of it is used?
The issue seems to be an appenString() operation during module initialisation using the new V2 strings. But it is really difficult to see the real problem.
Note that the error message is a serious warning only, so the executables still work, and they work even when running with valgrind.
I may investigate this issue later, but maybe it is just to hard for me.
OK, I was able to strip it down to
import times
var qt = "NGIQ" & $epochTime()
if true:#g_quark_try_string(qt) != 0:
qt = "NGIQ" & $epochTime()
$ nim c -f --gc:arc -d:useMalloc -d:release -d:lto gobject.nim
Hint: used config file '/home/salewski/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/salewski/Nim/config/config.nims' [Conf]
...........................................................................
CC: stdlib_digitsutils.nim
CC: stdlib_formatfloat.nim
CC: stdlib_dollars.nim
CC: stdlib_system.nim
CC: stdlib_times.nim
CC: gobject.nim
Hint: [Link]
In function ‘memcpy’,
inlined from ‘nimCopyMem’ at /tmp/salewski/.cache/nim/gobject_r/stdlib_system.nim.c:585:8,
inlined from ‘copyMem_system_1709’ at /tmp/salewski/.cache/nim/gobject_r/stdlib_system.nim.c:588:2,
inlined from ‘appendString’ at /tmp/salewski/.cache/nim/gobject_r/stdlib_system.nim.c:951:3,
inlined from ‘NimMainModule’ at /tmp/salewski/.cache/nim/gobject_r/@mgobject.nim.c:156:1,
inlined from ‘NimMainInner’ at /tmp/salewski/.cache/nim/gobject_r/@mgobject.nim.c:106:2:
/usr/include/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ writing 5 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
29 | return __builtin___memcpy_chk (__dest, __src, __len,
| ^
In function ‘memcpy’,
inlined from ‘nimCopyMem’ at /tmp/salewski/.cache/nim/gobject_r/stdlib_system.nim.c:585:8,
inlined from ‘copyMem_system_1709’ at /tmp/salewski/.cache/nim/gobject_r/stdlib_system.nim.c:588:2,
inlined from ‘appendString’ at /tmp/salewski/.cache/nim/gobject_r/stdlib_system.nim.c:951:3,
inlined from ‘NimMainModule’ at /tmp/salewski/.cache/nim/gobject_r/@mgobject.nim.c:140:1,
inlined from ‘NimMainInner’ at /tmp/salewski/.cache/nim/gobject_r/@mgobject.nim.c:106:2:
/usr/include/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ writing 5 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
29 | return __builtin___memcpy_chk (__dest, __src, __len,
| ^
Hint: gc: arc; opt: speed; options: -d:release
41549 lines; 0.869s; 60.48MiB peakmem; proj: /tmp/hhh/gobject.nim; out: /tmp/hhh/gobject [SuccessX]
I have no idea for what that code may be good, but looks not that wrong.
Will create a github issue.
gcc 11.1.0-1
using Majaro last update
confirmed. also, https://github.com/nim-lang/Nim/issues/19026
as a workaround you can
$ downgrade gcc gcc-libs
to 10.2.0-6
i also had to downgrade gcc-fortran ymmv
thats downgrade from the AUR
I will wait, for this program I will use --passC: -fno-builtin-memcpy
will there be a correction, please.
ps I can't downgrade GCC too much involvement ....
will there be a correction, please.
Follow along at the issue, but it looks like a false positive in gcc. It's annoying, but it's just a warning, and the code compiles fine.
you can shut it up with --passL:-Wno-stringop-overflow