schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (11/24/88)
Bug Report for GCC:
-------------------
Problem : gcc 1.31 generates invalid asm syntax on sun 4 for the following
program.
1.) Version : gcc 1.31
-----------
2.) Input Program :
-----------------
char *_new(); char _delete(); char *_vec_new(); char _vec_delete();
struct _iobuf {
int __iobuf__cnt ;
unsigned char *__iobuf__ptr ;
unsigned char *__iobuf__base ;
int __iobuf__bufsiz ;
short __iobuf__flag ;
char __iobuf__file ;
};
extern struct _iobuf _iob [];
extern int _flsbuf ();
extern int _filbuf ();
extern struct _iobuf *fopen ();
extern struct _iobuf *fdopen ();
extern struct _iobuf *freopen ();
extern long ftell ();
extern char *fgets ();
extern char *gets ();
extern int puts ();
extern int fputs ();
extern int printf ();
extern int fprintf ();
extern int sprintf ();
extern int scanf ();
extern int fscanf ();
extern int sscanf ();
extern int fread ();
extern int fwrite ();
extern int fclose ();
extern int fflush ();
extern int fseek ();
extern char rewind ();
extern int getw ();
extern int fgetc ();
extern struct _iobuf *popen ();
extern int pclose ();
extern int putw ();
extern int fputc ();
extern char setbuf ();
extern int ungetc ();
extern char exit ();
extern int abort ();
extern int atoi ();
extern double atof ();
extern long atol ();
extern struct _iobuf *tmpfile ();
extern char *ctermid ();
extern char *cuserid ();
extern char *tempnam ();
extern char *tmpnam ();
extern char perror ();
extern int errno ;
extern char *sys_errlist [];
extern int sys_nerr ;
extern unsigned char *_bufendtab [];
/* enum state_value */
/* enum open_mode */
struct streambuf { /* sizeof streambuf == 26 */
char *_streambuf_base ;
char *_streambuf_pptr ;
char *_streambuf_gptr ;
char *_streambuf_eptr ;
char _streambuf_alloc ;
struct _iobuf *_streambuf_fp ;
int (**_streambuf__vptr )();
};
int _streambuf_overflow ();
int _streambuf_underflow ();
static int (*streambuf__vtbl[])() = {
(int(*)()) _streambuf_overflow ,
(int(*)()) _streambuf_underflow , 0};
int _streambuf_doallocate ();
/* overload _ctor: */
extern int close ();
struct filebuf { /* sizeof filebuf == 32 */
char *_streambuf_base ;
char *_streambuf_pptr ;
char *_streambuf_gptr ;
char *_streambuf_eptr ;
char _streambuf_alloc ;
struct _iobuf *_streambuf_fp ;
int (**_streambuf__vptr )();
int _filebuf_fd ;
char _filebuf_opened ;
};
int _filebuf_overflow ();
int _filebuf_underflow ();
static int (*filebuf__vtbl[])() = {
(int(*)()) _filebuf_overflow ,
(int(*)()) _filebuf_underflow , 0};
struct filebuf *_filebuf_open ();
/* overload _ctor: */
struct circbuf { /* sizeof circbuf == 26 */
char *_streambuf_base ;
char *_streambuf_pptr ;
char *_streambuf_gptr ;
char *_streambuf_eptr ;
char _streambuf_alloc ;
struct _iobuf *_streambuf_fp ;
int (**_streambuf__vptr )();
};
int _circbuf_overflow ();
int _circbuf_underflow ();
static int (*circbuf__vtbl[])() = {
(int(*)()) _circbuf_overflow ,
(int(*)()) _circbuf_underflow , 0};
struct whitespace { /* sizeof whitespace == 2 */
char _dummy; };
extern char *oct ();
extern char *dec ();
extern char *hex ();
extern char *chr ();
extern char *str ();
extern char *form ();
struct ostream { /* sizeof ostream == 6 */
struct streambuf *_ostream_bp ;
short _ostream_state ;
};
/* overload _lshift: */
struct ostream *_ostream__lshiftFPC__ ();
struct ostream *_ostream__lshiftFUL__ ();
struct ostream *_ostream__lshiftFL__ ();
struct ostream *_ostream__lshiftFD__ ();
struct ostream *_ostream__lshiftFRCstreambuf___ ();
struct ostream *_ostream__lshiftFRCwhitespace___ ();
struct ostream *_ostream__lshiftFRCcommon___ ();
struct ostream *_ostream_put ();
/* overload _ctor: */
struct istream { /* sizeof istream == 12 */
struct streambuf *_istream_bp ;
struct ostream *_istream_tied_to ;
char _istream_skipws ;
short _istream_state ;
};
/* overload _rshift: */
struct istream *_istream__rshiftFPC__ ();
struct istream *_istream__rshiftFRC__ ();
struct istream *_istream__rshiftFRS__ ();
struct istream *_istream__rshiftFRI__ ();
struct istream *_istream__rshiftFRL__ ();
struct istream *_istream__rshiftFRF__ ();
struct istream *_istream__rshiftFRD__ ();
struct istream *_istream__rshiftFRCstreambuf___ ();
struct istream *_istream__rshiftFRCwhitespace___ ();
struct istream *_istream__rshiftFRCcommon___ ();
/* overload get: */
struct istream *_istream_getFPC_I_I__ ();
struct istream *_istream_getFRCstreambuf__I__ ();
struct istream *_istream_putback ();
/* overload _ctor: */
extern char eatwhite ();
extern struct istream cin ;
extern struct ostream cout ;
extern struct ostream cerr ;
extern struct whitespace WS ;
extern int errno ;
extern int errno ;
extern int signgam ;
extern int abs ();
extern double atof ();
extern double frexp ();
extern double ldexp ();
extern double modf ();
extern double j0 ();
extern double j1 ();
extern double jn ();
extern double y0 ();
extern double y1 ();
extern double yn ();
extern double erf ();
extern double erfc ();
extern double exp ();
extern double log ();
extern double log10 ();
extern double pow ();
extern double sqrt ();
extern double floor ();
extern double ceil ();
extern double fmod ();
extern double fabs ();
extern double gamma ();
extern double hypot ();
extern int matherr ();
extern double sinh ();
extern double cosh ();
extern double tanh ();
extern double sin ();
extern double cos ();
extern double tan ();
extern double asin ();
extern double acos ();
extern double atan ();
extern double atan2 ();
struct exception { /* sizeof exception == 32 */
int _exception_type ;
char *_exception_name ;
double _exception_arg1 ;
double _exception_arg2 ;
double _exception_retval ;
};
struct complex { /* sizeof complex == 16 */
double _complex_re ;
double _complex_im ;
};
char _complex__asplus ();
char _complex__asminus ();
char _complex__asmul ();
char _complex__asdiv ();
extern int _neFCcomplex__Ccomplex___ ();
extern int _eqFCcomplex__Ccomplex___ ();
extern struct complex _divFCcomplex__Ccomplex___ ();
extern struct complex _mulFCcomplex__Ccomplex___ ();
extern struct complex _minusFCcomplex__Ccomplex___ ();
extern struct complex _minusFCcomplex___ ();
extern struct complex _plusFCcomplex__Ccomplex___ ();
extern struct complex sqrtFCcomplex___ ();
extern struct complex sinhFCcomplex___ ();
extern struct complex sinFCcomplex___ ();
extern struct complex polar ();
extern struct complex powFCcomplex__Ccomplex___ ();
extern struct complex powFCcomplex__D__ ();
extern struct complex powFCcomplex__I__ ();
extern struct complex powFD_Ccomplex___ ();
extern struct complex logFCcomplex___ ();
extern struct complex expFCcomplex___ ();
extern struct complex coshFCcomplex___ ();
extern struct complex cosFCcomplex___ ();
extern struct complex conj ();
extern double arg ();
extern double norm ();
extern double absFCcomplex___ ();
extern double imag ();
extern double real ();
struct ostream *_lshiftFRCostream__Ccomplex___ ();
struct istream *_rshiftFRCistream__RCcomplex___ ();
extern int errno ;
static struct complex complex_zero ;
struct c_exception { /* sizeof c_exception == 56 */
int _c_exception_type ;
char *_c_exception_name ;
struct complex _c_exception_arg1 ;
struct complex _c_exception_arg2 ;
struct complex _c_exception_retval ;
};
extern struct complex logFCcomplex___ ();
extern struct complex coshFCcomplex___ ();
extern struct complex sinhFCcomplex___ ();
extern struct complex expFCcomplex___ ();
extern int complex_error ();
extern struct complex cosFCcomplex___ (_au0_z )struct complex _au0_z ;
{
struct complex _au1_y ;
( ( ((& _au1_y )-> _complex_re = (- _au0_z . _complex_im )),
( ((& _au1_y )-> _complex_im = _au0_z . _complex_re ),
(((& _au1_y )))) ) ) ;
return coshFCcomplex___ ( _au1_y ) ;
}
;
extern struct complex coshFCcomplex___ (_au0_z )struct complex _au0_z ;
{
double _au1_cosh_x ;
double _au1_sinh_x ;
double _au1_cos_y ;
double _au1_sin_y ;
struct c_exception _au1_ex ;
extern int write ();
( ( ( ( ( ( ((& (& _au1_ex )-> _c_exception_arg1 )-> _complex_re = 0.0 ), ( ((&
(& _au1_ex )-> _c_exception_arg1 )-> _complex_im = 0.0 ), (((& (& _au1_ex )->
_c_exception_arg1 )))) ) ) , ( (
((& (& _au1_ex )-> _c_exception_arg2 )-> _complex_re = 0.0 ),
( ((& (& _au1_ex )-> _c_exception_arg2 )-> _complex_im = 0.0 ), (((&
(& _au1_ex )-> _c_exception_arg2 )))) ) ) ) ,
( ( ((& (& _au1_ex )-> _c_exception_retval )-> _complex_re =
0.0 ), ( ((& (& _au1_ex )-> _c_exception_retval )-> _complex_im = 0.0 ),
(((& (& _au1_ex )-> _c_exception_retval )))) ) )
) , ( ((& _au1_ex )-> _c_exception_name = "cosh"),
( ((& _au1_ex )-> _c_exception_arg1 = _au0_z ), ( ((&
_au1_ex )-> _c_exception_arg2 = complex_zero ),
( ((& _au1_ex )-> _c_exception_type = 0 ),
( ((& _au1_ex )-> _c_exception_retval = (*( (
((& (& _au1_ex )-> _c_exception_retval )-> _complex_re =
((double )0 )), ( ((& (& _au1_ex )-> _c_exception_retval )-> _complex_im = 0.0 ),
(((& (& _au1_ex )-> _c_exception_retval )))) ) ) )), (((& _au1_ex )))) ) ) ) ) )
) ;
if (((_au0_z . _complex_im < 0 )?
(- _au0_z . _complex_im ): _au0_z . _complex_im )> 1e7 )
{
_au1_ex . _c_exception_type = 3 ;
if (! complex_error ( (struct c_exception *)(& _au1_ex )) )
errno = 34 ;
return _au1_ex . _c_exception_retval ;
}
_au1_cos_y = cos ( _au0_z . _complex_im ) ;
_au1_sin_y = sin ( _au0_z . _complex_im ) ;
if (_au0_z . _complex_re > 88.0 )
{
_au1_ex . _c_exception_type = 3 ;
_au1_ex . _c_exception_retval . _complex_im = ((_au1_sin_y >= 0 )? 99.e999 :
(- 99.e999 ));
_au1_ex . _c_exception_retval . _complex_re = ((_au1_cos_y >= 0 )? 99.e999 :
(- 99.e999 ));
if (! complex_error ( (struct c_exception *)(& _au1_ex )) )
errno = 34 ;
return _au1_ex . _c_exception_retval ;
}
else if (_au0_z . _complex_re < (- 88.0 ))
{
_au1_ex . _c_exception_type = 3 ;
_au1_ex . _c_exception_retval . _complex_im = ((_au1_sin_y >= 0 )? (- 99.e999 ):
99.e999 );
_au1_ex . _c_exception_retval . _complex_re = ((_au1_cos_y >= 0 )? 99.e999 :
(- 99.e999 ));
if (! complex_error ( (struct c_exception *)(& _au1_ex )) )
errno = 34 ;
return _au1_ex . _c_exception_retval ;
}
else
{
double _au2_pos_exp ;
double _au2_neg_exp ;
_au2_pos_exp = exp ( _au0_z . _complex_re ) ;
_au2_neg_exp = (1 / _au2_pos_exp );
_au1_cosh_x = ((_au2_pos_exp + _au2_neg_exp )/ 2 );
_au1_sinh_x = ((_au2_pos_exp - _au2_neg_exp )/ 2 );
}
{
struct complex _au0__V6 ;
return ( ( ( ((& _au0__V6 )-> _complex_re = (_au1_cos_y * _au1_cosh_x )),
( ((& _au0__V6 )-> _complex_im = (_au1_sin_y *_au1_sinh_x )),
(((& _au0__V6 )))) ) ) , _au0__V6 ) ;
} }
;
extern char _STIcos_c_ ()
{ ( ( (((struct complex *)(& complex_zero ))-> _complex_re = ((double )0 )),
( (((struct complex *)(&complex_zero ))-> _complex_im = ((double )0 )),
((((struct complex *)(& complex_zero ))))) ) ) ;
}
;
/* the end */
3.) Command Used : gcc -O
----------------
4.) Files used :
--------------
tm.h -> tm-sparc.h
md -> sparc.md
config.h -> xm-sunos4.h
aux-output.c -> output-sparc.c
5.) Machine(s) used :
-------------------
Sun 4 running Sun4.0
6.) Compiler diagnostics :
------------------------
gcc version 1.31
/usr/public/lib/gcc/gcc-cpp -v -I/cd/ua/schmidt/include/ -undef -D__GNU__ -D__GNUC__ -Dsparc -Dsun -Dunix -D__OPTIMIZE__ cos-bug.1.28.c /tmp/cca16444.cpp
GNU CPP version 1.31
/usr/public/lib/gcc/gcc-cc1 /tmp/cca16444.cpp -quiet -dumpbase cos-bug.1.28.c -finline-functions -O -version -o /tmp/cca16444.s
cos-bug.1.28.c: In function coshFCcomplex___:
cos-bug.1.28.c:440: warning: floating point number exceeds range of `double'
cos-bug.1.28.c:441: warning: floating point number exceeds range of `double'
cos-bug.1.28.c:442: warning: floating point number exceeds range of `double'
cos-bug.1.28.c:443: warning: floating point number exceeds range of `double'
cos-bug.1.28.c:451: warning: floating point number exceeds range of `double'
cos-bug.1.28.c:452: warning: floating point number exceeds range of `double'
cos-bug.1.28.c:453: warning: floating point number exceeds range of `double'
cos-bug.1.28.c:454: warning: floating point number exceeds range of `double'
GNU C version 1.31 (sparc) compiled by GNU C version 1.31.
as /tmp/cca16444.s -o cos-bug.1.28.o
as: "/tmp/cca16444.s", line 58: error: statement syntax
as: "/tmp/cca16444.s", line 61: error: statement syntax
7). asm output
--------------
.data
.align 4
_streambuf__vtbl:
.word __streambuf_overflow
.word __streambuf_underflow
.word 0
.align 4
_filebuf__vtbl:
.word __filebuf_overflow
.word __filebuf_underflow
.word 0
.align 4
_circbuf__vtbl:
.word __circbuf_overflow
.word __circbuf_underflow
.word 0
.text
.align 4
.global _cosFCcomplex___
.proc 1
_cosFCcomplex___:
!#PROLOGUE# 0
save %sp,-128,%sp
!#PROLOGUE# 1
st %i0,[%fp+68]
st %i1,[%fp+72]
st %i2,[%fp+76]
st %i3,[%fp+80]
ld [%fp+64],%o0
ld [%fp+76],%f2
ld [%fp+80],%f3
fnegs %f2,%f2
std %f2,[%fp-32]
ld [%fp+68],%o4
ld [%fp+72],%o5
std %o4,[%fp-24]
st %o0,[%sp+64]
ld [%fp-32],%o0
ld [%fp-28],%o1
ld [%fp-24],%o2
call _coshFCcomplex___,0
ld [%fp-20],%o3
ret
restore
.align 8
LC0:
.double 0r0.00000000000000000000e+00
LC1:
.ascii "cosh\0"
.align 8
LC2:
.double 0r1.00000000000000000000e+07
.align 8
LC3:
.double 0r8.80000000000000000000e+01
.align 8
LC4:
.double 0rInfinity /* problem */
.align 8
LC5:
.double 0r-Infinity /* problem */
.align 8
LC6:
.double 0r-8.80000000000000000000e+01
.align 8
LC7:
.double 0r1.00000000000000000000e+00
.align 8
LC8:
.double 0r2.00000000000000000000e+00
.align 4
.global _coshFCcomplex___
.proc 1
/* truncated for brevity */