delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/29/22:38:17

Xref: news-dnh.mv.net comp.os.msdos.djgpp:704
Path: news-dnh.mv.net!mv!news.sprintlink.net!cs.utexas.edu!news.cs.utah.edu!cc.usu.edu!sl18g
From: sl18g AT cc DOT usu DOT edu
Newsgroups: comp.os.msdos.djgpp
Subject: Bugs in 386 GAS?
Date: 28 Jun 95 20:49:06 MDT
Organization: Utah State University
Lines: 34
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

	Hi, I just recently installed djgpp.  I've been very impressed with the
compiler, but the assembler really has left me somewhat confused.  After a few
grueling minutes of mastering the AT&T syntax ;-), I proceeded to write some
simple test routines.  They ran with no trouble, so I moved on to a rather
lengthy program.  The assembly routines wouldn't work!  I spent hours trying to
find the bugs, but whatever I did, nothing worked.  Finally, as frustrated
programmers often do, I started to blame the assembler.  Much to my surprise, I
was right.  I assembled the following code in gas 2.5.2:

original		after disassembly
add %cl,%ch		add %cl,%ch	[fine]
add %ch,%cl		add %ebp,%ecx	[?!?]
add %bl,%al		add %ebx,%eax   [?!?]
add %al,%bl		add %al,%bl	[fine]
mov $5,%al		mov $5,%eax	[?!?]
mov $5,%ah		mov $5,%ah	[fine]
mov %al,%ah		mov %al,%ah	[fine]
mov %ah,%al		mov %esp,%eax	[?!?]
mov %ax,%bx		mov %ax,%bx	[fine]
mov %bx,%ax		mov %ebx,%eax	[?!?]

	Before you ask, I was using a 32-bit debugger made specifically for
djgpp and I wrote test programs to verify that these instructions really were
being assembled incorrectly.
 	It seems that any line of assembly using the 32-bit registers will
assemble fine.  Since the compiler never uses anything else, that's why it
still works.  But everything else will only assemble correctly about 50% of the
time.  I can't even do "out %al,%dx"!

	So...  Is this a known problem?  Am I the only one experiencing it?  I
reinstalled and recompiled gas with no luck.  Is there a patch?  I'm going
crazy here!  

Thanks for the help!  -Nate (sl18g AT cc DOT usu DOT edu)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019