🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Bruce Martin Sat, 03 Oct 1992 08:35
crash when optimizing inline function
#1250
Author: 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 ();
    }
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads