From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32517 invoked by alias); 23 Jan 2014 17:12:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 32506 invoked by uid 89); 23 Jan 2014 17:12:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2014 17:12:50 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0NHCmKR032188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Jan 2014 12:12:48 -0500 Received: from tucnak.zalov.cz (vpn1-6-8.ams2.redhat.com [10.36.6.8]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0NHCl2s011818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 23 Jan 2014 12:12:48 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id s0NHCklk018429; Thu, 23 Jan 2014 18:12:46 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id s0NHCjXw018428; Thu, 23 Jan 2014 18:12:45 +0100 Date: Thu, 23 Jan 2014 17:12:00 -0000 From: Jakub Jelinek To: Dodji Seketeli Cc: Bernd Edlinger , GCC Patches , Tom Tromey , Manuel =?iso-8859-1?B?TPNwZXotSWLh8WV6?= Subject: Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals Message-ID: <20140123171245.GK892@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <87y559xz7y.fsf@redhat.com> <20131031173649.GW27813@tucnak.zalov.cz> <87zjpbb5qu.fsf@redhat.com> <20131111142159.GZ27813@tucnak.zalov.cz> <878uwuap4f.fsf@redhat.com> <878uwt63e2.fsf@redhat.com> <20131113081610.GH27813@tucnak.zalov.cz> <87zjp7t73c.fsf@redhat.com> <87vbxcig8t.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87vbxcig8t.fsf@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg01514.txt.bz2 On Wed, Jan 22, 2014 at 09:16:02AM +0100, Dodji Seketeli wrote: > +static fcache* > +add_file_to_cache_tab (const char *file_path) > +{ > + > + FILE *fp = fopen (file_path, "r"); > + if (ferror (fp)) > + { > + fclose (fp); > + return NULL; > + } I've seen various segfaults here when playing with preprocessed sources from PRs (obviously don't have the original source files). When fopen fails, it just returns NULL, so I don't see why you just don't do if (fp == NULL) return fp; Jakub