need to copy bit-field before passing as parameter by reference

Shin-Ming Liu shin@cthulhu.engr.sgi.com
Wed May 19 09:56:00 GMT 1999


egcs-2.91.60
Pentium2/Linux
g++ test.cxx

# 1 "j2.cxx"
# 1 "/usr/include/stdio.h" 1 3

# 1 "/usr/include/libio.h" 1 3

# 1 "/usr/include/features.h" 1 3
 
# 117 "/usr/include/features.h" 3

# 1 "/usr/include/sys/cdefs.h" 1 3

# 1 "/usr/include/features.h" 1 3

# 222 "/usr/include/features.h" 3

# 22 "/usr/include/sys/cdefs.h" 2 3

# 54 "/usr/include/sys/cdefs.h" 3

# 86 "/usr/include/sys/cdefs.h" 3

# 205 "/usr/include/features.h" 2 3

# 1 "/usr/include/gnu/stubs.h" 1 3

# 219 "/usr/include/features.h" 2 3

# 29 "/usr/include/libio.h" 2 3

# 1 "/usr/include/_G_config.h" 1 3

# 1 "/usr/include/gnu/types.h" 1 3
 
typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;

typedef unsigned long long int __u_quad_t;
typedef long long int __quad_t;
# 41 "/usr/include/gnu/types.h" 3

typedef __quad_t *__qaddr_t;

typedef __u_quad_t __dev_t;		 
typedef __u_int __uid_t;		 
typedef __u_int __gid_t;		 
typedef __u_long __ino_t;		 
typedef __u_int __mode_t;		 
typedef __u_int __nlink_t; 		 
typedef long int __off_t;		 
typedef __quad_t __loff_t;		 
typedef int __pid_t;			 
typedef int __ssize_t;			 

typedef struct
  {
    int __val[2];
  } __fsid_t;				 

 
typedef int __daddr_t;			 
typedef char *__caddr_t;
typedef long int __time_t;
typedef long int __swblk_t;		 

typedef long int __clock_t;

 
typedef unsigned long int __fd_mask;
 
typedef struct
  {
     
    __fd_mask fds_bits[1024  / (8 * sizeof (__fd_mask)) ];
  } __fd_set;


typedef int __key_t;

typedef unsigned short int __ipc_pid_t;


# 9 "/usr/include/_G_config.h" 2 3

# 1
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stddef.h"
1 3
# 19
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stddef.h"
3

# 61
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stddef.h"
3

# 131
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stddef.h"
3

typedef unsigned int size_t;

# 271
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stddef.h"
3

typedef unsigned int  wint_t;

# 317
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stddef.h"
3

# 13 "/usr/include/_G_config.h" 2 3

typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));

# 31 "/usr/include/libio.h" 2 3
# 1
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stdarg.h"
1 3

typedef void *__gnuc_va_list;

# 116
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stdarg.h"
3
# 202
"/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/include/stdarg.h"
3
# 47 "/usr/include/libio.h" 2 3

# 64 "/usr/include/libio.h" 3
# 98 "/usr/include/libio.h" 3
struct _IO_jump_t;  struct _IO_FILE;
typedef void _IO_lock_t;
struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;
  int _pos;
# 182 "/usr/include/libio.h" 3

};

struct _IO_FILE {
  int _flags;		 
  char* _IO_read_ptr;	 
  char* _IO_read_end;	 
  char* _IO_read_base;	 
  char* _IO_write_base;	 
  char* _IO_write_ptr;	 
  char* _IO_write_end;	 
  char* _IO_buf_base;	 
  char* _IO_buf_end;	 
  char *_IO_save_base;  
  char *_IO_backup_base;   
  char *_IO_save_end;  

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;
  int _blksize;
  __off_t   _offset;


   
  unsigned short _cur_column;
  char _unused;
  char _shortbuf[1];

   

  _IO_lock_t *_lock;
};





struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;





 
typedef struct
{
  __ssize_t   (*read)  (struct _IO_FILE *, void *, __ssize_t  )  ;
  __ssize_t   (*write)  (struct _IO_FILE *, const void *, __ssize_t  ) 
;
  __off_t   (*seek)  (struct _IO_FILE *, __off_t  , int)  ;
  int (*close)  (struct _IO_FILE *)  ;
} _IO_cookie_io_functions_t;

 
struct _IO_cookie_file {
  struct _IO_FILE file;
  const void *vtable;
  void *cookie;
  _IO_cookie_io_functions_t io_functions;
};



extern "C" {


extern int __underflow  (_IO_FILE*)  ;
extern int __uflow  (_IO_FILE*)  ;
extern int __overflow  (_IO_FILE*, int)  ;
extern int _IO_getc  (_IO_FILE *__fp)  ;
extern int _IO_putc  (int __c, _IO_FILE *__fp)  ;
extern int _IO_feof  (_IO_FILE *__fp)  ;
extern int _IO_ferror  (_IO_FILE *__fp)  ;

extern int _IO_peekc_locked  (_IO_FILE *__fp)  ;

extern void _IO_flockfile  (_IO_FILE *)  ;
extern void _IO_funlockfile  (_IO_FILE *)  ;
extern int _IO_ftrylockfile  (_IO_FILE *)  ;

extern int _IO_vfscanf  (_IO_FILE*, const char*, __gnuc_va_list , int*) 
;
extern int _IO_vfprintf  (_IO_FILE*, const char*, __gnuc_va_list )  ;
extern __ssize_t   _IO_padn  (_IO_FILE *, int, __ssize_t  )  ;
extern size_t   _IO_sgetn  (_IO_FILE *, void*, size_t  )  ;

extern __off_t   _IO_seekoff  (_IO_FILE*, __off_t  , int, int)  ;
extern __off_t   _IO_seekpos  (_IO_FILE*, __off_t  , int)  ;

extern void _IO_free_backup_area  (_IO_FILE*)  ;


}

# 29 "/usr/include/stdio.h" 2 3
# 69 "/usr/include/stdio.h" 3

typedef struct _IO_FILE FILE;
typedef __off_t   fpos_t;

# 1 "/usr/include/stdio_lim.h" 1 3

# 74 "/usr/include/stdio.h" 2 3
 
extern FILE *stdin, *stdout, *stderr;  
extern "C" {

extern void clearerr  (FILE*)  ;
extern int fclose  (FILE*)  ;
extern int feof  (FILE*)  ;
extern int ferror  (FILE*)  ;
extern int fflush  (FILE*)  ;
extern int fgetc  (FILE *)  ;
extern int fgetpos  (FILE* fp, fpos_t *__pos)  ;
extern char* fgets  (char*, int, FILE*)  ;
extern FILE* fopen  (__const char*, __const char*)  ;
extern FILE* fopencookie  (void *__cookie, __const char *__mode,
			       _IO_cookie_io_functions_t __io_functions)  ;
extern int fprintf  (FILE*, __const char* __format, ...)  ;
extern int fputc  (int, FILE*)  ;
extern int fputs  (__const char *__str, FILE *__fp)  ;
extern size_t fread  (void*, size_t, size_t, FILE*)  ;
extern FILE* freopen  (__const char*, __const char*, FILE*)  ;
extern int fscanf  (FILE *__fp, __const char* __format, ...)  ;
extern int fseek  (FILE* __fp, long int __offset, int __whence)  ;
extern int fsetpos  (FILE* __fp, __const fpos_t *__pos)  ;
extern long int ftell  (FILE* __fp)  ;
extern size_t fwrite  (__const void*, size_t, size_t, FILE*)  ;
extern int getc  (FILE *)  ;
extern int getchar  (void)  ;
extern char* gets  (char*)  ;
extern void perror  (__const char *)  ;
extern int printf  (__const char* __format, ...)  ;
extern int putc  (int, FILE *)  ;
extern int putchar  (int)  ;
extern int puts  (__const char *__str)  ;
extern int remove  (__const char*)  ;
extern int rename  (__const char* __old, __const char* __new)  ;
extern void rewind  (FILE*)  ;
extern int scanf  (__const char* format, ...)  ;
extern void setbuf  (FILE*, char*)  ;
extern void setlinebuf  (FILE*)  ;
extern void setbuffer  (FILE*, char*, int)  ;
extern int setvbuf  (FILE*, char*, int __mode, size_t __size)  ;
extern int sprintf  (char*, __const char* __format, ...)  ;
extern int sscanf  (__const char* string, __const char* __format, ...) 
;
extern FILE* tmpfile  (void)  ;
extern char* tmpnam  (char*)  ;

extern char* tmpnam_r  (char*)  ;


extern char *tempnam  (__const char *__dir, __const char *__pfx)  ;

extern char *__stdio_gen_tempname  (char *__buf, size_t bufsize,
					__const char *dir, __const char *pfx,
					int dir_search, size_t *lenptr,
					FILE **streamptr)  ;
extern int ungetc  (int c, FILE* fp)  ;
extern int vfprintf  (FILE *fp, char __const *fmt0, __gnuc_va_list )  ;
extern int vprintf  (char __const *fmt, __gnuc_va_list )  ;
extern int vsprintf  (char* string, __const char* format, __gnuc_va_list
)  ;
extern void __libc_fatal  (__const char *__message)  
     __attribute__ ((__noreturn__));


extern int dprintf  (int, __const char *, ...)  ;
extern int vdprintf  (int, __const char *, __gnuc_va_list )  ;
extern int vfscanf  (FILE*, __const char *, __gnuc_va_list )  ;
extern int __vfscanf  (FILE*, __const char *, __gnuc_va_list )  ;
extern int vscanf  (__const char *, __gnuc_va_list )  ;
extern int vsscanf  (__const char *, __const char *, __gnuc_va_list )  ;
extern int __vsscanf  (__const char *, __const char *, __gnuc_va_list ) 
;


# 177 "/usr/include/stdio.h" 3



extern FILE *fdopen  (int, __const char *)  ;
extern int fileno  (FILE*)  ;
extern FILE* popen  (__const char*, __const char*)  ;
extern int pclose  (FILE*)  ;




 
extern char *ctermid  (char *__buf)  ;

 
extern char *cuserid  (char * __buf)  ;



extern int snprintf  (char *, size_t, __const char *, ...)  ;
extern int __snprintf  (char *, size_t, __const char *, ...)  ;
extern int vsnprintf  (char *, size_t, __const char *, __gnuc_va_list ) 
;
extern int __vsnprintf  (char *, size_t, __const char *, __gnuc_va_list
)  ;


# 214 "/usr/include/stdio.h" 3


extern int __underflow  (struct _IO_FILE*)  ;
extern int __overflow  (struct _IO_FILE*, int)  ;


extern int sys_nerr;
extern const char *const sys_errlist[];






 

extern void clearerr_locked  (FILE *)  ;
extern void clearerr_unlocked  (FILE *)  ;
extern int feof_locked  (FILE *)  ;
extern int feof_unlocked  (FILE *)  ;
extern int ferror_locked  (FILE*)  ;
extern int ferror_unlocked  (FILE*)  ;
extern int fileno_locked  (FILE *)  ;
extern int fileno_unlocked  (FILE *)  ;
extern int fclose_unlocked  (FILE *)  ;
extern int fflush_locked  (FILE *)  ;
extern int fflush_unlocked  (FILE *)  ;
extern size_t fread_unlocked  (void *, size_t, size_t, FILE *)  ;
extern size_t fwrite_unlocked  (const void *, size_t, size_t, FILE *)  ;

extern int fputc_locked  (int, FILE*)  ;
extern int fputc_unlocked  (int, FILE*)  ;
extern int getc_locked  (FILE *)  ;
extern int getchar_locked  (void)  ;
extern int putc_locked  (int, FILE *)  ;
extern int putchar_locked  (int)  ;









 
extern void flockfile  (FILE *)  ;
extern void funlockfile  (FILE *)  ;
extern int ftrylockfile  (FILE *)  ;

extern int getc_unlocked  (FILE *)  ;
extern int getchar_unlocked  (void)  ;
extern int putc_unlocked  (int, FILE *)  ;
extern int putchar_unlocked  (int)  ;
















}





# 1 "j2.cxx" 2


typedef enum {
  OPERATOR_UNKNOWN = 0,
  OPERATOR_FIRST = 1,
  OPR_ABS = 1,
  OPR_ADD = 2,
  OPR_AGOTO = 3,
  OPR_ALTENTRY = 4,
  OPR_ARRAY = 5,
  OPR_ARRAYEXP = 6,
  OPR_ARRSECTION = 7,
  OPR_ASHR = 8,
  OPR_ASSERT = 9,
  OPERATOR_LAST = 9
} OPERATOR;

inline bool not_equal(const OPERATOR &x, const OPERATOR &y) {
  return !(x == y);
}

class STMTREP {
public:
  OPERATOR  _opr:8;
  int     _rtype:8;         
  int     _desc:8;          
  int   *_lhs;           
  int   *_rhs;           

  bool not_agoto();
}; 

bool STMTREP::not_agoto(void) { return not_equal(_opr, OPR_AGOTO); }

STMTREP s = {OPR_AGOTO, 1, 2, 0, 0};

main() {
  if (s.not_agoto())
    printf("fail\n");
  else
    printf("pass\n");
}


More information about the Gcc-bugs mailing list