This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bad dead code detection ?
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: David Jobet <david dot jobet at free dot fr>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 25 Jun 2003 11:25:00 -0400
- Subject: Re: bad dead code detection ?
- References: <1056549175.3ef9a93736288@imp.free.fr>
On Wed, Jun 25, 2003 at 03:52:55PM +0200, David Jobet wrote:
> Hello,
>
> I try to write an exception handling library, and I'm forced to play with gcc
> inline assembly.
> You will find below a sample program.
>
> The trick is to register address of local labels in a global static table. Later
> when an exception is launched, I manage to jump to this label to do clean up.
> The problem is gcc detects the label cannot be reached and dead code elimination
> completely remove the exception handling code from the executable when compiled
> with -O3.
> When compiled without -03, the code is not removed, but the label is moved from
> the *good* location to the return label.
>
> I'm wondering if it's a bug, or if there is a way to prevent this.
> When one take the address of a local variable, it cannot be put in a register.
> I'm wondering if it should not be the same with code taking address of local
> labels ?
You simply can't do this: inline assembly must not change the control
flow of the program. Period. The compiler can not be expected to cope
with it.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer