www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/01/17:35:08

Date: Tue, 1 Nov 1994 09:31:19 +0500
From: ronis AT onsager DOT chem DOT mcgill DOT ca (David Ronis)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: -O3 bug(?)
Cc: bug-gcc AT prep DOT ai DOT mit DOT edu

I've been trying to compile emacs-19.27 for Desqview/X using djgpp (gcc
2.6.0, as 2.3).  In one of the modules, msdos.c, there is some in-line
assembly code (appended below) that breaks the assembly step of gcc.
If I compile with the -O3 and -m486 flags, I get the following error:

e:/djgpp/tmp/cca01062: Assembler messages:
e:/djgpp/tmp/cca01062:1938: Fatal error:Symbol output_string1 already defined.

The problem goes away if I compile with the -O2 flag.  Since the -O3
flag enables inlining, what seems to be happening is that this block
is inlined wherever output_string is used leading to multiple
definitions of the label output_string1 in the same block of code. 

Is this a bug? 

David Ronis

Here's the code:

________________________In emacs-19.27/src/msdos.c______________________

static void
output_string (x, y, s, c, a)
     int x, y, c;
     unsigned char *s;
     unsigned char a;
{
  char *t = (char *)ScreenPrimary + 2 * (x + ScreenCols () * y);
  asm volatile
    ("  movl   %1,%%eax
        call   dosmemsetup
        movl   %%eax,%%edi
        movb   %0,%%ah
        movl   %2,%%ecx
        movl   %3,%%esi
output_string1:
        movb   (%%esi),%%al
        movw   %%ax,%%gs:(%%edi)
        addl   $2,%%edi
        incl   %%esi
        decl   %%ecx
        jne    output_string1"
     : /* no output */
     : "m" (a), "g" (t), "g" (c), "g" (s)
     : "%eax", "%ecx", /* "%gs",*/ "%esi", "%edi");
}


- Raw text -


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