[coreboot] Ouch: romcc "x[0] |= something" patch causes another crash

Stefan Reinauer stepan at coresystems.de
Tue Mar 16 00:29:18 CET 2010


On 3/15/10 9:18 PM, Eric W. Biederman wrote:
>>> If romcc can't do something, then work around it; we can warn people
>>> about no arrays. But given that nobody has the time to really support
>>> romcc (as, e.g., gcc or llvm are supported) we're taking some real
>>> risks just plugging changes in.
>>>   
>>>       
>> The changes were merely trying to fix the segfaults, not implement or
>> change anything big. I think we do want fixes for segfaults. Always.
>>     
> Fixing segfaults and then getting code that doesn't work correctly
> is worse.  Always. 
Absolutely true. We're just only learning that we were this stupid :-)

>  I did my best with romcc to ensure the compile
> fails if we are not going to generate the correct code.
>
> At the same time I would much rather it be an assert than a random
> segfault.
>
> I have to run but I think this patch adds the missing check to
> catch non-static arrays.
>
>   
Seems to do the job... Please send a Signed-off-by: for the books:
http://www.coreboot.org/Development_Guidelines#Sign-off_Procedure

and this will make it into the tree.

You can of course check it in yourself if you wish, in any case this is
Acked-by: Stefan Reinauer <stepan at coresystems.de>

> Index: romcc.c
> ===================================================================
> --- romcc.c	(revision 4892)
> +++ romcc.c	(working copy)
> @@ -13458,6 +13458,10 @@
>  	if ((type->type & TYPE_MASK) == TYPE_FUNCTION) {
>  		error(state, 0, "Function prototypes not supported");
>  	}
> +	if (ident &&
> +		((type->type & TYPE_MASK) == TYPE_ARRAY) &&
> +		((type->type & STOR_MASK) != STOR_STATIC))
> +		error(state, 0, "non static arrays not supported");
>  	if (ident && 
>  		((type->type & STOR_MASK) == STOR_STATIC) &&
>  		((type->type & QUAL_CONST) == 0)) {
>
> Eric
>
>   


-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866





More information about the coreboot mailing list