public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/98969] [11 Regression] ICE: Segmentation fault (in print_mem_ref)
Date: Sat, 06 Feb 2021 16:16:44 +0000	[thread overview]
Message-ID: <bug-98969-4-cLd1JYM9rQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98969-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
I had already dealt with this problem in the pretty printer in r11-6621 (the
same way as in comment #2) but it regressed with Jakub's subsequent changes in
r11-6729.  It's also not the only regression that Jakub's change seems to have
caused.  Instrumenting GCC to print every MEM_REF it sees in
maybe_warn_operand() in tree-ssa-uninit.c causes the ICE below that I didn't
get when testing r11-6621.

I agree the pretty printer should as much as possible try to behave robustly
for bad MEM_REfs, if only to make debugging easier.

...
during GIMPLE pass: *early_warn_uninitialized
In function ‘void selftest::verify_clear_bit_region()’:
canonical types differ for identical types ‘unsigned char [3]’ and ‘unsigned
char [3]’
 5499 | } // namespace selftest
      | ^
0xe61a0a comptypes(tree_node*, tree_node*, int)
        /src/gcc/master/gcc/cp/typeck.c:1540
0xe61c07 same_type_ignoring_top_level_qualifiers_p(tree_node*, tree_node*)
        /src/gcc/master/gcc/cp/typeck.c:1576
0xaf4fe0 cxx_types_compatible_p(tree_node*, tree_node*)
        /src/gcc/master/gcc/cp/cp-objcp-common.c:123
0xf4f98e c_fold_indirect_ref_for_warn
        /src/gcc/master/gcc/c-family/c-pretty-print.c:1829
0xf50695 print_mem_ref
        /src/gcc/master/gcc/c-family/c-pretty-print.c:1953
0xf515bd c_pretty_printer::unary_expression(tree_node*)
        /src/gcc/master/gcc/c-family/c-pretty-print.c:2171
0xbad752 dump_expr
        /src/gcc/master/gcc/cp/error.c:2422
0xbb0ed8 expr_to_string(tree_node*)
        /src/gcc/master/gcc/cp/error.c:3188
0xbb4ffd cp_printer
        /src/gcc/master/gcc/cp/error.c:4356
0x2cba14f pp_format(pretty_printer*, text_info*)
        /src/gcc/master/gcc/pretty-print.c:1475
0x2c8ffd5 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        /src/gcc/master/gcc/diagnostic.c:1244
0x2c90675 diagnostic_impl
        /src/gcc/master/gcc/diagnostic.c:1406
0x2c90ad3 inform(unsigned int, char const*, ...)
        /src/gcc/master/gcc/diagnostic.c:1485
0x1c107c7 maybe_warn_operand
        /src/gcc/master/gcc/tree-ssa-uninit.c:255
0x1c11bf1 warn_uninitialized_vars
        /src/gcc/master/gcc/tree-ssa-uninit.c:660
0x1c17374 execute_early_warn_uninitialized
        /src/gcc/master/gcc/tree-ssa-uninit.c:3092
0x1c173f2 execute
        /src/gcc/master/gcc/tree-ssa-uninit.c:3127
...

The ICE is for this statement

  MEM <unsigned char[3]> [(char * {ref-all})&in] = MEM <unsigned char[3]>
[(char * {ref-all})&orig];

and the following value of e in print_mem_ref:

 <mem_ref 0x7fffe88d5a78
    type <array_type 0x7fffe74c9e70
        type <integer_type 0x7fffea815348 unsigned char sizes-gimplified public
unsigned type_6 QI
            size <integer_cst 0x7fffea7f7fa8 constant 8>
            unit-size <integer_cst 0x7fffea7f7fc0 constant 1>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea815348 precision:8 min <integer_cst 0x7fffea7f7fd8 0> max <integer_cst
0x7fffea7f7f78 255>
            pointer_to_this <pointer_type 0x7fffe902a690>>
        BLK
        size <integer_cst 0x7fffea818360 constant 24>
        unit-size <integer_cst 0x7fffe9198048 constant 3>
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe74c9e70
        domain <integer_type 0x7fffe8f7ad20 type <integer_type 0x7fffea815000
sizetype>
            sizes-gimplified type_6 DI
            size <integer_cst 0x7fffea7f7eb8 constant 64>
            unit-size <integer_cst 0x7fffea7f7ed0 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe8f7ad20 precision:64 min <integer_cst 0x7fffea7f7ee8 0> max <integer_cst
0x7fffea818090 2>>>

    arg:0 <addr_expr 0x7fffe6e09360
        type <pointer_type 0x7fffe6e01540 type <array_type 0x7fffe6e015e8>
            unsigned DI size <integer_cst 0x7fffea7f7eb8 64> unit-size
<integer_cst 0x7fffea7f7ed0 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe6e01540>

        arg:0 <var_decl 0x7fffe6e02510 orig type <array_type 0x7fffe6e015e8>
            used tree_1 tree_2 tree_6 read decl_5 BLK
/src/gcc/master/gcc/gimple-ssa-store-merging.c:5442:17 size <integer_cst
0x7fffea818360 24> unit-size <integer_cst 0x7fffe9198048 3>
            align:8 warn_if_not_align:0 context <function_decl 0x7fffe6e03700
verify_clear_bit_region> chain <var_decl 0x7fffe6e025a0 in>>
        /src/gcc/master/gcc/gimple-ssa-store-merging.c:5445:15 start:
/src/gcc/master/gcc/gimple-ssa-store-merging.c:5445:15 finish:
/src/gcc/master/gcc/gimple-ssa-store-merging.c:5445:18>
    arg:1 <integer_cst 0x7fffe7590cf0 type <pointer_type 0x7fffe74291f8>
constant 0>>

  parent reply	other threads:[~2021-02-06 16:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 17:06 [Bug c/98969] New: " asolokha at gmx dot com
2021-02-04 20:34 ` [Bug c/98969] " msebor at gcc dot gnu.org
2021-02-04 20:50 ` msebor at gcc dot gnu.org
2021-02-04 20:52 ` jakub at gcc dot gnu.org
2021-02-05  8:15 ` [Bug analyzer/98969] " rguenth at gcc dot gnu.org
2021-02-05 14:08 ` jakub at gcc dot gnu.org
2021-02-05 14:18 ` dmalcolm at gcc dot gnu.org
2021-02-06 16:16 ` msebor at gcc dot gnu.org [this message]
2021-02-06 17:10 ` msebor at gcc dot gnu.org
2021-02-11  1:59 ` dmalcolm at gcc dot gnu.org
2021-02-12  1:32 ` cvs-commit at gcc dot gnu.org
2021-02-12  1:36 ` dmalcolm at gcc dot gnu.org
2021-02-17 15:38 ` cvs-commit at gcc dot gnu.org
2021-02-17 15:40 ` dmalcolm at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98969-4-cLd1JYM9rQ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).