delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/04/04/15:32:35

To: drupp AT cs DOT washington DOT edu (Douglas Rupp)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu, gnat-report AT cs DOT nyu DOT edu
Subject: Re: Problem with generated assembly code
Date: Mon, 04 Apr 1994 11:46:56 -0700
From: Darryl Okahata <darrylo AT sr DOT hp DOT com>

> Below is the debugger output from a program generated by the Gnu C back_end
> via the DOS port of the Gnat Ada compiler.  As you can see it blows up at:
> 
> 000013b4: 0000           add     [eax],al            eax=00000000
> 
> I don't know assembly very well, but it appears that something should be
> in eax other than all zeroes.  Something went wrong somewhere and I need

     I don't have the time to track down other people's bugs, but I
would like to point something out.  First of all, look at the debugger
output:

> __ada_test2():
> 000013aa: 55             push    ebp                 ebp=7ffffc54
> >> s
> 000013ab: 89e5           mov     ebp,esp             esp=7ffffc4c
> 000013ad: 83c4fe         add     esp,-2              esp=7ffffc4c
> 000013b0: 6668ff00       push    255
> 000013b4: 0000           add     [eax],al            eax=00000000
> eax=00000000  ebx=7ffffc68  ecx=00005010  edx=7ffffc74
> esi=00000000  edi=00000000  ebp=7ffffc4c     RF       UP IE TF PL NZ AC PO CY
> ds=0048 es=0048 fs=0048 gs=0038 ss:esp=0048:7ffffc48 cs=00d8
> exception 14 (0xe) occurred, error code=0
> 000013b4: 0000           add     [eax],al            eax=00000000

Now, look at the assembly code:

> __ada_test2:
> 	pushl %ebp
> 	movl %esp,%ebp
> 	addl $-2,%esp
> 	pushw $255
> 	movl %ebp,%ecx
> 	call _set_char_literal_value.0

Notice the discrepancy.  Now, think about what types of bugs could cause
this.  I'd say that either the assembler is generating bad code
(unlikely), or you've got a memory stomping bug somewhere.

     -- Darryl Okahata
	Internet: darrylo AT sr DOT hp DOT com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion or policy of Hewlett-Packard or of the
little green men that have been following him all day.

- Raw text -


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