[Bug c/11395] New: problem with asm inserts used as immediate arguments
hoffman at cray dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 1 20:27:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11395
Summary: problem with asm inserts used as immediate arguments
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hoffman at cray dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: x86_64-suse-linux
GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux
the following fragment will segv gcc
t64.c: In function `main':
t64.c:16: internal error: Segmentation fault
#define __byte_swap_word(x) \
({ register unsigned short __X = (x); \
__asm ("xchgb %h1, %b1" \
: "=q" (__X) \
: "0" (__X)); \
__X; })
void foo(short x)
{
}
main()
{
foo(__byte_swap_word(5));
}
the problem goes away if:
the register declaration before __X is removed
the result of the macro is stored into a temporary before used as an argument
to foo
More information about the Gcc-bugs
mailing list