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

            Bug ID: 86137
           Summary: ubsan runtime error in c-format.c
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For this C code, derived from
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-18.c

a() { __builtin_sprintf(a, "%9223372036854775808i"); }

and a recent ubsan version of gcc trunk, I get

$ ~/gcc/results.261388.ubsan/bin/gcc -Wall -c bug445.c
../../trunk/gcc/c-family/c-format.c:1252:20: runtime error: signed integer
overflow: 922337203 * 10 cannot be represented in type 'int'

Source code is

      nargnum = 10 * argnum + (*fcp - '0');

Reply via email to