The gcc binary halts if the source code contains an empty '#include' statement. Prior versions, e.g. 3.3.1, used to print "empty file name in #include". This can be easily reproduced with a one-line source file containing nothing more than '#include ""'.
This might be correct behavior but unexpected, it reads from the stdio for empty include file names.
Confirmed, but I really would like a preprocessor person to say if this is expected behavior.
Subject: Re: [3.4/4.0 Regression] Empty #include statement halts gcc pinskia at gcc dot gnu dot org wrote:- > > ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-22 21:18 ------- > Confirmed, but I really would like a preprocessor person to say if this is expected behavior. Nope, it should be rejected outright like prior versions of GCC did.
Postponed until GCC 3.4.4.
I took this. Patch is at http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02423.
Subject: Bug 17610 CVSROOT: /cvs/gcc Module name: gcc Changes by: neroden@gcc.gnu.org 2004-11-28 22:28:13 Modified files: libcpp : ChangeLog directives.c gcc : ChangeLog Added files: gcc/testsuite/gcc.dg/cpp: empty-include.c Log message: (libcpp) PR preprocessor/17610 * directives.c (do_include_common): Error out if an empty filename is given for #include (or #include_next or #import). (gcc) PR preprocessor/17610 * testsuite/gcc.dg/cpp/empty-include.c: New testcase. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/ChangeLog.diff?cvsroot=gcc&r1=1.43&r2=1.44 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/directives.c.diff?cvsroot=gcc&r1=1.9&r2=1.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6602&r2=2.6603 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/cpp/empty-include.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 17610 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: neroden@gcc.gnu.org 2004-12-02 02:32:22 Modified files: gcc : ChangeLog c-opts.c c-ppoutput.c cpplib.c Added files: gcc/testsuite/gcc.dg/cpp: empty-include.c Log message: 2004-12-01 Nathanael Nerode <neroden@gcc.gnu.org> PR preprocessor/17651 * c-opts.c (sanitize_cpp_opts): Make flag_no_output imply flag_no_line_commands. * c-ppoutput.c (pp_file_change): Remove now-redundant check of flag_no_output. PR preprocessor/17610 * directives.c (do_include_common): Error out if an empty filename is given for #include (or #include_next or #import). PR preprocessor/17610 * testsuite/gcc.dg/cpp/empty-include.c: New testcase. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.713&r2=2.2326.2.714 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-opts.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.96.4.8&r2=1.96.4.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-ppoutput.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.11.12.3&r2=1.11.12.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cpplib.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.355.4.2&r2=1.355.4.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/cpp/empty-include.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1
fix in 3.4