)]}'
{
  "commit": "822ce7e451fdbbeeca2df5d8ddbdf6bccc254abb",
  "tree": "2bf6c4baf59283dd03a36d6fc60fe14b914c63fd",
  "parents": [
    "f44527143df24430447d68e4b0e461685827f0f6"
  ],
  "author": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Mon Jul 27 18:54:37 2026 +0200"
  },
  "committer": {
    "name": "Jakub Jelinek",
    "email": "jakub@gcc.gnu.org",
    "time": "Mon Jul 27 18:54:37 2026 +0200"
  },
  "message": "fortran: Fix ICE with loops with (deprecated) non-integral iterators [PR126303]\n\ndo_subscript contains\n              do_sym \u003d dl-\u003eext.iterator-\u003evar-\u003esymtree-\u003en.sym;\n              if (do_sym-\u003ets.type !\u003d BT_INTEGER)\n                continue;\ncheck to ignore loops with non-integral iterator.  But r15-11154\nPR94978 change has added inner_loop_may_be_skipped function and that\nhappily accesses inner loop iterator\u0027s step, start and end if EXPR_CONSTANT\nwith mpz_init_set (..., ...value.integer);\nNow, given the layout of mpfr_t (usually long, int, long, pointer)\nand mpz_t (usually int, int, pointer), this sometimes just produces silently\ngarbage (e.g. on 64-bit little-endian, where the second int in mpz_t is\nthe most significant 32-bits of _mpfr_prec and so usually 0 and so _mp_size\nis 0 and nothing is dereferenced:\np loop-\u003eext.iterator-\u003estep.value.real\n$1 \u003d {{_mpfr_prec \u003d 24, _mpfr_sign \u003d 1, _mpfr_exp \u003d 1, _mpfr_d \u003d 0x4eac658}}\np loop-\u003eext.iterator-\u003estep.value.integer\n$2 \u003d {{_mp_alloc \u003d 24, _mp_size \u003d 0, _mp_d \u003d 0x1}}\nor it ICEs somewhere in gmp (on 32-bit little-endian, e.g. i686, or\nbig-endian, e.g. s390x), because _mp_size is in that case _mpfr_sign but\n_mp_d is _mpfr_exp (32-bit little-endian), or _mp_size is least significant\npart of _mpfr_prec, in both cases non-zero, but _mp_d is not a usable\npointer in either case.\n\nThe following patch fixes that by punting for inner loops with non-integral\niterator.\n\n2026-07-27  Jakub Jelinek  \u003cjakub@redhat.com\u003e\n\n\tPR fortran/126303\n\t* frontend-passes.cc (inner_loop_may_be_skipped): If inner loop iterator\n\tis not integral, return true.\n\n\t* gfortran.dg/pr126303.f: New test.\n\nReviewed-by: Jerry DeLisle \u003cjvdelisle@gcc.gnu.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "5456f6e8bdff38a7abd7acb5bf80468e36024327",
      "old_mode": 33188,
      "old_path": "gcc/fortran/frontend-passes.cc",
      "new_id": "9bf5d40b9cc4f05193bd97244913e41f6cd203b1",
      "new_mode": 33188,
      "new_path": "gcc/fortran/frontend-passes.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "0e6f8381c87ef5a3ce91363ca8c9aa390df3fe57",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gfortran.dg/pr126303.f"
    }
  ]
}
