https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122574

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> The type Fake_Dimensions.Dimension is a null record. I had hoped that all
> operations are optimized away since there is really no storage involved and
> nothing to execute.
> Obviously this is not done. Isn't this not a good opportunity for
> optimization?

What do you mean by optimization in this context?  That the front-end should
not generate some operations required by the language for the type, or that the
optimizer should optimize them away later?  If the former, that would be a
rather useless optimization since people rarely use null records.  If the
latter, then the optimizer does not really care about the contents of composite
types, it only operates on subprograms; if they are trivial enough, then there
is a chance that they can be entirely optimized away, but you usually need to
use whole-program optimization, in other words LTO, for this.

Reply via email to