From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: inefficiency of GCC output code & -O problem Date: Mon, 10 Apr 2000 21:25:14 +0400 Organization: MTU-Intel ISP Lines: 32 Message-ID: <38F20E7A.3330E9A4@mtu-net.ru> NNTP-Posting-Host: ppp96-85.dialup.mtu-net.ru Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: gavrilo.mtu.ru 955387496 64010 212.188.96.85 (10 Apr 2000 17:24:56 GMT) X-Complaints-To: usenet-abuse AT mtu DOT ru NNTP-Posting-Date: 10 Apr 2000 17:24:56 GMT X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en,ru To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi! 1st question... Why GCC output too much redundant code? I mean, it always put values to the CPU registers, although it's possible to make the same operation w/o taking registers? Also why GCC does type cast of byte/word <-> dword values so awful? It allocates some extra bytes on the stack, put values there and get them back... Is it a normal thing, if one instruction that adds something to ESP(or EBP) is followed by sutracting instruction that works with the same register? ... I'll find some extra info later ... 2nd question... Why the "-O2" switch works normally for pure C source code and makes compiler failing on the source with inline assembly (in the .S file made out of such .C an error encounters: "Error: Error: Missing ')' assumed" "Error: Error: Ignoring junk `(%ebp))' after expression")? W/o the -O2 switch it's compiled fine. Isn't it a little bit strange? Thanks in advance. Alexei A. Frounze ----------------------------------------- Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru