Always interesting to compare seemingly duplicates. The variant from fold-const.c seems to be more strict with types and sets TREE_ADDRESSABLE on the base component, while the gfc variant sets it on the passed tree itself. Other than that, the gfc variant uses convert () to do typecasting. And the gfc variant has parameters swapped compared to the fold-const.c variant which may cause confusion if we switch.
Would a patch be accepted to convert the gfc_build_addr_expr to build_fold_addr_expr{,_with_type}? Richard.