public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98592] New: ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF
@ 2021-01-07 22:42 msebor at gcc dot gnu.org
  2021-01-08  8:35 ` [Bug c/98592] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-01-07 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98592
           Summary: ICE in gimple_canonical_types_compatible_p while
                    formatting a MEM_REF
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

With the ICEs reported in pr98578 and pr95768 both fixed, the latest trunk now
fails with another ICE in the same code on the test case below.  Apparently,
gimple_canonical_types_compatible_p() doesn't like mixed array and scalar types
(t1 is an int, t2 is an int array).

$ cat t.c && gcc -O2 -S -Wall -fdump-tree-uninit=/dev/stdout t.c
void f (int);

void g (int n)
{
  int a[n][3];
  f (((*(int(*)[4])&a[1][2]))[3]);

}

;; Function g (g, funcdef_no=0, decl_uid=1945, cgraph_uid=1, symbol_order=0)

‘
during GIMPLE pass: uninit
dump file: /dev/stdout



EMERGENCY DUMP:

void g (int n)
{
  int[0:D.1950][3] * a.1;
  sizetype _1;
  int _6;
  sizetype _7;

  <bb 2> [local count: 1073741824]:
  _1 = (sizetype) n_2(D);
  _7 = _1 * 12;
  a.1_9 = __builtin_alloca_with_align (_7, 32);
  _6 = MEM[(int[4] *)a.1_9 + 20B][3];
  f (_6);
  return;

}


In function ‘g’:
in gimple_canonical_types_compatible_p, at tree.c:14367
    3 | void g (int n)
      |      ^
0x195c249 gimple_canonical_types_compatible_p(tree_node const*, tree_node
const*, bool)
        /src/gcc/master/gcc/tree.c:14366
0xb3616f print_mem_ref
        /src/gcc/master/gcc/c-family/c-pretty-print.c:1869
0xb3686d c_pretty_printer::unary_expression(tree_node*)
        /src/gcc/master/gcc/c-family/c-pretty-print.c:2005
0xb380fd c_pretty_printer::expression(tree_node*)
        /src/gcc/master/gcc/c-family/c-pretty-print.c:2508
0xb35922 c_pretty_printer::postfix_expression(tree_node*)
        /src/gcc/master/gcc/c-family/c-pretty-print.c:1729
0xb3517a c_pretty_printer::postfix_expression(tree_node*)
        /src/gcc/master/gcc/c-family/c-pretty-print.c:1587
0xb380da c_pretty_printer::expression(tree_node*)
        /src/gcc/master/gcc/c-family/c-pretty-print.c:2493
0xa31fa2 c_tree_printer
        /src/gcc/master/gcc/c/c-objc-common.c:317
0x2883a45 pp_format(pretty_printer*, text_info*)
        /src/gcc/master/gcc/pretty-print.c:1475
0x2859d96 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        /src/gcc/master/gcc/diagnostic.c:1216
0x285a3e7 diagnostic_impl
        /src/gcc/master/gcc/diagnostic.c:1366
0x285aca3 warning_at(unsigned int, int, char const*, ...)
        /src/gcc/master/gcc/diagnostic.c:1503
0x180d584 maybe_warn_operand
        /src/gcc/master/gcc/tree-ssa-uninit.c:418
0x180e15d warn_uninitialized_vars
        /src/gcc/master/gcc/tree-ssa-uninit.c:657
0x1813575 execute
        /src/gcc/master/gcc/tree-ssa-uninit.c:3019
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/98592] ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF
  2021-01-07 22:42 [Bug c/98592] New: ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF msebor at gcc dot gnu.org
@ 2021-01-08  8:35 ` rguenth at gcc dot gnu.org
  2021-01-08 19:56 ` msebor at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-08  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Why on earth are you calling gimple_canonical_types_compatible_p!?  From
a quick look you likely want TYPE_MAIN_VARIANT (access_type) !=
TYPE_MAIN_VARIANT (arg_type)?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/98592] ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF
  2021-01-07 22:42 [Bug c/98592] New: ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF msebor at gcc dot gnu.org
  2021-01-08  8:35 ` [Bug c/98592] " rguenth at gcc dot gnu.org
@ 2021-01-08 19:56 ` msebor at gcc dot gnu.org
  2021-01-12 17:48 ` [Bug c/98592] [11 Regression] " msebor at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-01-08 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The idea is to print the cast indicating the MEM_REF type only when the size of
the accessed type is different from the size of the element type of the
underlying array or pointer.  Structural equivalence seemed like a good fit. 
But using TYPE_MAIN_VARIANT would work too (and include more information).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/98592] [11 Regression] ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF
  2021-01-07 22:42 [Bug c/98592] New: ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF msebor at gcc dot gnu.org
  2021-01-08  8:35 ` [Bug c/98592] " rguenth at gcc dot gnu.org
  2021-01-08 19:56 ` msebor at gcc dot gnu.org
@ 2021-01-12 17:48 ` msebor at gcc dot gnu.org
  2021-01-12 20:03 ` cvs-commit at gcc dot gnu.org
  2021-01-12 21:38 ` msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-01-12 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-01-12
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
            Summary|ICE in                      |[11 Regression] ICE in
                   |gimple_canonical_types_comp |gimple_canonical_types_comp
                   |atible_p while formatting a |atible_p while formatting a
                   |MEM_REF                     |MEM_REF

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/98592] [11 Regression] ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF
  2021-01-07 22:42 [Bug c/98592] New: ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF msebor at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-12 17:48 ` [Bug c/98592] [11 Regression] " msebor at gcc dot gnu.org
@ 2021-01-12 20:03 ` cvs-commit at gcc dot gnu.org
  2021-01-12 21:38 ` msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-12 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:5a9cfad2de92f2d65585774acb524b3fa17621b5

commit r11-6621-g5a9cfad2de92f2d65585774acb524b3fa17621b5
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jan 12 12:58:27 2021 -0700

    Avoid a couple more ICEs in print_mem_ref (PR c/98597).

    Resolves:
    PR c/98597 - ICE in -Wuninitialized printing a MEM_REF
    PR c/98592 - ICE in gimple_canonical_types_compatible_p while formatting

    gcc/c-family/ChangeLog:

            PR c/98597
            PR c/98592
            * c-pretty-print.c (print_mem_ref): Avoid assuming MEM_REF operand
            has pointer type.  Remove redundant code.  Avoid calling
            gimple_canonical_types_compatible_p.

    gcc/testsuite/ChangeLog:

            PR c/98597
            PR c/98592
            * g++.dg/warn/Wuninitialized-13.C: New test.
             gcc.dg/uninit-39.c: New test.

            #

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/98592] [11 Regression] ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF
  2021-01-07 22:42 [Bug c/98592] New: ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF msebor at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-01-12 20:03 ` cvs-commit at gcc dot gnu.org
@ 2021-01-12 21:38 ` msebor at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-01-12 21:38 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
I've changed it to TYPE_MAIN_VARIANT in r11-6621.  It didn't cause any
testsuite fallout so it wasn't being sufficiently tested anyway.  If it in the
future turns out that something more involved is necessary let's revisit it
then.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-12 21:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 22:42 [Bug c/98592] New: ICE in gimple_canonical_types_compatible_p while formatting a MEM_REF msebor at gcc dot gnu.org
2021-01-08  8:35 ` [Bug c/98592] " rguenth at gcc dot gnu.org
2021-01-08 19:56 ` msebor at gcc dot gnu.org
2021-01-12 17:48 ` [Bug c/98592] [11 Regression] " msebor at gcc dot gnu.org
2021-01-12 20:03 ` cvs-commit at gcc dot gnu.org
2021-01-12 21:38 ` msebor at gcc dot gnu.org

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).