CC bug in IRIX 3.3.1 ?

Mike Muuss mike at BRL.MIL
Sat Jan 12 21:21:28 AEST 1991


The following C program generates this error message on an SGI
4D/280 running IRIX 3.3.1:

80 wolf> cc -c goo.c
ccom: Error: goo.c, line 20: redeclaration of formal parameter, stp
        int     (*ft_shot)(struct soltab *stp);
      ---------------------------------------^
ccom: Error: goo.c, line 21: unknown size
      };
      ^
ccom: Error: goo.c, line 21: unknown size
      };
      ^

This program fragment represents valid ANSI C code.

struct soltab {
	int	a;
	int	b;
};

int	(*prep)(struct soltab *stp);
int	(*grep)(struct soltab *stp);

int	j;

/* This way does work */
struct rt_gunktab {
	int	(*ft_prep)(struct soltab *);
	int 	(*ft_shot)(struct soltab *);
};

/* This way does not work */
struct rt_functab {
	int	(*ft_prep)(struct soltab *stp);
	int 	(*ft_shot)(struct soltab *stp);
};

It would seem that using variable names inside prototypes is
causing the compiler difficulties with a symbol table of some sort.

Quoting from K&R (2nd ed), pg 218:

"If the declarators in the parameter declarations contain identifiers
and the function declarator does not head a function definition, the
identifiers go out of scope immediately."

and

"In the new-style declaration
	int strcpy(char *dest, const char *source), rand(void);
.... The parameter names are effectively comments."

While this style of declaration seems to work in simple cases on the
SGI, structures containing multiple function pointers with prototypes
that have repeated parameter names seem to make the compiler choke.

Just for reference, this is not a problem on the Cray ANSI C compiler.

Could this please be filed as a Software Problem Report?

	Best,
	 -Mike



More information about the Comp.sys.sgi mailing list