delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/29/13:53:02

Date: Mon, 29 Dec 1997 10:52:05 -0800 (PST)
Message-Id: <199712291852.KAA11528@adit.ap.net>
Mime-Version: 1.0
To: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: error optimisation with label

At 08:56  12/28/1997 +0100, Thomas Demmer wrote:
>leger_v AT bluewin DOT ch wrote:
>> 
>> Could someone tell me why when I put any labels (ex : loop3 : ...)
>> in my inline assembly, I obtain when I compile my program, only with
>> optimisation -O3 :
>> "fatal error : loop3 already defined"
>
>Because -O3 enables loop unrolling, so the name loop3 gets reused.
>I think you have to use something like unnamed labels or relative
>jumps, but better wait for the answer of an assembler guru ;-)
Right. In general, you shouldn't use named labels in inline assembly, since
you don't know what other ones the compiler might have defined. The correct
solution is to use local labels, which have meaning only to the code close
to them. For information, see this Info node:

info "as" "symbols" "symbol names"

and scroll down about 20 lines.

Incidentally, I think the reason for the conflict is not that `-O3' does
loop unrolling (because it doesn't), but that it enables function inlining.
The compiler inlines the function containing your asm code, which means it
shows up in multiple places.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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