This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/34628] [4.2/4.3 Regression] problems with inlining on ARM



------- Comment #4 from tbm at cyrius dot com  2008-01-03 18:03 -------
Bugzilla wraps the testcase in a way that some commented out is no longer
commented out and so you don't see the segfault.  Here's the testcase again
with proper wrapping:

typedef unsigned short u16;
typedef unsigned char u8;

static void
do_segfault(u8 in_buf[], const u8 out_buf[], const int len)
{
  int i;

  for (i = 0; i < len; i++) {
    //SSVAL(in_buf, 2*i, SVAL(out_buf,2*i)); // more or less just a
                                             // byte-wise memcpy

    asm("nop\n");

    in_buf[2*i] = (   out_buf[2*i] | out_buf[(2*i)+1]<<8  ) & 0xFF;
 // in_buf[2*i] = out_buf[2*i];

    asm("nop\n");

    in_buf[(2*i)+1] =  ( out_buf[2*i] | out_buf[(2*i)+1]<<8 ) >> 8;
 // in_buf[(2*i)+1] = out_buf[(2*i)+1];

    asm("nop\n");
  }
}

int main(int argc, char *argv[])
{
  u8 outbuf[32] = "buffer     ";
  u8 inbuf[32] = "\f";

  asm("nop\n");
  do_segfault(inbuf, outbuf, 12);
  asm("nop\n");

  return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34628


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]