delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/03/23:26:17

Message-Id: <199610040234.TAA04831@bluesky.com>
Comments: Authenticated sender is <kbaca AT bluesky DOT skygames DOT com>
From: "Kevin Baca" <kbaca AT skygames DOT com>
To: djgpp AT delorie DOT com
Date: Thu, 3 Oct 1996 19:37:56 +0000
MIME-Version: 1.0
Subject: Re: Optimization and Inline ASM

> Dear DJGPPers,
> 
> I am puzzled at this error:
> c:/djgpp/tmp\cccaaaaa: Assembler messages:
> c:/djgpp/tmp\cccaaaaa:66: Fatal error:Symbol loc1 already defined.
> 
> This error only occurs if I use the optimize switch:
> 
> gcc myfile.cpp -O3
> 
> Compiles flawlessly if I use just:
> gcc myfile.cpp
> 
> The code giving me the problem is:
> 
> void myproc()
> {
>   __asm__ __volatile__("
>         cli\n
>         movw $0x3DA, %dx\n
> loc1:\n
>         inb  %dx, %al\n
>         andb $8,  %al\n
>         jnz loc1\n
> loc2:\n
>         inb  %dx, %al\n
>         andb $8, %al\n
>         jz loc2\n");
> }
> 
> What am I doing wrong? Help me, or I'll be bold soon! This error has driven
> me NUTS!!!


Try using different labels.

When I get errors like this I find it's easier to diagnose if I produce 
the assembly output of my C file and then compile that.  Then I can see 
exactly what's causing the problem.

Like this:

gcc -S file.c   (this produces file.s - the assembly output)
gcc file.s

-Kevin

- Raw text -


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