This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Don't create an INTEGER_CST for aggregates (empty structs)
chris jefferson <caj@cs.york.ac.uk> writes:
[...]
| >I think there is some improvement that can be done without breaking
| >ABI -- well only the fact that program compiled with old version of V3
| >will silently break with new version of v3, but that is already
| >assumed for v7.
| >
| >
|
| To fix the existing code, it's actually very easy to nuke the extra
| parameters, we just remove them!
|
| So:(for example: note this isn't actual compilable code!)
|
| template<class T, class Val, class ItCategory>
| T __find(T start, T end, Val value, ItCategory)
| {..}
|
| becomes:
|
| template<class T, class Val, class ItCategory>
| T __find(T start,T end, Val value)
whereby you change the function type and cause link failures.
[...]
| >A pattern that I believe is recurrent with many uses of empty classes,
| >is that arguments of such types tend to be "trailing".
| >
| >
| I think I understand what you are saying below. What I wondered
| however in the "stack based" case ou are suggesting that we don't
| increase the stack pointer as far as we did before? Or just (as I
yes.
| thought you would have done) increase the stack pointer as far as it
| was done previously, but just make the compiler never write to the
| place where empty_struct is passed, and never read from it (because of
| course it never should).
That is another possibility. I was just going to the point of
eliminatig the "wasted" space
| This on one hand wastes a little stack space
| but on the other hand seems to be (famous last words) like it should
| never break anything, as nothing should ever read the value of an
| empty struct, except perhaps to copy it because it is stupid...
indeed.
-- Gaby