[Bug c/27144] New: segfault with -O2 on x86_64

tbm at cyrius dot com gcc-bugzilla@gcc.gnu.org
Thu Apr 13 13:09:00 GMT 2006


I get a segfault with 4.2.0 20060408 on x86_64.  It does not happen on i386.

(sid)3185:tbm@em64t: ~/delta/bin] cat mini.c
typedef struct { void *p; }
hvl_t;
test_vltypes_compound_vlen_vlen (void) {
  typedef struct {
    int i;
    float f;
    hvl_t v;
  }
  s1;
  s1 wdata[128];
  unsigned i, j, k;
  hvl_t *t1, *t2;
  for (i = 0; i < 128; i++) {
      wdata[i].i = i * 10;
      wdata[i].f = (float) ((i * 20) / 3.0);
      wdata[i].v.p = malloc ((i + 16) * sizeof (hvl_t));
      for (t1 = (wdata[i].v).p, j = 0; j < (i + 16); j++, t1++) {
          for (k = 0; k < j + 8; k++)
            ((unsigned int *) t1->p)[k] = i * 100 + j * 10 + k;
        }
    }
}
test_vltypes (void) {
}
(sid)3186:tbm@em64t: ~/delta/bin] /usr/lib/gcc-snapshot/bin/gcc -O1 -c mini.c
mini.c: In function 'test_vltypes_compound_vlen_vlen':
mini.c:16: warning: incompatible implicit declaration of built-in function
'malloc'
(sid)3187:tbm@em64t: ~/delta/bin] /usr/lib/gcc-snapshot/bin/gcc -O2 mini.c
mini.c: In function 'test_vltypes_compound_vlen_vlen':
mini.c:16: warning: incompatible implicit declaration of built-in function
'malloc'
mini.c:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
zsh: exit 1     /usr/lib/gcc-snapshot/bin/gcc -O2 mini.c
(sid)3188:tbm@em64t: ~/delta/bin]


-- 
           Summary: segfault with -O2 on x86_64
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbm at cyrius dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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



More information about the Gcc-bugs mailing list