🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1250

crash when optimizing inline function

#1250
From: Bruce Martin
Date: Sat, 03 Oct 1992 08:35
54 lines
1575 bytes
GCC version: 2.2.2 (also crashes the 9/25/92 snapshot)
Configuraton: i386-mach
Host: 386


Compile the enclosed code '-O2', and it will abort in allocate_reload_reg().

static inline char
_char_move_in(char *src)
{
    char val;
    asm volatile (
        "movb (%1), %0"
        : "=r" (val)
        : "r" (src));
    return val;
}

int move_string(char *src, char *dst, int max)
{
    int i = max;

    while (i-- > 0) {
        *dst = _char_move_in(src);
        dst++;
        if (!*src++)
            break;
    }
    return max - i;
}


It crashes when trying to perform a reload for this instruction (this output
is from the .lreg file):

(insn 39 37 41 (set (mem:QI (reg/v:SI 22))
       (asm_operands/v ("movb (%1), %0") ("=r") 0[
               (reg/v:SI 21)
           ]
           [
               (asm_input:SI ("r"))
           ]  ("crash.c") 9)) -1 (nil)
   (nil))


The code that it dies in is:

  /* We should have found a spill register by now.  */
  if (count == n_spills)
    {
      if (noerror)
        return 0;
      abort ();
    }
Technical Details
Message-ID: <9210032236.AA20658@oz.NeXT.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!ames!sun-barr!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!next.com!Bruce_Martin

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!ames!sun-barr!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!next.com!Bruce_Martin
From: Bruce_Martin@next.com (Bruce Martin)
Subject: crash when optimizing inline function
Message-ID: <9210032236.AA20658@oz.NeXT.COM>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 3 Oct 1992 08:35:54 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 55