From owner-freebsd-hackers Sun Jun 15 21:04:35 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id VAA13919 for hackers-outgoing; Sun, 15 Jun 1997 21:04:35 -0700 (PDT) Received: from agora.rdrop.com (root@agora.rdrop.com [199.2.210.241]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id VAA13914 for ; Sun, 15 Jun 1997 21:04:33 -0700 (PDT) Received: from hq.icb.chel.su (hq.icb.chel.su [193.125.10.33]) by agora.rdrop.com (8.8.5/8.8.5) with ESMTP id VAA06625 for ; Sun, 15 Jun 1997 21:03:17 -0700 (PDT) Received: (babkin@localhost) by hq.icb.chel.su (8.8.3/8.6.5) id JAA24558; Mon, 16 Jun 1997 09:30:12 +0600 (ESD) From: "Serge A. Babkin" Message-Id: <199706160330.JAA24558@hq.icb.chel.su> Subject: Re: C optimizer bug ? To: terry@lambert.org (Terry Lambert) Date: Mon, 16 Jun 1997 09:30:11 +0600 (ESD) Cc: jkh@time.cdrom.com, hackers@FreeBSD.ORG In-Reply-To: <199706151839.LAA16658@phaeton.artisoft.com> from "Terry Lambert" at Jun 15, 97 11:39:15 am X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > > Okay, here is the description: The function scsi_done() must check > > whether xs->bp is zero and then depending on it call biodone() > > Declare this variable volitile. You are probably suffering from > overambitious ANSI register optimization, where the value being > tested is loaded into a register and never reloaded (there's > actually no excuse for this, given that the compiler can determine > loop scoping and see from that whether or not the optimization > would fail). Sun's ANSI C and othes have similar problems. > > Probably the success depends upon whether the value is initially > zero or not. xs->bp does not change during the operation, it is initialized before calling the SCSI code. I tried to compile the kernel with -C -fvolatile that must declare all values accessed by pointers as volatile but this given no positive effect. I tried -fvolatile-global flag too but the kernel refuses to compile with it at all. The GCC version is 2.6.3. I'm going to study the produced code. -SB