This lack of type safety is unsettling, and I wonder if it should be fixed with a patch along the lines of the (not yet fully tested) one below. Does that sound reasonable? It seems right to try to fix the generic code here, even though the testcase in hand is target-specific. If this approach is unreasonable, I guess some target-specific hooks will be needed.
I'm almost sure this is a regression, and older versions of GCC implemented exactly what you propose.
Paolo