🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by "Stephen C. Pope" Wed, 05 Apr 1989 17:49
g++-1.34.2 generating bogus sparc assembler code
#1833
Author: "Stephen C. Pope"
Date: Wed, 05 Apr 1989 17:49
52 lines
2538 bytes
While trying to compile Lea's Matrix.4apr code, I ran into
the following problem.  I'm using g++-1.34.2, the Tuesday
afternoon distribution, along with a random patch or two
appearing after that distribution.  All on a Sun4 SunOS4.0.1,
and using the native assembler.

laotse% g++ -v -g -O -fchar-charconst  -I.  -fstrength-reduce -c  TriDiagMat.cc
g++ version 1.34.2
 /usr/local/lib/gcc-cpp -+ -v -I. -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix -D__sparc__ -D__su
n__ -D__unix__ -D__OPTIMIZE__ TriDiagMat.cc /tmp/cca16931.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-c++ /tmp/cca16931.cpp -quiet -dumpbase TriDiagMat.cc -fchar-charconst -fstrength-
reduce -opt -version -G -o /tmp/cca16931.s
GNU C++ version 1.34.2 (sparc) compiled by GNU C version 1.34.
 as /tmp/cca16931.s -o TriDiagMat.o
as: "/tmp/cca16931.s", line 2169: error: statement syntax
as: "/tmp/cca16931.s", line 2425: error: statement syntax
as: "/tmp/cca16931.s", line 2862: error: statement syntax
as: "/tmp/cca16931.s", line 3312: error: statement syntax
as: "/tmp/cca16931.s", line 3762: error: statement syntax
as: "/tmp/cca16931.s", line 4212: error: statement syntax
as: "/tmp/cca16931.s", line 4662: error: statement syntax
as: "/tmp/cca16931.s", line 5112: error: statement syntax
as: "/tmp/cca16931.s", line 5483: error: statement syntax
as: "/tmp/cca16931.s", line 5651: error: statement syntax
as: "/tmp/cca16931.s", line 5881: error: statement syntax
as: "/tmp/cca16931.s", line 6376: error: statement syntax
as: "/tmp/cca16931.s", line 7109: error: statement syntax

(Investigating *only* the first error above!!!)
After looking at the .s output, I see that intructions of
the form

	mov	[%l1], %o2

are being generated.  The source line generating this is
in TriDiagMat.h:

inline double&  TriDiagMat::ref(int i, int j)
{
  return data[r * (j - i + 1) + j];    // this is the culprit here!
}

which is quite kosher.

All the other errors are due to the generation of similar
mov [%l?],%o? instructions.

Stephen Pope
The Santa Fe Institute
scp@sfi.santafe.edu
g++-1.34.2 generating bogus sparc assembler code
#1835
Author: Michael Tiemann
Date: Wed, 05 Apr 1989 18:20
33 lines
1322 bytes
I posted a fix to bug-gcc@prep.ai.mit.edu.  I should have CC'd to
bug-g++.  Here is the fix:

yahi% diff -c2 sparc.md~ sparc.md
*** sparc.md~	Mon Mar 27 09:37:42 1989
--- sparc.md	Tue Apr  4 09:01:36 1989
***************
*** 1496,1503 ****
    ""
    "*
!   return (GET_CODE (operands[1]) == CONST_INT
! 	  ? \"sethi %%hi(%1),%0\;or %%lo(%1),%0,%0\"
! 	  : \"mov %1,%0\");
! ")
  
  ;;- and instructions (with compliment also)			   
--- 1496,1506 ----
    ""
    "*
! {
!   if (GET_CODE (operands[1]) == MEM)
!     return \"ld %1,%0\";
!   if (REG_P (operands[1]) || small_int (operands[1]))
!     return \"mov %1,%0\";
!   return \"sethi %%hi(%1),%0\;or %%lo(%1),%0,%0\";
! }")
  
  ;;- and instructions (with compliment also)			   
yahi% 

Don't worry if the line numbers don't match up.

Michael
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads