alphaev5-dec-osf4.0b mips-tfile.c, missing init might be a bug

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Mon Nov 9 08:23:00 GMT 1998


	I'm getting the following warning on my OSF4 box:

 > mips-tfile.c:1129: warning: missing initializer for `init_file.fdr.reserved'

	I looked at the initialization for init_file.fdr, and its
clearly wrong because the definition for the type "struct fdr" in
/usr/include/sym.h has reordered/different/extra members depending on:
"#if defined(__mips64) || defined(__alpha)". 

	The reordered extra struct members occur in the very beginning
so values following are offset into the wrong members in the
initialization.  Below are the definitions from sym.h.  I think given
this, it might be better to bzero the struct and initialize the proper
members explicitly rather than trying to do #ifdef tricks on the
initialization in mips-tfile.c; especially since other (unknown)
platforms may have other orderings I don't know about. 

	Opinions?

		--Kaveh


 > typedef struct fdr {
 > #if defined(__mips64) || defined(__alpha)
 >         unsigned long   adr;    /* memory address of beginning of file */
 >         long    cbLineOffset;   /* byte offset from header for this file ln's */
 >         long    cbLine;         /* size of lines for this file */
 >         long    cbSs;           /* number of bytes in the ss */
 >         int     rss;            /* file name (of source, if known) */
 >         int     issBase;        /* file's string space */
 >         int     isymBase;       /* beginning of symbols */
 >         int     csym;           /* count file's of symbols */
 >         int     ilineBase;      /* file's line symbols */
 >         int     cline;          /* count of file's line symbols */
 >         int     ioptBase;       /* file's optimization entries */
 >         int     copt;           /* count of file's optimization entries */
 >         int     ipdFirst;       /* start of procedures for this file */
 >         int     cpd;            /* count of procedures for this file */
 >         int     iauxBase;       /* file's auxiliary entries */
 >         int     caux;           /* count of file's auxiliary entries */
 >         int     rfdBase;        /* index into the file indirect table */
 >         int     crfd;           /* count file indirect entries */
 >         unsigned lang: 5;       /* language for this file */
 >         unsigned fMerge : 1;    /* whether this file can be merged */
 >         unsigned fReadin : 1;   /* true if it was read in (not just created) */
 >         unsigned fBigendian : 1;/* if set, was compiled on big endian machine */
 >                                 /*      aux's will be in compile host's sex */
 >         unsigned glevel : 2;    /* level this file was compiled with */
 >         unsigned fTrim : 1;     /* whether the symbol table was trimmed */
 >         unsigned reserved : 21;  /* reserved for future use */
 > #else
 >         unsigned long   adr;    /* memory address of beginning of file */
 >         long    rss;            /* file name (of source, if known) */
 >         long    issBase;        /* file's string space */
 >         long    cbSs;           /* number of bytes in the ss */
 >         long    isymBase;       /* beginning of symbols */
 >         long    csym;           /* count file's of symbols */
 >         long    ilineBase;      /* file's line symbols */
 >         long    cline;          /* count of file's line symbols */
 >         long    ioptBase;       /* file's optimization entries */
 >         long    copt;           /* count of file's optimization entries */
 >         unsigned short ipdFirst;/* start of procedures for this file */
 >         short   cpd;            /* count of procedures for this file */
 >         long    iauxBase;       /* file's auxiliary entries */
 >         long    caux;           /* count of file's auxiliary entries */
 >         long    rfdBase;        /* index into the file indirect table */
 >         long    crfd;           /* count file indirect entries */
 >         unsigned lang: 5;       /* language for this file */
 >         unsigned fMerge : 1;    /* whether this file can be merged */
 >         unsigned fReadin : 1;   /* true if it was read in (not just created) */
 >         unsigned fBigendian : 1;/* if set, was compiled on big endian machine */
 >                                 /*      aux's will be in compile host's sex */
 >         unsigned glevel : 2;    /* level this file was compiled with */
 >         unsigned reserved : 22;  /* reserved for future use */
 >         long    cbLineOffset;   /* byte offset from header for this file ln's */
 >         long    cbLine;         /* size of lines for this file */
 > #endif
 >         } FDR, *pFDR;
 > 
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Icon CMT Corp.



More information about the Gcc-bugs mailing list