Code that used to compile
Tim Prince
tprince@computer.org
Tue Nov 14 05:10:00 GMT 2000
Does it work better without the clobbers? I was just revising similar code, where I use the widely used form
unsigned long long a;
asm volatile("rdtsc":"=A" (a));
return a;
along with equivalent code pinched from other sources for other compilers. True, the error message is inappropriate in the sense
that it doesn't explain the problem.
----- Original Message -----
From: <Laurent.Kersten@alcatel.be>
To: <bug-gcc@gnu.org>
Sent: Tuesday, November 14, 2000 3:03 AM
Subject: Code that used to compile
>
>
> 1
> Dear sirs,
>
> I wrote a small C function that read the TSC counter of my Pentium processor. And this function worked well until a do a compiler
upgrade. The new compiler refuses to compile my code and give me a error message which, I think, is inappropriate.
>
> Output of gcc -v with the new compiler:
>
> Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.2/specs
> gcc version 2.95.2 19991024 (release)
>
> Error message from the new compiler (gcc -c rdtsc.c)
>
> rdtsc.c: In function `user_rdtsc':
> rdtsc.c:13: Invalid `asm' statement:
> rdtsc.c:13: fixed or forbidden register 0 (ax) was spilled for class AREG.
>
> Source Code :
>
> unsigned long long
> user_rdtsc (void)
> {
> union
> {
> unsigned long long time;
> unsigned long time_lh[2];
> }
> tsc;
> __asm__ __volatile__ ("rdtsc"
> :"=a" (tsc.time_lh[0]), "=d" (tsc.time_lh[1])
> :
> :"ax", "dx");
> return tsc.time;
> }
>
>
More information about the Gcc-bugs
mailing list