On 27.08.21 17:47, Tobias Burnus wrote at https://gcc.gnu.org/pipermail/gcc-patches/2021-August/578271.html :
PS: Current GCC (mainline w/o patch) generates the following. [-> with patch, see a-test.f90.*.original.]
I accidentally attached the original dump created by mainline GCC. For the patched compiler, I did attach the optimized dumps. For reference, this email now contains the original dump generated with my patch applied. Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
__attribute__((fn spec (". . "))) integer(kind=4) rank_p (struct CFI_cdesc_t & _this) { struct array15_integer(kind=4) this.0; struct array15_integer(kind=4) * this; signed char idx.1; integer(kind=4) rnk; this = &this.0; this.0.dtype = {.elem_len=4, .type=1}; this.0.data = _this->base_addr; this.0.dtype.rank = _this->rank; if (_this->base_addr != 0B) { this.0.span = _this->dim[0].sm % (integer(kind=8)) _this->elem_len != 0 ? _this->dim[0].sm : (integer(kind=8)) _this->elem_len; this.0.offset = 0; idx.1 = 0; L.1:; if (_this->rank <= idx.1) goto L.2; this.0.dim[idx.1].lbound = _this->dim[idx.1].lower_bound; this.0.dim[idx.1].ubound = _this->dim[idx.1].extent + (this.0.dim[idx.1].lbound + -1); this.0.dim[idx.1].stride = _this->dim[idx.1].sm / (integer(kind=8)) _this->elem_len; this.0.offset = this.0.offset - this.0.dim[idx.1].stride * this.0.dim[idx.1].lbound; idx.1 = idx.1 + 1; goto L.1; L.2:; } rnk = (integer(kind=4)) this->dtype.rank; return rnk; } __attribute__((fn spec (". "))) void selr_p () { struct array01_integer(kind=4) intp; integer(kind=4) irnk; static integer(kind=4) rnk = 1; intp.dtype = {.elem_len=4, .rank=1, .type=1}; intp.span = 0; intp.data = 0B; { struct CFI_cdesc_t01 cfi.2; signed char idx.3; cfi.2.version = 1; cfi.2.rank = 1; cfi.2.type = 1025; cfi.2.attribute = 0; cfi.2.base_addr = intp.data; cfi.2.elem_len = 4; if (cfi.2.base_addr != 0B) { idx.3 = 0; L.3:; if (idx.3 > 0) goto L.4; cfi.2.dim[idx.3].lower_bound = intp.dim[idx.3].lbound; cfi.2.dim[idx.3].extent = (intp.dim[idx.3].ubound - intp.dim[idx.3].lbound) + 1; cfi.2.dim[idx.3].sm = intp.dim[idx.3].stride * intp.span; idx.3 = idx.3 + 1; goto L.3; L.4:; } irnk = rank_p (&cfi.2); } if (irnk != rnk) { _gfortran_stop_numeric (1, 0); } L.5:; if (irnk != 1) { _gfortran_stop_numeric (2, 0); } L.6:; } __attribute__((externally_visible)) integer(kind=4) main (integer(kind=4) argc, character(kind=1) * * argv) { static integer(kind=4) options.4[7] = {2116, 4095, 0, 1, 1, 0, 31}; _gfortran_set_args (argc, argv); _gfortran_set_options (7, &options.4[0]); selr_p (); return 0; }