This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/42984] gcc produces broken code when passing struct pointer to static inline function with asm()
- From: "d dot g dot gorbachev at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Feb 2010 10:18:36 -0000
- Subject: [Bug inline-asm/42984] gcc produces broken code when passing struct pointer to static inline function with asm()
- References: <bug-42984-18600@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from d dot g dot gorbachev at gmail dot com 2010-02-06 10:18 -------
I believe that GCC is correct, and you should write
asm volatile ("swi #0" :: "r" (a), "m" (*t));
Quoting from <http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html>:
> Note that in the following example the memory input is
> necessary, otherwise GCC might optimize the store to x away
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42984