[gnu.gcc.bug] GCC 1.31 mangles structure assignment on the SPARC

chuck@turing.toronto.edu (Charles Pilkington) (12/08/88)

/*

  program illustrating problem with gcc structure assignment on the SPARC - 
  structure assignment code uses load and store double, which 
  craps out if structure is not on a double word boundary.

*/

struct s1 {
  int s1_foo1;
  int s1_foo2;
};

struct s2 {
    struct s1 s2_first;		/* this struct is on a double-word boundary */
    int s2_1;
    struct s1 s2_second;	/* ... and this struct is not		    */
};

struct s1 foo1;
struct s2 foo2;

main() {

    foo2.s2_first  = foo1;
    printf("we should get here\n");
    foo2.s2_second = foo1;
    printf("we should get here if structure assignment works\n");
}

-- 
Chuck Pilkington
	    Computer Systems Research Institute       University of Toronto
	    Usenet:	{linus, ihnp4, allegra, decvax, floyd}!utcsri!chuck
	    CSNET:	chuck@Toronto
	    ARPA:	chuck%Toronto@CSNet-Relay