------- Comment #3 from guillaume dot melquiond at ens-lyon dot fr 2006-08-25 08:34 ------- > Which looks ok if we are passing via value but since we need to pass by > reference, the middle-end thinks we need a new stack space for it because it > does not know that D.1992 is not used after the call to g.
Isn't it the other way around? There is no problem if we are passing by reference, as the code then looks like "g (&D.1992);". The middle-end will not do any copy. But, because we are passing by value, D.1992 is copied into the stack frame instead. I understand your point about the middle-end having to ensure that D.1992 is not used after g in order to store it directly into the stack frame of g. But isn't this information already available to the middle-end? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28831