This is the mail archive of the 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]

Bad code for ia64 with function pointer

I have submitted a bug #7349 archived here :

The generated code for the program is not correct.It seem that without -O the 
third call are not correct. This code compiler correctly on Solaris/sparc,
FreeBSD/i386, linux/i386.

The 3.0.x branch of gcc has the same bug.

An idea somebody, or a turnaround ?

It seem strange that the intel compiler on redhat has the same bug !
(I have submit a bug report on intel forum without answer now :-( )


#include <string.h>
#include <stdio.h>

typedef  int (*pfiii)(int, int);

int add(int a, int b)
  return a+b;
} /* add */

int main(int argc, char * argv[])
  char codeBuffer1[1024];
  char *codeBuffer2 = (char *) calloc (1024, 1);
  pfiii myFunction;
  (void) printf("%d %d\n", 6, add (6, 36));
  bcopy (add, codeBuffer1, 1024);
  myFunction = (pfiii) codeBuffer1;
  (void) printf("%d %d\n", 7, myFunction(7, 35));
  bcopy (add, codeBuffer2, 1024);
  myFunction = (pfiii) codeBuffer2;
  (void) printf("%d %d\n", 8, myFunction(8, 34));
  free (codeBuffer2);
  return 0;

% PRiSM, Université de Versailles
% Tel: 01 39 25 43 44        45, Av. des États Unis 78000 Versailles
% Il reste -82215720 secondes jusqu'au 01/01/2000

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