This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/15905] New: frstor in assembler inline offsets in memory by 4


I'm on a vacation and doing some hobby project and came across a minor fault 
when using assembler inlines. Result is the my linux console totally freezes 
(Can't even CAD the console, but ALT SysRQ still works). This problem must be a 
race since it doesn't trigger when system is loaded, or processes is straced. 
I'm not able to update my versions for some weeks due to my vacation, so 
problems might be fixes. I find this both to be a bug in gcc, that again 
triggers a kernel bug.

I need confirmation if this is an issue with gcc here (looks like the frstor is 
off by 4 compared to the address fsave gets).

GCC version 3.3 and 3.3.2
Kernel version 2.4.26-rc1 vanilla

And this is my .c file written down by hand (might contain typos):


#include <sys/time.h>
#include <signal.h>
#include <unistd.h>

static void Handler(int ignore)
{
 char fpubuf[108];
 __asm__ __volatile__ ("fsave %0\n" : : "m"(fpubuf));
 write(2, "*", 1);
 __asm__ __volatile__ ("frstor %0\n" : : "m"(fpubuf));
}

int main(int argc, char *argv[])
{
 struct itimerval spec;
 signal(SIGALRM, Handler);
 spec.it_interval.tv_sec=0;
 spec.it_interval.tv_usec=100;
 spec.it_value.tv_sec=0;
 spec.it_value.tv_usec=100;
 setitimer(ITIMER_REAL, &spec, NULL);
 while(1)
  write(1, ".", 1);

 return 0;
}

-- 
           Summary: frstor in assembler inline offsets in memory by 4
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stian at nixia dot no
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86-linux-gnu
  GCC host triplet: x86-linux-gnu
GCC target triplet: x86-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15905


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]