Bug with using of %z0 in inline asm directives
Alexey Tigarev
tigra@klo.re.com.ua
Tue Feb 23 01:12:00 GMT 1999
Hello !
I have found such a bug in GCC compiler (egcs-2.90.29 980515 (egcs-1.0.3
release))
Here's bug description :
I defined a template function :
template <class Value>
void test()
{
Value arg;
int shift;
scanf("%d%d", &shift, &arg);
ROR(shift, arg);
printf("%d\n", arg);
}
and used in it the following macro :
#define ROR(arg, shift) \
__asm__ volatile ("ror%z0 %b1, %0" : "=r" (arg) : "c" (shift), "0" (arg))
GCC output was:
test_asm_macro.cc: In function `void test()':
test_asm_macro.cc:11: Internal compiler error 40.
test_asm_macro.cc:11: Please submit a full bug report to `egcs-bugs@cygnus.com'.
Version of compiler :
egcs-2.90.29 980515 (egcs-1.0.3 release)
Here's 'test_asm_macro.cc' :
//////////////////////////// test_asm_macro.cc ////////////////////////////
#include <stdio.h>
#define ROR(arg, shift) \
__asm__ volatile ("ror%z0 %b1, %0" : "=r" (arg) : "c" (shift), "0" (arg))
template <class Value>
void test()
{
Value arg;
int shift;
scanf("%d%d", &shift, &arg);
ROR(shift, arg);
printf("%d\n", arg);
}
void main()
{
test<int>();
}
////////////////////////// End of test_asm_macro.cc ///////////////////////
The same error occured when I removed template function :
///////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#define ROR(arg, shift) \
__asm__ volatile ("ror%z0 %b1, %0" : "=r" (arg) : "c" (shift), "0" (arg))
void main()
{
int arg;
int shift;
scanf("%d%d", &shift, &arg);
ROR(shift, arg);
printf("%d\n", arg);
}
////////////////////////////////////////////////////////////////////////////
SY: Tigra [ UNIX ] [ RL ] [ IMEM ] [ OHN ] [ ACM ]
atigarev@acm.org http://www.rl.odessa.ua/~tigra ICQ #95550
More information about the Gcc-bugs
mailing list