The larger part of the patch is a backport from gcc trunk which is sent upstream for approval. Thanks to Sean Bruno for testing, Andrew Turner for explaining me fine details and Gerald for approving. Approved by: gerald (maintainer)