From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out.google.com ([216.239.33.17]:3781 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbZGMFaB (ORCPT ); Mon, 13 Jul 2009 01:30:01 -0400 Subject: Re: [Bug 13012] 2.6.28.9 causes init to segfault on Debian etch; 2.6.28.8 OK References: <200907100928.07369.elendil@planet.nl> <200907101659.31813.elendil@planet.nl> From: Ian Lance Taylor Date: Sun, 12 Jul 2009 22:29:50 -0700 In-Reply-To: (Linus Torvalds's message of "Sun\, 12 Jul 2009 10\:58\:21 -0700 \(PDT\)") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: Frans Pop , Linux Kernel Mailing List , Andrew Morton , linux-kbuild@vger.kernel.org, barryn@pobox.com, bugme-daemon@bugzilla.kernel.org Linus Torvalds writes: > Ian: we generally do try to be careful and use explicit unsigned types for > code that cares about overflow, but we use -fwrapv because there have been > some cases where we didn't (and used pointer comparisons or signed > integers). > > The problem is that apparently gcc-4.1.x was literally generating buggy > code with -fwrapv. So now the choice for us is between switching to an > explicit version test: > > -KBUILD_CFLAGS += $(call cc-option,-fwrapv) > +KBUILD_CFLAGS += $(shell if [ $(call cc-version) -ge 0402 ]; then \ > + echo $(call cc-option,-fwrapv); fi ;) > > or just switching to -fno-strict-overflow instead: > > -KBUILD_CFLAGS += $(call cc-option,-fwrapv) > +KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) > > which avoids the buggy gcc versions because it's simply not even supported > by gcc-4.1.x (and even if that wasn't the case, possibly because only > 'wrapv' is the problematic case - apparently the difference _does_ > matter to gcc). My instinctive advice is that y'all should track down and fix the cases where the program relies on signed overflow being defined. However, if that is difficult--and it is--then I agree that -fno-strict-overflow is preferable when using a compiler which supports it (gcc 4.2.0 and later). (The gcc 4.2 and later option -Wstrict-overflow=N can help find the cases where a program relies on defined signed overflow, but only if somebody is patient enough to wade through all the false positives.) Ian