[comp.unix.ultrix] Problems with GCC 1.37.1 and Ultrix 4.0

tkl@cscosl.ncsu.edu (Tim Lowman) (06/12/90)

North Carolina State University has recently purchased some DECstation
2100's and 3100's.  On our development system, which is running ULTRIX V4.0
(Rev. 163) UWS V4.0 (Rev. 120), I tried to install the gcc compiler version
1.37.1.  I configured gcc (config.gcc) to decstation (since this software
was to run on the DECstation 3100.  During compilation, I received one error
which was remedied by changing the definition of _SIZE_T to _SIZE_T_ in
stddef.h and the typedef of unsigned long size_t to unsigned int size_t.
Then I tried to re-compile gcc, which worked except for the two following
warnings:
>cc -g  -I. -I. -I./config -c insn-emit.c
>ccom: Warning: insn-emit.c, line 729: statement not reached
>        operand0 = emit_operand[0];
>      ----------------------------^
>ccom: Warning: insn-emit.c, line 749: zero or negative subscript
>        rtx emit_operand[0];
>      --------------------^
>
Gcc is generated; however, when you try to compile very simple programs (like
hello world or a simple grading program in this instance) you get the 
following errors:
>
>gcc -DTEST -o grade grade.c
>as1: Warning: /usr/tmp/cca09606.s, line 861: nop must be inside .set noreorder section
>ld:
>Can't open: crt0.o (No such file or directory)
>ld: Usage: ld [options] file [...]
>*** Error code 1
>
>Stop.

This file, grade.c, contains no assembly calls.  Any idea?

Tim Lowman (tkl@cscosl)

====================================-------*-------===========================
- Tim Lowman | (tkl@cscosl.ncsu.edu) | Sys. Prog. I @ NCSU Comp. Sci. Dept. --
- North Carolina State University, Box 8206, Raleigh, NC 27695 ---------------
==============================================================================

meissner@osf.org (Michael Meissner) (06/15/90)

In article <1990Jun11.183154.8286@ncsuvx.ncsu.edu> tkl@cscosl.ncsu.edu
(Tim Lowman) writes:

| North Carolina State University has recently purchased some DECstation
| 2100's and 3100's.  On our development system, which is running ULTRIX V4.0
| (Rev. 163) UWS V4.0 (Rev. 120), I tried to install the gcc compiler version
| 1.37.1.  I configured gcc (config.gcc) to decstation (since this software
| was to run on the DECstation 3100.  During compilation, I received one error
| which was remedied by changing the definition of _SIZE_T to _SIZE_T_ in
| stddef.h and the typedef of unsigned long size_t to unsigned int size_t.
| Then I tried to re-compile gcc, which worked except for the two following
| warnings:
| >cc -g  -I. -I. -I./config -c insn-emit.c
| >ccom: Warning: insn-emit.c, line 729: statement not reached
| >        operand0 = emit_operand[0];
| >      ----------------------------^
| >ccom: Warning: insn-emit.c, line 749: zero or negative subscript
| >        rtx emit_operand[0];
| >      --------------------^

These are harmless, though I have fixes for them (I'm trying to break
six months of work down to patches that fix single problems for FSF
integration).

The first is because the call pattern uses a define expand, and then
uses the DONE macro, which jumps past the code to build the default
call insn.

The second is because a define_expand is used for the probe pattern
(which tests if memory allocated via alloca is valid), and it takes no
arguments.  I rewrote it to use a define_insn.  Here is the patch:

| >
| Gcc is generated; however, when you try to compile very simple programs (like
| hello world or a simple grading program in this instance) you get the 
| following errors:
| >
| >gcc -DTEST -o grade grade.c
| >as1: Warning: /usr/tmp/cca09606.s, line 861: nop must be inside .set noreorder section
| >ld:
| >Can't open: crt0.o (No such file or directory)
| >ld: Usage: ld [options] file [...]
| >*** Error code 1
| >
| >Stop.
| 
| This file, grade.c, contains no assembly calls.  Any idea?

Yea, the newer MIPS compiler suite complains if you have a NOP
instruction that is in a section that can be reordered.  GCC generates
such NOP's when you are not optimizing.  The following patch should
work fine (the compiler suite I'm using, 1.31, doesn't show this
problem up).  Note there are two separate patches here, the first
patch must be run before the second.

====================

This patch fixes a problem in using the latest MIPS assembler which
complains if a NOP instruction is encountered without being within a
.set noreorder section.  Since nops are only emitted when not
optimizing, it doesn't matter much that this prevents some code
movement around the nop instruction.

*** config/mips.md.~1~	Thu Jun 14 19:44:29 1990
--- config/mips.md	Thu Jun 14 19:45:04 1990
***************
*** 3085,3091 ****
  (define_insn "nop"
    [(const_int 0)]
    ""
!   "nop")
  
  (define_expand "probe"
    [(set (reg:SI 29) (minus:SI (reg:SI 29) (const_int 4)))
--- 3085,3091 ----
  (define_insn "nop"
    [(const_int 0)]
    ""
!   ".set\\tnoreorder\;nop\;.set\\treorder")
  
  (define_expand "probe"
    [(set (reg:SI 29) (minus:SI (reg:SI 29) (const_int 4)))

====================

This patch uses a define_insn instead of a define_expand for the probe
pattern.  This is done because define_expand generates an array with 0
elements if no match_operators are done, and the MIPS compiler
complains about this.  Also, 2 instructions are generated instead of
4, by using a read into $1, instead of extending the stack, writing a
0, and decrementing the stack.

*** config/mips.md.~1~	Thu Jun 14 20:05:43 1990
--- config/mips.md	Thu Jun 14 20:06:19 1990
***************
*** 3087,3098 ****
    ""
    ".set\\tnoreorder\;nop\;.set\\treorder")
  
! (define_expand "probe"
!   [(set (reg:SI 29) (minus:SI (reg:SI 29) (const_int 4)))
!    (set (mem:SI (reg:SI 29)) (const_int 0))
!    (set (reg:SI 29) (plus:SI (reg:SI 29) (const_int 4)))]
    ""
!   "")
  
  ;;
  ;;- Local variables:
--- 3087,3108 ----
    ""
    ".set\\tnoreorder\;nop\;.set\\treorder")
  
! ;; The following machine description is not really valid (since it sets
! ;; $r29 twice, once to decrement it, and once to increment it), but it
! ;; gives a unique insn which is unlikely to ever be used by GCC.
! 
! (define_insn "probe"
!   [(parallel [(set (reg:SI 29) (minus:SI (reg:SI 29) (const_int 4)))
! 	      (set (mem:SI (reg:SI 29)) (const_int 0))
! 	      (set (reg:SI 29) (plus:SI (reg:SI 29) (const_int 4)))])]
    ""
!   "*
! {
!   operands[0] = gen_rtx (REG, SImode, 1);
!   operands[1] = stack_pointer_rtx;
!   return \".set\\tnoat\;lw\\t%0,0(%1)\\t\\t# stack probe\;.set\\tat\";
! }")
! 
  
  ;;
  ;;- Local variables:

--
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Catproof is an oxymoron, Childproof is nearly so