I'm getting the following error.
claire:~/claire/gnu/b-sparc/gcc$ ./cc1 -da -O2 -quiet foo.c
foo.c: In function `foo':
foo.c:9: error: inconsistent operand constraints in an `asm'
The problem is store motion is "deleting" one of the asm volatile stores by
changing it to a store to a pseudo. grep for "Removing redundant" in
foo.c.08.gcse.
I realize asm volatiles are optimized more these days than in the 2.x days.
I guess one can debate how far one wants to take things as far as making
asm volatile's optimizable, but this case doesn't feel like it should be
optimizable.
p.s. yes, the asm is wrong for sparc. I just picked something simple for
illustration.
void
foo (int t, int* mp)
{
int x = 42;
int* mp2 = mp;
if (t == 2)
{
asm volatile ("store %1,%0" : "=m" (*(int*) mp) : "r" (x));
asm volatile ("store %1,%0" : "=m" (*(int*) mp2) : "r" (x));
}
if (t == 3)
{
*mp = 43;
*mp = 43;
}
}
--
Summary: store motion deletion of redundant stores doesn't
consider asm volatiles
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dje at transmeta dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: sparc-sun-solaris2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20639