On 5/7/19 10:31 AM, Christophe Lyon wrote:
After your commit, I'm seeing an ICE while building glibc headers:
<built-in>: internal compiler error: Segmentation fault
0xc2eeaf crash_signal
/tmp/2191418_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/toplev.c:326
0x151ad0d munge
/tmp/2191418_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libcpp/mkdeps.c:176
while trying to build glibc-headers/bits/stdio_lim.st
(seen on aarch64)
When compiling from stdin, the preprocessor registers an empty file
dependency (as the first dependency), which previously silently output
nothing. That now causes a null pointer dereference. We shouldn't be
registering such blank names.
Fixed thusly.
I see glibc uses -MT file1\ file1 to register multiple targets, that's
somewhat implementation & make specific, but not our problem ...
nathan
--
Nathan Sidwell
2019-05-07 Nathan Sidwell <nat...@acm.org>
* files.c (_cpp_stack_file): Empty filenames aren't dependencies.
* mkdeps.c (deps_add_dep): Assert not empty.
Index: libcpp/files.c
===================================================================
--- libcpp/files.c (revision 270940)
+++ libcpp/files.c (working copy)
@@ -906,11 +906,11 @@ _cpp_stack_file (cpp_reader *pfile, _cpp
sysp = MAX (pfile->buffer->sysp, file->dir->sysp);
/* Add the file to the dependencies on its first inclusion. */
- if (CPP_OPTION (pfile, deps.style) > !!sysp && !file->stack_count)
- {
- if (!file->main_file || !CPP_OPTION (pfile, deps.ignore_main_file))
- deps_add_dep (pfile->deps, file->path);
- }
+ if (!file->stack_count
+ && CPP_OPTION (pfile, deps.style) > !!sysp
+ && file->path[0]
+ && (!file->main_file || !CPP_OPTION (pfile, deps.ignore_main_file)))
+ deps_add_dep (pfile->deps, file->path);
/* Clear buffer_valid since _cpp_clean_line messes it up. */
file->buffer_valid = false;
Index: libcpp/mkdeps.c
===================================================================
--- libcpp/mkdeps.c (revision 270943)
+++ libcpp/mkdeps.c (working copy)
@@ -281,6 +281,8 @@ deps_add_default_target (struct mkdeps *
void
deps_add_dep (struct mkdeps *d, const char *t)
{
+ gcc_assert (*t);
+
t = apply_vpath (d, t);
d->deps.push (xstrdup (t));