------- Comment #3 from matz at gcc dot gnu dot org 2009-05-07 13:28 ------- How alignment is dealt with in was explained by Joseph in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39954#c10 A conversion sequence implicitely maintains the largest found alignment. Looking through casts would not be correct for the middle-end, as a different frontend could very well use such conversions to implement what you suggested, namely forcefully reducing alignment for whatever reason. Looking through the cast would deafeat that, it's really the frontend that needs to establish the expected semantics here (retaining the large alignment through casts).
As usual with the problems exposed by the more limited TER it's not really a regression. Trivially modifying the testcase to have two uses of the same cast would have made TER not work around the situation and you would have ended up with the missed optimization already since introduction of tree-ssa (and TER of course). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40060