https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91258
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW --- Comment #12 from Martin Sebor <msebor at gcc dot gnu.org> --- I've reproduced it in a test suite run, but not yet in a debugger. I instrumented the code to dump LHS, the type of REF in the if block (REFTYPE), and finally TYPE. Here they are, followed by the warning. TYPE is 1 byte, so is_char_type (TYPE) returns true. LHS = <mem_ref 0x3fff84b0d5c0 type <integer_type 0x3fff84970738 int public SI size <integer_cst 0x3fff84941068 constant 32> unit-size <integer_cst 0x3fff84941080 constant 4> align:32 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type 0x3fff8 4970738 precision:32 min <integer_cst 0x3fff84941020 -2147483648> max <integer_c st 0x3fff84941038 2147483647> pointer_to_this <pointer_type 0x3fff84971ae8>> arg:0 <addr_expr 0x3fff84958560 type <pointer_type 0x3fff84b38dc0 type <array_type 0x3fff84b38d18> unsigned DI size <integer_cst 0x3fff84940e28 constant 64> unit-size <integer_cst 0x3fff84940e40 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality> arg:0 <var_decl 0x3fff87002370 D.3146 type <array_type 0x3fff84b38d18> addressable used ignored SI /src/gcc/trunk/gcc/testsuite/g++.dg/ubsan/vla-1.C:9:5 size <integer_cst 0x3fff84941068 32> unit-size <integer_cst 0x3fff84941080 4> align:32 warn_if_not_align:0 context <function_decl 0x3fff84b4f100 main>>> arg:1 <integer_cst 0x3fff8494b268 type <pointer_type 0x3fff84971ae8> constant 4>> REFTYPE = <pointer_type 0x3fff84b38dc0 type <array_type 0x3fff84b38d18 type <integer_type 0x3fff84b38bc8 public unsigned QI size <integer_cst 0x3fff84940f18 constant 8> unit-size <integer_cst 0x3fff84940f30 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x3fff84b38bc8 precision:8 min <integer_cst 0x3fff8494bd90 0> max <integer_cst 0x3fff8494bd48 255>> SI size <integer_cst 0x3fff84941068 constant 32> unit-size <integer_cst 0x3fff84941080 constant 4> align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality domain <integer_type 0x3fff84b38c70 type <integer_type 0x3fff84970150 sizetype> DI size <integer_cst 0x3fff84940e28 constant 64> unit-size <integer_cst 0x3fff84940e40 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x3fff84b38c70 precision:64 min <integer_cst 0x3fff84940e58 0> max <integer_cst 0x3fff8494bdc0 3>> pointer_to_this <pointer_type 0x3fff84b38dc0>> unsigned DI size <integer_cst 0x3fff84940e28 64> unit-size <integer_cst 0x3fff84940e40 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality> TYPE = <integer_type 0x3fff84b38bc8 public unsigned QI size <integer_cst 0x3fff84940f18 type <integer_type 0x3fff849701f8 bitsizetype> constant 8> unit-size <integer_cst 0x3fff84940f30 type <integer_type 0x3fff84970150 sizetype> constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x3fff84b38bc8 precision:8 min <integer_cst 0x3fff8494bd90 0> max <integer_cst 0x3fff8494bd48 255>> In function 'f', inlined from 'main' at /src/gcc/trunk/gcc/testsuite/g++.dg/ubsan/vla-1.C:11:4: /src/gcc/trunk/gcc/testsuite/g++.dg/ubsan/vla-1.C:6:24: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=]