From: Andreas Schwab <schwab@suse.de>
To: linuxppc-dev@lists.linuxppc.org
Subject: Re: asm inline
Date: Mon, 02 Dec 2002 14:35:17 +0100 [thread overview]
Message-ID: <jevg2cee7e.fsf@sykes.suse.de> (raw)
In-Reply-To: <20021202131158.GA2427@ibrium.se> (Samuel Rydh's message of "Mon, 2 Dec 2002 14:11:58 +0100")
Samuel Rydh <samuel@ibrium.se> writes:
|> Sure, here is a stand alone program that triggers the problem:
|>
|> ----------------------------------------------------------------
|>
|> #include <stdio.h>
|> typedef unsigned long ulong;
|>
|> static __inline__ void st_le32( ulong volatile *addr, ulong val )
|> {
|> __asm__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr) );
|> }
|>
|> int
|> main( int argc, char **argv )
|> {
|> int b;
|> st_le32( (ulong*)&b, 0 );
|> testing( b );
This violates the aliasing rules. The compiler is free to assume that
st_le32 does not modify b, because you are invoking undefined behaviour.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2002-12-02 13:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-29 16:08 asm inline Samuel Rydh
2002-11-29 16:21 ` Gabriel Paubert
2002-11-29 17:49 ` Samuel Rydh
2002-12-02 11:17 ` Franz Sirl
2002-12-02 13:11 ` Samuel Rydh
2002-12-02 13:35 ` Andreas Schwab [this message]
2002-12-02 14:14 ` Kevin B. Hendricks
2002-12-02 14:29 ` Andreas Schwab
2002-12-02 14:37 ` Kevin B. Hendricks
2002-12-02 14:51 ` Franz Sirl
2002-12-02 15:08 ` Kevin B. Hendricks
2002-12-02 15:11 ` Kevin B. Hendricks
2002-12-02 15:35 ` Franz Sirl
2002-12-02 15:45 ` Kevin B. Hendricks
2002-12-02 15:12 ` Franz Sirl
2002-12-02 17:00 ` Samuel Rydh
2002-12-02 17:53 ` Gabriel Paubert
2002-12-02 19:17 ` Samuel Rydh
2002-11-29 16:30 ` Benjamin Herrenschmidt
2002-12-02 14:29 ` Gabriel Paubert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jevg2cee7e.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=linuxppc-dev@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.