> Even in full/pro mode, merely adding an unrelated source file to the > project (which never gets referenced/called in the code) adds a > significant amount of data to the program space. Shouldn't the compiler > be smart enough to remove the unused code? This is probably the simplest > optimization that can be done. And xc32 is basically gcc, so what's > going on? I'd expect any half-decent C compiler to omit code that > doesn't get called, especially when invoked with the -Os (optimize for > size) flag. >=20 > Nothing in the extra code is even declared volatile, so I can't think of > any reason at all why it's getting added to the compiled output. >=20 That is not a job for the compiler - it doesn't know if the code will be us= ed=20 or not. It is a job for the linker. Well, actually the compiler needs to be in on this too. It needs to place e= very=20 function in its own section and then the linker can remove unused sections. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Ruben J=F6nsson AB Liros Electronic Box 9124 200 39 Malm=F6 Sweden www.liros.se Tel +46 40142078 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .