From: buers AT gmx DOT de (Dieter Buerssner) Newsgroups: comp.os.msdos.djgpp Subject: Re: NEED HELP WITH GRX Date: 21 Mar 2000 19:35:32 GMT Lines: 50 Message-ID: <8b8iu3$4jkep$1@fu-berlin.de> References: <38D0C9F8 DOT 40BECC63 AT ujf-grenoble DOT fr> <8aqsuf$42fh4$1 AT fu-berlin DOT de> <38D16047 DOT 3C9F9A95 AT ujf-grenoble DOT fr> <8avn7q$49908$1 AT fu-berlin DOT de> NNTP-Posting-Host: pec-1-189.tnt1.s2.uunet.de (149.225.1.189) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: fu-berlin.de 953667332 4837849 149.225.1.189 (16 [17104]) X-Posting-Agent: Hamster/1.3.13.0 User-Agent: Xnews/03.02.04 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Robert Bruce wrote: >I really don't know if I am lying to the compiler or not, I "do" know >that the patch in the FAQ produces code that produces an immediate GPF >on my system. I "do" know that the code I listed in my initial reply >produces code that executes correctly on my system. Don't know what >else I can say. It seems, that the original patch from the FAQ is wrong. When you say, that your code works, it is quite probable that in the original patch, the renumbering of the registers was forgotten. %4 should have been changed to %5 etc, because there is one new output operand. Now, you have commented this new output operand out. The numbering is correct again. But gcc cannot know anymore, that the input shift in register ecx will be clobbered. So, when gcc needs shift again, it can assume, it is still in register ecx, but it isn't. The produced code may work anyway, and it may even depend on compiler options. With one option gcc may assign shift to the register ecx outside of the loop -> failure. This is at least my interpretation of the gcc manual. From the gcc manual in "Assembler instructions with C operands": : It is an error for a clobber description to overlap an input or :output operand (for example, an operand describing a register class :with one member, mentioned in the clobber list). Most notably, it is :invalid to describe that an input operand is modified, but unused as :output. It has to be specified as an input and output operand anyway. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :Note that if there are only unused output operands, you will then also :need to specify `volatile' for the `asm' construct, as described below. [The anyway seems misleading to me] This paragraph is not in older versions of the gcc manual, and also older version of gcc behave different (you can put the input register into the clobber list). Many programmers, including the GRX programmer(s) and the Linux kernel developers, relied on the old behaviour ... [...] >As a general note if I trust the tool (a sometimes mistaken >assumption) just removing an offending statement frequently results in >correct behaviour. It doesn't make any sense to me, to just remove offending statements. Regards, Dieter