Xref: news-dnh.mv.net comp.os.msdos.djgpp:2637 Path: news-dnh.mv.net!mv!news.sprintlink.net!tank.news.pipex.net!pipex!howland.reston.ans.net!news.nic.surfnet.nl!tudelft.nl!liberator.et.tudelft.nl!news From: George van Venrooij Newsgroups: comp.os.msdos.djgpp Subject: Inline-asm and optimization Date: 14 Oct 1995 09:58:42 GMT Organization: Hogeschool Eindhoven Lines: 28 Nntp-Posting-Host: u86401.hi.ft.hse.nl To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp Take a look at the followig piece of code (incomplete): asm volatile("cdq; \ idivl %%ebx" : "=a" (var1) : "a" (var2), "b" (var3) : "ax", "dx"); This worked perfectly when I wasn't optimizing, but when using -O1, caused registers to be corrupted. I managed to get it working by listing "bx" with the other modified registers as well. I found this to be a little strange. I GCC loads ebx with the value I need, why doesn't it change it back to the value it had? Basically my question is: Do you have to list ALL registers (modified, in- and output) as modified? Or am I doing something wrong here? Thanks in advance, George van Venrooij george AT il DOT ft DOT hse DOT nl