)]}'
{
  "commit": "fff23f42e89ecee6c86cd08d809437ee90664b5c",
  "tree": "5ca9bec0470b60204577598371944f366ca31b05",
  "parents": [
    "21e0a742e7b70dcb9d8bed87a7d1b1b77b48b364"
  ],
  "author": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Sat May 10 21:20:09 2025 +0200"
  },
  "committer": {
    "name": "Jakub Jelinek",
    "email": "jakub@gcc.gnu.org",
    "time": "Mon Jun 02 10:57:40 2025 +0200"
  },
  "message": "fortran: Fix debug info for unsigned(kind\u003d1) and unsigned(kind\u003d4) [PR120193]\n\nAs the following testcase shows, debug info for unsigned(kind\u003d1)\nand unsigned(kind\u003d4) vars is wrong while unsigned(kind\u003d2), unsigned(kind\u003d8)\nand unsigned(kind\u003d16) look right.\nInstead of objects having unsigned(kind\u003d1) type they have character(kind\u003d1)\nand instead of unsigned(kind\u003d4) they have character(kind\u003d4).\nThis means in gdb e.g. unsigned(kind\u003d1) :: a(2) variable initialized to\n97 will print as \u0027aa\u0027 rather than (97, 97) etc.\nWhile there can be just one unsigned_char_type_node and one\nunsigned_type_node type, each can have arbitrary number of variants\n(e.g. consider C\ntypedef unsigned char uc;\nwhere uc is a variant type to unsigned char) or even distinct types\nwith different TYPE_MAIN_VARIANT.\n\nThe following patch uses a variant of the character(kind\u003d4) type\nfor unsigned(kind\u003d4) and a distinct type based on character(kind\u003d1)\ntype for unsigned(kind\u003d1).  The reason for the latter is that\nunsigned_char_type_node has TYPE_STRING_FLAG set on it, so it has\nDW_AT_encoding DW_ATE_unsigned_char rather than DW_ATE_unsigned and\nso the debugger then likes to print it as characters rather than numbers.\nThat is IMHO in Fortran desirable for character(kind\u003d1) but not for\nunsigned(kind\u003d1).  I\u0027ve made sure TYPE_CANONICAL of the unsigned(kind\u003d1)\ntype is still character(kind\u003d1), so they are considered compatible by\nthe middle-end also e.g. for aliasing etc.\n\n2025-05-10  Jakub Jelinek  \u003cjakub@redhat.com\u003e\n\n\tPR fortran/120193\n\t* trans-types.cc (gfc_init_types): For flag_unsigned use\n\tbuild_distinct_type_copy or build_variant_type_copy from\n\tgfc_character_types[index_char] if index_char \u003e -1 instead of\n\tgfc_character_types[index_char] or\n\tgfc_build_unsigned_type (\u0026gfc_unsigned_kinds[index]).\n\n\t* gfortran.dg/guality/pr120193.f90: New test.\n\n(cherry picked from commit 512371d786e70d27dbaef38d60e9036c11f458c6)\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3374778cb6500a7b6e77ac6b413c1a0a10973c6c",
      "old_mode": 33188,
      "old_path": "gcc/fortran/trans-types.cc",
      "new_id": "f898075468568648280a3927f5a71a1d762cb726",
      "new_mode": 33188,
      "new_path": "gcc/fortran/trans-types.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e65febff2885fa45d093321ec4339a70af77c6fe",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gfortran.dg/guality/pr120193.f90"
    }
  ]
}
