Package: gcc-3.3 Version: 1:3.3.2-0pre4 Severity: normal
When compiling the attached code on i386, the compilers seems to generate an illegal intermediate assembly file that fails to assemble with following messages: [type2:lttk]$ gcc -o syscall_time syscall_time.c /tmp/cc3VnwUh.s: Assembler messages: /tmp/cc3VnwUh.s:118: Error: invalid character '=' in operand 1 /tmp/cc3VnwUh.s:126: Error: invalid character '=' in operand 1 /tmp/cc3VnwUh.s:201: Error: invalid character '=' in operand 1 /tmp/cc3VnwUh.s:211: Error: invalid character '=' in operand 1 /tmp/cc3VnwUh.s:293: Error: invalid character '=' in operand 1 /tmp/cc3VnwUh.s:303: Error: invalid character '=' in operand 1 [type2:lttk]$ Thanks, Alex Tsariounov -- System Information: Debian Release: testing/unstable Architecture: i386 Kernel: Linux type2 2.4.21-4-686-smp #1 SMP Sun Aug 3 00:31:17 EST 2003 i686 Locale: LANG=C, LC_CTYPE=C Versions of packages gcc-3.3 depends on: ii binutils 2.14.90.0.6-3 The GNU assembler, linker and bina ii cpp-3.3 1:3.3.2-0pre4 The GNU C preprocessor ii gcc-3.3-base 1:3.3.2-0pre4 The GNU Compiler Collection (base ii libc6 2.3.2-8 GNU C Library: Shared libraries an ii libgcc1 1:3.3.2-0pre4 GCC support library -- no debconf information
#include <stdlib.h> #include <stdio.h> #include <sys/time.h> #include <time.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #define mTICKNOW(T) __asm__ __volatile__("mov %0=ar.itc" : "=r"(T) :: "memory"); int main(int argc, char *argv[]) { unsigned long ii, jj, times, groups; long diff; double realtotal; unsigned long tick1, tick2, total; struct timeval tv; int fh; char buf[4096]; double mhz; FILE *fp; if (argc>1) times = atoi(argv[1]); else times = 100; if (argc>2) groups = atoi(argv[2]); else groups = 3; /* Get processor speed from /proc/cpuinfo */ fp=fopen("/proc/cpuinfo", "r"); if (!fp) exit(1); while (fgets(buf, 80, fp)) { if (strstr(buf, "cpu MHz")) { jj= sscanf(buf, "cpu MHz : %lf", &mhz); if (jj != 1) exit(1); break; } } if (jj!=1) exit(1); /* * gettimeofday() syscall */ realtotal = 0.0; total = 0; for (jj=0; jj<groups; jj++) { for (ii=0; ii<times; ii++) { mTICKNOW(tick1); gettimeofday(&tv, 0); mTICKNOW(tick2); total += (tick2 - tick1); } realtotal += ((double)total / times); total = 0; usleep(1000); } printf("Average call to gettimeofday(%d) lasts: %lf us\n", ii*groups, (realtotal/groups)/mhz); /* * read() syscall */ realtotal = 0.0; total = 0; fh = open(argv[0], O_RDONLY); for (jj=0; jj<groups; jj++) { for (ii=0; ii<times; ii++) { mTICKNOW(tick1); read(fh, buf, 4096); mTICKNOW(tick2); total += (tick2 - tick1); lseek(fh, 0, SEEK_SET); } realtotal += ((double)total / times); total = 0; usleep(1000); } close(fh); printf("Average call to read(%d) lasts: %lf us\n", ii*groups, (realtotal/groups)/mhz); /* * write() syscall (at end of syscall table) */ realtotal = 0.0; total = 0; fh = open("/tmp/xxx_tmp_syscall_test_xxx", (O_CREAT|O_RDWR), 0644); for (jj=0; jj<groups; jj++) { for (ii=0; ii<times; ii++) { mTICKNOW(tick1); write(fh, buf, 4096); mTICKNOW(tick2); total += (tick2 - tick1); lseek(fh, 0, SEEK_SET); } realtotal += ((double)total / times); total = 0; usleep(1000); } close(fh); printf("Average call to write(%d) lasts: %lf us\n", ii*groups, (realtotal/groups)/mhz); }