From owner-freebsd-current@FreeBSD.ORG Mon Jun 25 13:23:35 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4D2316A400 for ; Mon, 25 Jun 2007 13:23:35 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 218AD13C448 for ; Mon, 25 Jun 2007 13:23:34 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.1/8.14.1) with ESMTP id l5PD9Emg050513; Mon, 25 Jun 2007 17:09:14 +0400 (MSD) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nagual.pp.ru; s=default; t=1182776954; bh=VrY2OVYYspSD9IQTJ6i8HpLEhD3Qb6ZFtMAPNA9 jy/s=; l=998; h=Received:Date:From:To:Subject:Message-ID: Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition: User-Agent; b=uGGwMzlv7hGoYa0TNewT8b7FTDQ7W+6hNJ/Yqy6+CUM0mYZH/z4z +9RlhZVLVVkbvjbyuhxhOh7RoYDZKGbMOsS5VC40c2eDzO7w3aLTaXTw0HIYMUm4eu7 aF7BnrWJcEHaN27A+JufYVRKtHWev2cgqZ1EtWN5QMu7er/g6EpI= Received: (from ache@localhost) by nagual.pp.ru (8.14.1/8.14.1/Submit) id l5PD9EOw050511; Mon, 25 Jun 2007 17:09:14 +0400 (MSD) (envelope-from ache) Date: Mon, 25 Jun 2007 17:09:13 +0400 From: Andrey Chernov To: current@freebsd.org, kan@freebsd.org Message-ID: <20070625130913.GA50273@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , current@freebsd.org, kan@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-06) Cc: Subject: Silent gcc 4.2.0 loop optimization bug with -O2 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2007 13:23:35 -0000 This is serious loop optimization bug with -O2. I can't cut it down to the small sample, so here are simple steps to reproduce: 1) Compile/install misc/astrolog port, with or WITHOUT_X11, it does not matter. (I just commit CFLAGS+=-O in its Makefile as workaround of this bug, so change it to CFLAGS+=-O2 to see the bug in action) 2) Run "astrolog -n -j0" See lower right corner empty (under "Mode Power Percent") 3) Change back to CFLAGS+=-O, recompile, reinstall, run, see _filled_ lower right corner. To the code - in the intrpret.c:ChartInfluence(), near the very end of the file is a basic loop like that: for (i = 1; i <= 12; i++) { ... if (i <= 4) { ... } else if (i == 6) { ... } else if (i >= 7 && i <= 9) { !!!!! It never goes here with -O2 !!!!! ... } ... } Note: the exact example code above DOES NOT trigger the bug, as I say I can't cut it down to small sample, I just provide it for hint where bug place is. -- http://ache.pp.ru/