/* { dg-options "-m32 -mpreferred-stack-boundary=2 -mtune=i586 -O2
-fomit-frame-pointer -g" } */

struct T { unsigned short t1, t2, t3, t4, t5, t6, t7; };
struct S { struct T s1; unsigned short s2, s3; };
unsigned short v1;
int f1 (void);
int f2 (struct T);
int f3 (const char *);

int
foo (struct S *x, struct T y)
{
  unsigned short a, b, c;
  unsigned long d, e;
  int f = 0;
  y.t6 = 6;
  a = y.t7;
  b = y.t6;
  c = y.t7;
  switch (a)
    {
    case 8:
    case 7:
      c = 9;
      break;
    case 1:
    case 6:
    case 3:
      b = 16;
      c = 9;
      break;
    }
  if ((f = f1 ()))
    goto error;
  if ((f = f2 (y)))
    goto error;
  d = (long) &y;
  e = (long) &x->s1;
  __asm __volatile ("" : "+D" (e), "+S" (d) : : "memory");
  x->s2 = b;
  x->s3 = c;
  f3 ("foo");
  return 0;
error:
  if (v1 >= 1)
    f3 ("bar");
  return f;
}

(distilled from Linux kernel) ICEs in def_cfa_1, because stack was negatively
adjusted not in a multiple of -4 (i386 DWARF_CIE_DATA_ALIGNMENT).
I'd say the bug is in misaligning the stack, even when it is just for a few
instructions.


-- 
           Summary: ICE in def_cfa_1
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: i386-linux


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

Reply via email to