A bug in GCC 2.95.2 for SPARC

James Cheng James.Cheng@eng.sun.com
Mon May 8 15:26:00 GMT 2000


Hi,

I am reporting a bug in GCC 2.95.2 for SPARC. For the example shown
below, the compiler is generating an unaligned double store when
storing parameter (d1+d2):

main+0x009c:        std     %f2, [%sp + 0x64]

This results in a bus error on an UltraSPARC based machine running
Solaris 2.6.

% cat test_gcc.c

#include <stdio.h>

int main()
{
  char c1[4] = "abc\0";
  int i1 = 1;
  int i2 = 2;
  int i3 = 3;
  int i4 = 4;
  int i5 = 5;
  int i6 = 6;
  double d1 = 1.0;
  double d2 = 2.0;
  
  printf("c1 = %s, i1 = %d, i2 = %d, i3 = %d, i4 = %d, i5 = %d, i6 = %d,\
  	 d1+d2 = %3.1f\n", c1, i1, i2, i3, i4, i5, i6, d1+d2);

  return 0;
}

% gcc -Wall -m32 -mcpu=ultrasparc test_gcc.c -o test_gcc

% test_gcc
Bus Error (core dumped)

% gcc -v
Reading specs from .../gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
gcc version 2.95.2 19991024 (release)

Thanks,

-James



More information about the Gcc-bugs mailing list