This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11395] New: problem with asm inserts used as immediate arguments
- From: "hoffman at cray dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Jul 2003 20:27:14 -0000
- Subject: [Bug c/11395] New: problem with asm inserts used as immediate arguments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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