------- Comment #9 from matz at gcc dot gnu dot org 2009-08-13 12:16 ------- It is indeed somewhat related, but currently the patchset doesn't help here. The first issue is, that I create new types with unconflicting alias sets only for global variables, not local ones (as I1 is in this case). I believe I can change this meanwhile (the restriction came from earlier versions of the patch). But even if this is fixed we can't figure out the difference between INTENT(IN) and INTENT(OUT), i.e. even then we still believe that I1 can possibly be changed by the call.
We have three ways out of this: 1) make the frontend not pass INTENT(IN) parameters by reference, maybe at least for scalars. That would be the preferred way, but unfortunately this probably would break a lot of code assuming such calling convention especially when interfacing with C code :-/ 2) invent a new attribute that we can attach to the individual arguments that would indicate non-clobbering via this reference 3) find a combination of existing things (DECL_BY_REFERENCE/TREE_READONLY/etc) that could be used by the middle end to conclude non-clobbering. Something like a const reference comes to mind, but unfortunately (the middle-end coming mostly from the C/C++ side) we don't conclude many interesting things about const refs/pointers. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40194