Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: johns@calvin.EE.CORNELL.EDU (John Sahr)
Subject: bug in  ds3100 cc?
Date: 22 Sep 89 16:43:01 GMT	[thread overview]
Message-ID: <1333@calvin.EE.CORNELL.EDU> (raw)
In-Reply-To: 6833@pixar.UUCP

I have run across a bug in the MIPS cc C compiler (or in my understanding).
Consider the following.

#include <stdio.h>

int test(void *b)
{
  printf("%d\n", *((int *) b));
  return 0;
}

int main()
{
  int four = 4;
  
  return test((void *) &four);
}

On a microvax (2000, ultrix)  vcc and gcc (1.34) compile this and the result
runs fine. vax cc objects, though (not surprising to me).
On a DS3100, cc objects to the printf("%d\n", *((int *) b)), saying that
b is undefined.  Putting a prototype before test() does not help, and making

typedef void *anonymous;

to replace the void * doesn't help either.  Any comments?  The MIPS cc 
seems to handle the new style declarations pretty well, except for this.

int test(b)
void *b;
{ .... }

Neither uvax lint nor MIPS lint approve of this declaration "b may be used
before set..." among other things.  Does this all mean that the 
"MIPS cc does not know about `void *' as `anonymous ptr'?"

-john

-- 
John Sahr,     Dept. of Electrical Eng., Cornell University, Ithaca, NY 14853
johns@{alfven,calvin}.ee.cornell.edu,  {rochester,cmcl2}!cornell!calvin!johns
--When the dust settles, each B2 bomber will fund NSF for more than a year--


  reply	other threads:[~1989-09-22 16:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-09-21  1:07 mips symbol table stripping Daniel McCoy
1989-09-22 16:43 ` John Sahr [this message]
1989-09-22 20:31   ` bug in ds3100 cc? Chris Siebenmann
1989-09-23  8:12   ` Roger B.A. Klorese
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox