- To: Ayonam Ray <ayonam@xxxxxxxxx>
- Subject: Re: Preventing scheduling of normal operations across calls to built-ins
- From: Ian Lance Taylor <iant@xxxxxxxxxx>
- Date: Wed, 22 Feb 2012 10:22:33 -0800
- Authentication-results: mr.google.com; spf=pass (google.com: domain of iant@xxxxxxxxxx designates 10.236.80.39 as permitted sender) smtp.mail=iant@xxxxxxxxxx; dkim=pass header.i=iant@xxxxxxxxxx
- Cc: gcc-help@xxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1330539778; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Received-SPF:Received:Received:Received:Received:From:To:Cc: Subject:References:Date:In-Reply-To:Message-ID:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=2lUBbvJEjfYSH0KFp8+ZtGJ5aeo=; b=MscBTiBaYyOPxJO i6NmjdeZMwgDiMQmvfQ7EY4dtNt0WPhstoEcd7i08RpxxDWYBxikyjKK6cbOXV7s ef5hvyJXDyIV0nmTu68sTcvL/LndI1MtPsTD+pyu1v70fKFZSxsiYlh8SSo7EXMI zVP8gfZ21zf4hPDAJ2G8D5ZA9rK4=
- In-reply-to: <CA+V5N8kC+WJXTwF2aOQaNAvsFCQejsjko+FjwzKXPaCuOK8TvQ@mail.gmail.com> (Ayonam Ray's message of "Wed, 22 Feb 2012 22:30:19 +0530")
- User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Ayonam Ray <ayonam@xxxxxxxxx> writes:
> I'm wondering whether the compiler upon seeing an enum and an
> immediate value as the arguments to the builtin is assuming that the
> builtin does not have or create any dependence on the rest of the
> code.
That by itself should not do it unless you mark the builtin function as
pure or const, which you did not do.
I suspect that what is happening is something related but slightly
different. The problem is not the arguments you are passing to the
builtin function, it's the fact that your other code does not depend on
memory, and gcc knows that a function call can only affect memory,
nothing else. So gcc thinks that your other operations are independent
of your builtin function.
I think you are going to have to expand your builtin function into an
asm very early on, and that asm is going to have to clobber all
registers. There may be some other way to implement this, but offhand I
don't know of one.
Ian
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]