9fans archive / 2001 / 04 / 660 /    prev next

From: Axel Belinfante <Axel.Belinfante@cs.utwente.nl>
Subject: [9fans] pcc problem compiling assumed to be correct C file
Date: Fri, 27 Apr 2001 12:04:12 +0200

Hello,
I'm having a problem compiling a pretty huge C file, using pcc.
The file is generated, and contains lots of the same/similar functions.
Most of those functions are not complained about, but a few of them are.
Can it be that I have too many functions, and that a table is overflowing?
There are quite a number of simular functions that have a local variable
named kc_x  (either defined static or register, and of many different types)
and it looks very much like pcc is confusing one kc_x with another one).
I tried to look at the -d debugging output, but got confused about the
block numbering: they go up to 127, and then down from -128, and up again,
but indeed showing the same decl line etc.

In case anyone wants to reproduce, I have made both the original file and
the output of running the C preprocessor on it available as resp.
<URL:http://www.cs.utwente.nl/~belinfan/kcproblem/k.c.gz>
<URL:http://www.cs.utwente.nl/~belinfan/kcproblem/k..i.gz>
The pcc -v flag shows (split at \ by me):
  cpp -D__STDC__=1 -N -I/386/include/ape -I/sys/include/ape k.c | \
    8c  -F -V -w -o k.8

pcc error messages:

k.c:7601[stdin:43627] incompatible types: "IND STRUCT kc_tag_productionblock"
 and "IND STRUCT kc_tag_outmostpatterns" for op "EQ"
k.c:7603[stdin:43629] incompatible types: "IND STRUCT kc_tag_productionblock"
 and "IND STRUCT kc_tag_outmostpatterns" for op "AS"
k.c:7606[stdin:43632] incompatible types: "IND STRUCT kc_tag_outmostpatterns"
 and "IND STRUCT kc_tag_productionblock" for op "RETURN"

for a few of the functions like this:
(I know the code could be cleaner, but still that doesn't explain the errors)

outmostpatterns Niloutmostpatterns
#ifdef KC_USE_PROTOTYPES
(void)
#else
()
#endif
{	static outmostpatterns kc_x = (outmostpatterns)0;
	KC_COLLECT_STATS0(KC_CREATE_STATS(sel_Niloutmostpatterns));
	if (kc_x == (outmostpatterns)0) {
		KC_COLLECT_STATS0(KC_EXISTINGNOTFOUND_STATS(sel_Niloutmostpatterns ));
		kc_x = (outmostpatterns)(*kc_hashtables[(int)kc_uniq_nullary_operator]->
malloc)(
			(kc_size_t)sizeof(struct kc_tag_outmostpatterns), 
			kc_hashtables[(int)kc_uniq_nullary_operator]->malloc_private_data);
		kc_x->prod_sel = sel_Niloutmostpatterns;
	}
	return kc_x;
}


Thanks,
Axel.