Bug 17610 - [3.4 Regression] Empty #include statement halts gcc
Summary: [3.4 Regression] Empty #include statement halts gcc
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.4.2
: P3 normal
Target Milestone: 3.4.4
Assignee: Nathanael C. Nerode
URL:
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2004-09-22 14:32 UTC by Christoph Happich
Modified: 2004-12-02 02:37 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.1 4.0.0
Known to fail: 3.4.0
Last reconfirmed: 2004-11-27 20:30:41


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Happich 2004-09-22 14:32:48 UTC
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 ""'.
Comment 1 Andrew Pinski 2004-09-22 18:13:41 UTC
This might be correct behavior but unexpected, it reads from the stdio for empty include file names.
Comment 2 Andrew Pinski 2004-09-22 21:18:20 UTC
Confirmed, but I really would like a preprocessor person to say if this is expected behavior.
Comment 3 Neil Booth 2004-09-22 21:56:40 UTC
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.
Comment 4 Mark Mitchell 2004-11-01 00:46:36 UTC
Postponed until GCC 3.4.4.
Comment 5 Nathanael C. Nerode 2004-11-27 22:50:07 UTC
I took this.  Patch is at http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02423. 
Comment 6 GCC Commits 2004-11-28 22:28:22 UTC
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

Comment 7 GCC Commits 2004-12-02 02:32:53 UTC
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

Comment 8 Nathanael C. Nerode 2004-12-02 02:37:12 UTC
fix in 3.4