Newsgroups: gnu.gcc.bug
Path: utzoo!utgpu!jarvis.csri.toronto.edu!turing.toronto.edu!chuck
From: chuck@turing.toronto.edu (Charles Pilkington)
Subject: GCC 1.31 mangles structure assignment on the SPARC
Message-ID: <88Dec8.145929est.4327@turing.toronto.edu>
Organization: University of Toronto, CSRI
Distribution: na
Date: Thu, 8 Dec 88 14:59:15 EST


/*

  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