Re: Bug: gcc ignores ebp clobber
Michael Brown <[email protected]>
| Newsgroups | gmane.network.etherboot.user |
|---|---|
| Message-ID | <[email protected]> |
On Monday 17 August 2009 10:42:00 Bernhard Kauer wrote:
> > When fixing, we need to be aware that using push/pop within inline asm
> > can itself introduce potential silent bugs, if a potentially stack-based
> > value is used in a non-register constraint occurring after the push
> > instruction.
>
> There are currently no memory constraints in the asm statements that
> clobber ebp. But you have to keep in mind this when changing them or
> writing new ones...
Two thoughts:
1. Is it possible to use an output constraint that specifies %ebp? I thought
that we should be able to do something like
unsigned int discard_ebp;
__asm__ ( "..." : "=B" ( discard_ebp ) ... );
which provides an alternative way to tell gcc that the asm potentially
overwrites %ebp, rather than using the clobber list. However, when I try
this I get an error message "Impossible constraint in asm". I'm not sure
that "B" is the right constraint letter, so it may just be that I have my
syntax incorrect.
2. Commit 54fbd1 "[build] Keep gcc 4.4 happy" has the log message
"gcc 4.4 adds another few warnings, and also seems to complain if we
place %ebp in the clobber list for any inline asm."
Is it possible that gcc4.4 does check correctly for %ebp being live across
asms? It definitely *doesn't* complain about %ebp in all clobber lists, as
the log message suggests, since there are other instances of %ebp in clobber
lists that gcc4.4 did not complain about.
Michael
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july