This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/33171] New: GCC outputs invalid assembly when using -O2
- From: "ianw at gelato dot unsw dot edu dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Aug 2007 05:01:32 -0000
- Subject: [Bug inline-asm/33171] New: GCC outputs invalid assembly when using -O2
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
The following example, when built with -O2, results in
~$ .gcc -O2 -o test2 ~/test2.c
/tmp/cc6SGh7Z.s: Assembler messages:
/tmp/cc6SGh7Z.s:16: Error: syntax error; found `,' but expected `('
/tmp/cc6SGh7Z.s:16: Error: junk at end of line: `,0'
This code is extracted from libatomic-ops (see http://bugs.debian.org/432654)
and is causing build failures for some powerpc packages.
4.2.1 and SVN don't fully build on my powerpc64 system (fails comparing objects
between stage2->3) but using the partially built stage3 xgcc the same problem
happens.
Thanks!
--- testcase ---
static inline unsigned long
load_acquire(volatile unsigned long *addr)
{
unsigned long result;
__asm__ __volatile__ (
"lwz %0,%1\n"
"cmpw cr7,%0,%0\n"
"bne- cr7,1f\n"
"1: isync\n"
: "=r" (result)
: "m"(*addr) : "memory", "cc");
return result;
}
int
main(int argc, char **argv) {
unsigned long *value, i, res;
res = load_acquire(value + i);
return 0;
}
--- end ---
--
Summary: GCC outputs invalid assembly when using -O2
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ianw at gelato dot unsw dot edu dot au
GCC host triplet: powerpc64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33171