Missing NUL terminator when using "-MT <file>" option
Sebastien Alaiwan
sebastien.alaiwan+contact at gmail.com
Sun Nov 28 13:58:49 UTC 2021
Hi,
It seems that the output target name gets corrupted (see the extra chars at the end of 'MyTargetName'):
*$ cat test.d*
// empty file
*$ gdc -Isrc -MM "test.d" -MT "MyTargetName" -MF "test.deps"*
*$ cat test.deps*
MyTargetName�: test.d
*$ gdc --version*
gdc (Debian 11.2.0-10) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*$*
Here's the fix I'm suggesting:
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index be6330fbd..4749bfb98 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -110,6 +110,7 @@ deps_add_target (const char *target, bool quoted)
if (!quoted)
{
obstack_grow0 (&buffer, target, strlen (target));
+ obstack_1grow (&buffer, '\0');
d_option.deps_target.safe_push ((const char *) obstack_finish (&buffer));
return;
}
Cheers,
Sebastien Alaiwan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20211128/79427b57/attachment.htm>
More information about the D.gnu
mailing list