Feature Request

Dave Hudson dave@cyclicode.net
Thu Nov 7 04:14:00 GMT 2002


L C wrote:
> 1) I don't think the ISO code and unecessary typecasting issues would be 
> a concern since the requested compiler switch would obviously not be the 
> default. You would have to intentionally enable it and therefore realize 
> the ramifications.

One major concern I would have is that it's very easy to make mistakes 
that cause complete chaos in unexpected parts of gcc's infrastructure - 
the new switch would render most of the C torture test suite inoperable 
and thus the quality of the resultant code might be somewhat debatable 
at best - the solution I've taken allows me to continue to use the full 
testsuite and trap many otherwise subtle problems.

> 3) I think for a typical simple embedded systems program the savings 
> would be greater than your 2-2.5%. I changed one arithmetic calculation 
> on my AVR such that I casted every calc back to unsigned char and the 
> code to do the calculation went from about 14 bytes to 4. It would also 
> be especially valuable in interrupt service routines where small code 
> size is key.

I think a lot depends on how you're code works - there are some 
pathalogical integer promotions but I guess it depends what your ratio 
of numeric code is to other code.  I can point to examples where I've 
seen much larger reductions but overall within a pretty general OS, 
device driver, network protocol and application codebase the saving was 
under 3% - obviously some individual cases had savings of 50%+.  The 
code in question probably does have some explicit typecasts but not too 
many.

I guess you could always ask Denis Chertykov his thoughts on this since 
he wrote the AVR port and he looks after the IP2k port in the FSF tree.


Regards,
Dave




More information about the Gcc mailing list