Results 1 to 2 of 2
I was just debugging a program and noticed some _really_ strange assembler in the program. Look at this: Code: addr1: ... push %ebp call addr2 ... addr2: mov (%esp), %ebp ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-23-2003 #1
- Join Date
- Oct 2001
- Täby, Sweden
Mysterious compiler output
I was just debugging a program and noticed some _really_ strange assembler in the program. Look at this:
addr1: ... push %ebp call addr2 ... addr2: mov (%esp), %ebp ret
Why ever would the compiler want to do something like that?! Why doesn't it satisfy with just push %ebp?! I've seen similar things before, like "mov %esi, %esi" and similar stuff, and I just don't get it. The call instruction happens to align the next instruction at an even multiple of 8, but that can't be it on a i386, right? Especially using a call instruction to meaningless code to align?! There isn't even a loop afterwards, not that it would matter anyway.
Can anyone think of a reason to do that, or has anyone seen the reason in the gcc sources or anything?
I'm really confused.
- 02-24-2003 #2
- Join Date
- Jun 2002
- San Antonio
it might be a gcc bug, it also might be alignment code like you said. I don't play with gcc code much, there are many many bad dragons hanging around in there. To try and change things in gcc is bad mojo.I respectfully decline the invitation to join your delusion.