🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #921

bad IBM RT assembly code produced

#921
From: Karl Berry
Date: Tue, 11 Aug 1992 09:01
1110 lines
15898 bytes
GCC 2.2.2, on the (preprocessed) input file below, on an IBM RT running
4.3 BSD configured as `romp-aos', produces bad assembly code, as
illustrated in the log from gcc -v.  I include the assembly code after
the source and a form feed.

I presume GCC should still diagnose an error (constant too large or some
such).

For your information, changing the floating-point constant in the source
from ...e+308 to ...e+307 and ...e-308 to ...e-307 makes the problem go
away.  

Also, the line numbers the assembler reports don't seem to correlate
with anything, but seaching for `inf' will at least find one of the
problems.


karl@cs.umb.edu

gcc -v -g bad.i

gcc version 2.2.2
 /usr/local/gnu/lib/gcc-lib/romp-aos/2.2.2/cc1 bad.i -quiet -g -version -o /tmp/cc001351.s
GNU C version 2.2.2 compiled by GNU C version 2.2.1.
 as -o bad.o /tmp/cc001351.s
Assembler:
"/tmp/cc001351.s", line 256: Badly formatted floating point number.
"/tmp/cc001351.s", line 256: Badly formatted floating point number.
"/tmp/cc001351.s", line 442: "INF" is not followed by a ':' for a label definition
"/tmp/cc001351.s", line 558: "INF" is not followed by a ':' for a label definition
gcc: bad.o: No such file or directory

# 1 "bad.c"
 

















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




 
 
 






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




 
 
 





 



 





















# 15 "/usr/include/errno.h" 2 3



 







 




































 



 






 

	 













	 













	 



 




 

















 



 




# 19 "bad.c" 2

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



 
 
 





 










extern	char	_ctype_[];
















# 20 "bad.c" 2

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



 
 
 





 

extern double asinh(), acosh(), atanh();
extern double erf(), erfc();
extern double fabs(), floor(), ceil(); 
extern double modf(), ldexp(), frexp(), atof();
extern double sqrt(), cbrt();
extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2();
extern double expm1(), log1p(), exp(), log(), log10(), pow();
extern double sinh(), cosh(), tanh();
extern double hypot(), cabs(), lgamma();
extern double j0(), j1(), jn(), y0(), y1(), yn();






# 21 "bad.c" 2










extern int errno;





 

double
strtod (nptr, endptr)
     char *nptr;
     char **endptr;
{
  register char *s;
  short int sign;

   
  double num;

  int got_dot;			 
  int got_digit;		 

   
  long int exponent;

  if (nptr == 0 )
    {
      errno = 	22		;
      goto noconv;
    }

  s = nptr;

   
  while (((_ctype_+1)[*s]&010 ) )
    ++s;

   
  sign = *s == '-' ? -1 : 1;
  if (*s == '-' || *s == '+')
    ++s;

  num = 0.0;
  got_dot = 0;
  got_digit = 0;
  exponent = 0;
  for (;; ++s)
    {
      if (((_ctype_+1)[*s]&04 ) )
	{
	  got_digit = 1;

	   
	  if (num > 1.7976931348623167e+308  * 0.1)
	     






	    ++exponent;
	  else
	    num = (num * 10.0) + (*s - '0');

	   

	  if (got_dot)
	    --exponent;
	}
      else if (!got_dot && *s == '.')
	 
	got_dot = 1;
      else
	 
	break;
    }

  if (!got_digit)
    goto noconv;

  if (((*s)-'A'+'a')  == 'e')
    {
       
      int save = errno;
      char *end;
      long int exp;

      errno = 0;
      ++s;
      exp = strtol (s, &end, 10);
      if (errno == 	34		)
	{
	   


	  if (endptr != 0 )
	    *endptr = end;
	  if (exp < 0)
	    goto underflow;
	  else
	    goto overflow;
	}
      else if (end == s)
	 

	end = (char *) s - 1;
      errno = save;
      s = end;
      exponent += exp;
    }

  if (endptr != 0 )
    *endptr = (char *) s;

  if (num == 0.0)
    return 0.0;

   


  if (exponent < 0)
    {
      if (num < 2.2250738585072010e-308  * pow (10.0, (double) -exponent))
	goto underflow;
    }
  else if (exponent > 0)
    {
      if (num > 1.7976931348623167e+308  * pow (10.0, (double) -exponent))
	goto overflow;
    }

  num *= pow (10.0, (double) exponent);

  return num * sign;

overflow:
   
  errno = 	34		;
  return 1.7976931348623158e308   * sign;

underflow:
   
  if (endptr != 0 )
    *endptr = (char *) nptr;
  errno = 	34		;
  return 0.0;

noconv:
   
  if (endptr != 0 )
    *endptr = (char *) nptr;
  return 0.0;
}


	.globl .oVncs
	.set .oVncs,0
	.globl .oVgcc2.2.2
	.set .oVgcc2.2.2,0
gcc2_compiled.:
.stabs "/usr/local/src/gnu/shellutils-1.6/lib/",100,0,0,Ltext0
.stabs "bad.c",100,0,0,Ltext0
.text
Ltext0:
.stabs "int:t1=r1;-2147483648;2147483647;",128,0,0,0
.stabs "char:t2=r1;0;255;",128,0,0,0
.stabs "long int:t3=r1;-2147483648;2147483647;",128,0,0,0
.stabs "unsigned int:t4=r1;0;-1;",128,0,0,0
.stabs "long unsigned int:t5=r1;0;-1;",128,0,0,0
.stabs "short int:t6=r1;-32768;32767;",128,0,0,0
.stabs "long long int:t7=r1;0;-1;",128,0,0,0
.stabs "short unsigned int:t8=r1;0;65535;",128,0,0,0
.stabs "long long unsigned int:t9=r1;0;-1;",128,0,0,0
.stabs "signed char:t10=r1;-128;127;",128,0,0,0
.stabs "unsigned char:t11=r1;0;255;",128,0,0,0
.stabs "float:t12=r1;4;0;",128,0,0,0
.stabs "double:t13=r1;8;0;",128,0,0,0
.stabs "long double:t14=r1;8;0;",128,0,0,0
.stabs "void:t15=15",128,0,0,0
.data
	.align 2
_strtod:
	.long _.strtod, 0, 0
	.align 2
LC0:
	.double 0d0.00000000000000000000e+00
	.align 2
LC1:
	.long _strtol
	.align 2
LC2:
	.double 0d1.00000000000000000000e+01
	.align 2
LC3:
	.long _pow
.text
	.align 1
	.globl _strtod
	.globl _.strtod
_.strtod:
	.stabd 68,0,43
	stm r11,-56(r1)
	cas r14,r0,r0
	cal r13,-192(r1)
	cal r1,-164(r1)
	cal r15,36(r14)
	balr r15,r15
	st r2,176(r13)
	st r3,180(r13)
	.stabd 68,0,44
LBB2:
	.stabd 68,0,56
	l r0,176(r13)
	cis r0,0
	bne L2
	.stabd 68,0,58
	cal r0,22(r0)
	store r0,_errno,r11
	.stabd 68,0,59
	b L3
L2:
	.stabd 68,0,62
	l r12,176(r13)
	.stabd 68,0,65
L4:
	lcs r0,0(r12)
	nilz r4,r0,255
	loadc r3,__ctype_+1(r4)
	nilz r0,r3,8
	nilz r4,r0,255
	cis r4,0
	beq L5
	.stabd 68,0,66
	ais r12,1
	b L4
L5:
	.stabd 68,0,69
	lcs r4,0(r12)
	nilz r0,r4,255
	cil r0,45
	bne L6
	cal r0,65535(r0)
	b L7
L6:
	lis r0,1
L7:
	sth r0,62(r13)
	.stabd 68,0,70
	lcs r4,0(r12)
	nilz r0,r4,255
	cil r0,45
	beq L9
	lcs r4,0(r12)
	nilz r0,r4,255
	cil r0,43
	beq L9
	b L8
L9:
	.stabd 68,0,71
	ais r12,1
L8:
	.stabd 68,0,73
	l r0,16(r14)
	sts r0,56(r13)
	ls r0,12(r14)
	sts r0,52(r13)
	.stabd 68,0,74
	lis r0,0
	sts r0,48(r13)
	.stabd 68,0,75
	lis r0,0
	sts r0,44(r13)
	.stabd 68,0,76
	lis r0,0
	sts r0,40(r13)
L10:
	.stabd 68,0,79
	lcs r0,0(r12)
	nilz r4,r0,255
	loadc r3,__ctype_+1(r4)
	nilz r0,r3,4
	nilz r4,r0,255
	cis r4,0
	beq L13
	.stabd 68,0,81
	lis r0,1
	sts r0,44(r13)
	.stabd 68,0,84
	cal r15,88(r14)
	balr r15,r15
	ble L14
	.stabd 68,0,92
	ls r0,40(r13)
	ail r4,r0,1
	sts r4,40(r13)
	b L15
L14:
	.stabd 68,0,94
	cal r15,320(r14)
	balr r15,r15
	lcs r0,0(r12)
	nilz r4,r0,255
	ail r3,r4,-48
	cal r15,424(r14)
	balr r15,r15
	cal r15,508(r14)
	balr r15,r15
L15:
	.stabd 68,0,98
	ls r0,48(r13)
	cis r0,0
	beq L16
	.stabd 68,0,99
	ls r0,40(r13)
	ail r4,r0,-1
	sts r4,40(r13)
L16:
	.stabd 68,0,100
	b L17
L13:
	.stabd 68,0,101
	ls r0,48(r13)
	cis r0,0
	bne L18
	lcs r4,0(r12)
	nilz r0,r4,255
	cil r0,46
	bne L18
	.stabd 68,0,103
	lis r0,1
	sts r0,48(r13)
	b L19
L18:
	.stabd 68,0,106
	b L11
L19:
L17:
	.stabd 68,0,107
	.stabd 68,0,77
L12:
	ais r12,1
	b L10
L11:
	.stabd 68,0,109
	ls r0,44(r13)
	cis r0,0
	bne L20
	.stabd 68,0,110
	b L3
L20:
	.stabd 68,0,112
	lcs r4,0(r12)
	nilz r0,r4,255
	ail r4,r0,32
	cil r4,101
	bne L21
	.stabd 68,0,115
LBB3:
	load r4,_errno
	sts r4,36(r13)
	.stabd 68,0,119
	lis r0,0
	store r0,_errno,r11
	.stabd 68,0,120
	ais r12,1
	.stabd 68,0,121
	ail r0,r13,32
	cas r2,r12,r0
	cas r3,r0,r0
	lis r4,10
	ls r5,20(r14)
	cas r0,r5,r0
	bali r15,_.strtol
	sts r2,28(r13)
	.stabd 68,0,122
	load r4,_errno
	cil r4,34
	bne L22
	.stabd 68,0,127
	l r0,180(r13)
	cis r0,0
	beq L23
	.stabd 68,0,128
	l r4,180(r13)
	ls r0,32(r13)
	sts r0,0(r4)
L23:
	.stabd 68,0,129
	ls r0,28(r13)
	cis r0,0
	bhe L24
	.stabd 68,0,130
	b L25
	b L26
L24:
	.stabd 68,0,132
	b L27
L26:
	.stabd 68,0,133
	b L28
L22:
	.stabd 68,0,134
	ls r0,32(r13)
	c r0,r12
	bne L29
	.stabd 68,0,137
	ail r0,r12,-1
	sts r0,32(r13)
L29:
L28:
	.stabd 68,0,138
	ls r0,36(r13)
	store r0,_errno,r11
	.stabd 68,0,139
	ls r12,32(r13)
	.stabd 68,0,140
	ls r0,40(r13)
	ls r4,28(r13)
	a r0,r4
	sts r0,40(r13)
	.stabd 68,0,141
LBE3:
L21:
	.stabd 68,0,143
	l r0,180(r13)
	cis r0,0
	beq L30
	.stabd 68,0,144
	l r4,180(r13)
	sts r12,0(r4)
L30:
	.stabd 68,0,146
	cal r15,580(r14)
	balr r15,r15
	bne L31
	.stabd 68,0,147
	l r3,16(r14)
	ls r2,12(r14)
	b L1
L31:
	.stabd 68,0,152
	ls r0,40(r13)
	cis r0,0
	bhe L32
	.stabd 68,0,154
	ls r3,40(r13)
	twoc r4,r3
	cal r15,780(r14)
	balr r15,r15
	l r3,28(r14)
	ls r2,24(r14)
	cal r15,864(r14)
	balr r15,r15
	ls r15,32(r14)
	cas r0,r15,r0
	bali r15,_.pow
	cal r15,1000(r14)
	balr r15,r15
	cal r15,1072(r14)
	balr r15,r15
	cal r15,1144(r14)
	balr r15,r15
	bhe L33
	.stabd 68,0,155
	b L25
L33:
	.stabd 68,0,156
	b L34
L32:
	.stabd 68,0,157
	ls r0,40(r13)
	cis r0,0
	ble L35
	.stabd 68,0,159
	ls r3,40(r13)
	twoc r4,r3
	cal r15,780(r14)
	balr r15,r15
	l r3,28(r14)
	ls r2,24(r14)
	cal r15,864(r14)
	balr r15,r15
	ls r15,32(r14)
	cas r0,r15,r0
	bali r15,_.pow
	cal r15,1000(r14)
	balr r15,r15
	cal r15,1344(r14)
	balr r15,r15
	cal r15,1144(r14)
	balr r15,r15
	ble L36
	.stabd 68,0,160
	b L27
L36:
L35:
L34:
	.stabd 68,0,163
	cal r15,1416(r14)
	balr r15,r15
	l r3,28(r14)
	ls r2,24(r14)
	cal r15,864(r14)
	balr r15,r15
	ls r15,32(r14)
	cas r0,r15,r0
	bali r15,_.pow
	cal r15,1000(r14)
	balr r15,r15
	cal r15,1500(r14)
	balr r15,r15
	.stabd 68,0,165
	lh r3,62(r13)
	exts r4,r3
	cal r15,780(r14)
	balr r15,r15
	cal r15,1572(r14)
	balr r15,r15
	b L1
L27:
	.stabd 68,0,169
	cal r0,34(r0)
	store r0,_errno,r11
	.stabd 68,0,170
	lh r3,62(r13)
	exts r4,r3
	cal r15,780(r14)
	balr r15,r15
	cal r15,1740(r14)
	balr r15,r15
	b L1
L25:
	.stabd 68,0,174
	l r0,180(r13)
	cis r0,0
	beq L37
	.stabd 68,0,175
	l r4,180(r13)
	l r0,176(r13)
	sts r0,0(r4)
L37:
	.stabd 68,0,176
	cal r0,34(r0)
	store r0,_errno,r11
	.stabd 68,0,177
	l r3,16(r14)
	ls r2,12(r14)
	b L1
L3:
	.stabd 68,0,181
	l r0,180(r13)
	cis r0,0
	beq L38
	.stabd 68,0,182
	l r4,180(r13)
	l r0,176(r13)
	sts r0,0(r4)
L38:
	.stabd 68,0,183
	l r3,16(r14)
	ls r2,12(r14)
	b L1
	.stabd 68,0,184
LBE2:
	.stabd 68,0,184
L1:
	cal r15,1908(r14)
	balr r15,r15
	lm r11,108(r1)
	brx r15
	cal r1,164(r1)
	.long 0xdf07dfb8
	.byte 0x2d, 53
.data
	.align 2
# data area offset = 36
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x1d	# STOREM
	.byte 2
	.short 0x8001
	.byte 52, 0x80
	.byte 0xff,0x20 # (int) $
	.byte 0x30,0x1 # (int) 36(r1)
	.long 36
	.space 32
# data area offset = 88
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x08	# CMPT
	.byte 2
	.short 0x8001
	.byte 232, 0x80
	.byte 0x33,0xd # (double) 52(r13)
	.byte 0x23,0x0 # (double) $
	.long 52
	.double 0dINF
	.space 204
# data area offset = 320
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x15	# MUL
	.byte 3
	.short 0x8001
	.byte 104, 0x80
	.byte 0x13,0x1 # (double) fr1
	.byte 0x33,0xd # (double) 52(r13)
	.byte 0x23,0x0 # (double) $
	.space 2
	.long 52
	.double 0d1.00000000000000000000e+01
	.space 72
# data area offset = 424
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x14	# MOVE
	.byte 2
	.short 0x8001
	.byte 84, 0x80
	.byte 0x13,0x2 # (double) fr2
	.byte 0x0,0x3 # (int) r3
	.space 68
# data area offset = 508
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x02	# ADD
	.byte 3
	.short 0x8001
	.byte 72, 0x80
	.byte 0x33,0xd # (double) 52(r13)
	.byte 0x13,0x1 # (double) fr1
	.byte 0x13,0x2 # (double) fr2
	.space 2
	.long 52
	.space 48
# data area offset = 580
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x07	# CMP
	.byte 2
	.short 0x8001
	.byte 200, 0x80
	.byte 0x33,0xd # (double) 52(r13)
	.byte 0x23,0x0 # (double) $
	.long 52
	.double 0d0.00000000000000000000e+00
	.space 172
# data area offset = 780
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x14	# MOVE
	.byte 2
	.short 0x8001
	.byte 84, 0x80
	.byte 0x13,0x1 # (double) fr1
	.byte 0x0,0x4 # (int) r4
	.space 68
# data area offset = 864
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x14	# MOVE
	.byte 2
	.short 0x8001
	.byte 136, 0x80
	.byte 0x3,0x45 # (double) r4
	.byte 0x13,0x1 # (double) fr1
	.space 120
# data area offset = 1000
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x14	# MOVE
	.byte 2
	.short 0x8001
	.byte 72, 0x80
	.byte 0x13,0x1 # (double) fr1
	.byte 0x3,0x23 # (double) r2
	.space 56
# data area offset = 1072
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x15	# MUL
	.byte 3
	.short 0x8001
	.byte 72, 0x80
	.byte 0x13,0x2 # (double) fr2
	.byte 0x13,0x1 # (double) fr1
	.byte 0x23,0x0 # (double) $
	.space 2
	.double 0d2.22507385850720100000e-308
	.space 44
# data area offset = 1144
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x08	# CMPT
	.byte 2
	.short 0x8001
	.byte 200, 0x80
	.byte 0x33,0xd # (double) 52(r13)
	.byte 0x13,0x2 # (double) fr2
	.long 52
	.space 180
# data area offset = 1344
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x15	# MUL
	.byte 3
	.short 0x8001
	.byte 72, 0x80
	.byte 0x13,0x2 # (double) fr2
	.byte 0x13,0x1 # (double) fr1
	.byte 0x23,0x0 # (double) $
	.space 2
	.double 0dINF
	.space 44
# data area offset = 1416
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x14	# MOVE
	.byte 2
	.short 0x8001
	.byte 84, 0x80
	.byte 0x13,0x1 # (double) fr1
	.byte 0x30,0xd # (int) 40(r13)
	.long 40
	.space 64
# data area offset = 1500
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x15	# MUL
	.byte 2
	.short 0x8001
	.byte 72, 0x80
	.byte 0x33,0xd # (double) 52(r13)
	.byte 0x13,0x1 # (double) fr1
	.long 52
	.space 52
# data area offset = 1572
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x15	# MUL
	.byte 3
	.short 0x8001
	.byte 168, 0x80
	.byte 0x3,0x23 # (double) r2
	.byte 0x13,0x1 # (double) fr1
	.byte 0x33,0xd # (double) 52(r13)
	.space 2
	.long 52
	.space 144
# data area offset = 1740
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x15	# MUL
	.byte 3
	.short 0x8001
	.byte 168, 0x80
	.byte 0x3,0x23 # (double) r2
	.byte 0x13,0x1 # (double) fr1
	.byte 0x23,0x0 # (double) $
	.space 2
	.double 0d1.79769313486231580000e+308
	.space 140
# data area offset = 1908
	cas r0,r15,r0
	.long FPGLUE
	.byte 0x0f	# LOADM
	.byte 2
	.short 0x8001
	.byte 52, 0x80
	.byte 0xff,0x20 # (int) $
	.byte 0x30,0x1 # (int) 36(r1)
	.long 36
	.space 32
.text
.stabs "strtod:F13",36,0,0,_strtod
.stabs "nptr:p16=*2",160,0,0,176
.stabs "endptr:p17=*16",160,0,0,180
.stabs "s:r16",64,0,0,12
.stabs "sign:6",128,0,0,62
.stabs "num:13",128,0,0,52
.stabs "got_dot:1",128,0,0,48
.stabs "got_digit:1",128,0,0,44
.stabs "exponent:3",128,0,0,40
.stabn 192,0,0,LBB2
.stabs "save:1",128,0,0,36
.stabs "end:16",128,0,0,32
.stabs "exp:3",128,0,0,28
.stabn 192,0,0,LBB3
.stabn 224,0,0,LBE3
.stabn 224,0,0,LBE2
Technical Details
Message-ID: <199208111701.AA01749@claude.cs.umb.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!claude.cs.umb.edu!karl

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!claude.cs.umb.edu!karl
From: karl@claude.cs.umb.edu (Karl Berry)
Subject: bad IBM RT assembly code produced
Message-ID: <199208111701.AA01749@claude.cs.umb.edu>
Sender: gnulists@ai.mit.edu
Reply-To: karl@cs.umb.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 11 Aug 1992 09:01:14 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 1111