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]

gcc-2.95pre: crash in loop code (validate_change)


Hi,

the appended testcase (distilled from RH-6.0 xscreensaver) segfaults on
powerpc-linux-gnu, if compiled with -O2 or higher:

(gdb) r rorschach.i -quiet -O2 -o rorschach.s
Starting program: /home/fsirl/obj/cvsm/gcc/stage1/cc1 test.i -quiet -dumpbase test.c -O2 -version -o test.s
GNU C version gcc-2.95 19990522 (prerelease) (ppc-redhat-linux) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).

Program received signal SIGSEGV, Segmentation fault.
0x1a33c4c in validate_change (object=0x1be4468, loc=0x0, new=0x1bc59dc, in_group=0) at ../../../egcsm/gcc/recog.c:244
244       rtx old = *loc;
(gdb) bt
#0  0x1a33c4c in validate_change (object=0x1be4468, loc=0x0, new=0x1bc59dc, in_group=0) at ../../../egcsm/gcc/recog.c:244
#1  0x195e974 in strength_reduce (scan_start=0x1be3200, end=0x1be7158, loop_top=0x0, insn_count=67, loop_start=0x1be31c8, loop_end=0x1be7158,
    loop_cont=0x1be7050, unroll_p=0, bct_p=0) at ../../../egcsm/gcc/loop.c:4203
#2  0x1955f7c in scan_loop (loop_start=0x1be31c8, end=0x1be7158, loop_cont=0x1be7050, unroll_p=0, bct_p=0) at ../../../egcsm/gcc/loop.c:1172
#3  0x1953be8 in loop_optimize (f=0x1bcebd8, dumpfile=0x0, unroll_p=0, bct_p=0) at ../../../egcsm/gcc/loop.c:574
#4  0x180710c in rest_of_compilation (decl=0x1be21f8) at ../../../egcsm/gcc/toplev.c:3939
#5  0x1aee134 in finish_function (nested=0) at ../../../egcsm/gcc/c-decl.c:7268
#6  0x1ace5f4 in yyparse () at c-parse.y:313
#7  0x18053d8 in compile_file (name=0x7ffffcd4 "rorschach.i") at
../../../egcsm/gcc/toplev.c:3265 
#8  0x180a6ec in main (argc=9, argv=0x7ffffb94) at
../../../egcsm/gcc/toplev.c:5441
#9  0x16df7d4 in __libc_start_main () at ../sysdeps/powerpc/elf/libc-start.c:106

Franz.



typedef struct {
    int dummy;
    int width, height;		 
} XWindowAttributes;

typedef struct {
    short x, y;
} XPoint;
    
extern unsigned int ya_random (void);
extern int XDrawPoints(XPoint*, int);

static int iterations, offset;
static int  xsym, ysym;

static void
hurm (void)
{
  XWindowAttributes xgwa;
  int xlim, ylim, x, y, i;
  XPoint points [4];
  xlim = xgwa.width;
  ylim = xgwa.height;


  x = xlim/2;
  y = ylim/2;
  for (i = 0; i < iterations; i++)
    {
      int j = 0;
      x += ((ya_random()  % (1 + (offset << 1))) - offset);
      y += ((ya_random()  % (1 + (offset << 1))) - offset);
      points [j].x = x;
      points [j].y = y;
      j++;
      if (xsym)
	{
	  points [j].x = xlim - x;
	  points [j].y = y;
	  j++;
	}
      if (ysym)
	{
	  points [j].x = x;
	  points [j].y = ylim - y;
	  j++;
	}
      if (xsym && ysym)
	{
	  points [j].x = xlim - x;
	  points [j].y = ylim - y;
	  j++;
	}
	XDrawPoints (points, j);
    }
}


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