https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79062

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-01-12
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

  info.fmtstr = get_format_string (info.format, &info.fmtloc);
  if (!info.fmtstr)
    return;

fails for info.format == "%lx":

(gdb) p debug_tree (info.format)
 <addr_expr 0x7ffff66a7820
    type <pointer_type 0x7ffff66b7000
        type <array_type 0x7ffff66aef18 type <integer_type 0x7ffff66ae3f0 char>
            SI
            size <integer_cst 0x7ffff68a2e28 constant 32>
            unit size <integer_cst 0x7ffff68a2e40 constant 4>
            align 8 symtab 0 alias set -1 structural equality domain
<integer_type 0x7ffff66aee70>
            pointer_to_this <pointer_type 0x7ffff66b7000>>
        unsigned DI
        size <integer_cst 0x7ffff68a2be8 constant 64>
        unit size <integer_cst 0x7ffff68a2c00 constant 8>
        align 64 symtab 0 alias set -1 structural equality>
    readonly constant
    arg 0 <string_cst 0x7ffff66a7800 type <array_type 0x7ffff66aef18>
        readonly constant static "%lx\000">
    t2.c:7:25 start: t2.c:7:25 finish: t2.c:7:25>

it runs into

  if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (format))) != char_type_node)
    {
      /* Wide format string.  */
      return NULL;
    }

other code (in fold-const.c) simply checks for

         && (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_TYPE (string))))
              == MODE_INT)
          && (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (string)))) == 1)

char_type_node is _not_ "merged" with LTO as we allow combining
-f[un]singed-char units and have

  for (i = 0; i < itk_none; i++)
    /* Skip itk_char.  char_type_node is dependent on -f[un]signed-char.  */
    if (i != itk_char)
      record_common_node (cache, integer_types[i]);

you could also look at hwat tree-ssa-strlen.c does (TYPE_MODE (type) ==
TYPE_MODE (char_type_node), etc.)

Reply via email to