public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/102403] New: [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364
@ 2021-09-18 21:09 msebor at gcc dot gnu.org
  2021-09-18 21:11 ` [Bug middle-end/102403] " msebor at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-09-18 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102403
           Summary: [12 Regression] ICE in in init_from_control_deps, at
                    gimple-predicate-analysis.cc:2364
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

As reported in
https://gcc.gnu.org/pipermail/gcc-patches/2021-September/579736.html, the
following test case reduced from s_fmaf.c triggers an ICE in the new
predicate-analysis module introduced in r12-3640.

$ cat s_fmaf.c && gcc -S -O2 -Wall -Werror s_fmaf.c
int __fmaf (void)
{
  int a = 0;
  int b, c, d, e, f;

  int r = 0;

  switch (b)
    {
    default:
      c |= 1;

    case 0:
      if (c == 0)
        a = 1;

      switch (d) {
      case 15:
        f = c;
        break;

      case 11:
      case 6:
      case 4:
        f = c;
      case 10:
        e = a;
      }

      if (e == 0)
        f = 0;

      r = f;
  }
  return r;
}
s_fmaf.c: In function ‘__fmaf’:
s_fmaf.c:8:3: error: ‘b’ is used uninitialized [-Werror=uninitialized]
    8 |   switch (b)
      |   ^~~~~~
s_fmaf.c:4:7: note: ‘b’ was declared here
    4 |   int b, c, d, e, f;
      |       ^
s_fmaf.c:4:13: error: ‘d’ is used uninitialized [-Werror=uninitialized]
    4 |   int b, c, d, e, f;
      |             ^
s_fmaf.c:4:10: error: ‘c’ may be used uninitialized
[-Werror=maybe-uninitialized]
    4 |   int b, c, d, e, f;
      |          ^
during GIMPLE pass: uninit
s_fmaf.c:1:5: internal compiler error: in init_from_control_deps, at
gimple-predicate-analysis.cc:2364
    1 | int __fmaf (void)
      |     ^~~~~~
0x264d8b4 predicate::init_from_control_deps(vec<edge_def*, va_heap, vl_ptr>
const*, unsigned int)
        /src/gcc/master/gcc/gimple-predicate-analysis.cc:2364
0x264c28c predicate::init_from_phi_def(gphi*)
        /src/gcc/master/gcc/gimple-predicate-analysis.cc:1829
0x264c47a predicate::is_use_guarded(gimple*, basic_block_def*, gphi*, unsigned
int, hash_set<gphi*, false, default_hash_traits<gphi*> >*)
        /src/gcc/master/gcc/gimple-predicate-analysis.cc:1902
0x264c5b3 predicate::is_use_guarded(gimple*, basic_block_def*, gphi*, unsigned
int)
        /src/gcc/master/gcc/gimple-predicate-analysis.cc:1933
0x1672895 find_uninit_use
        /src/gcc/master/gcc/tree-ssa-uninit.c:1092
0x1672b11 warn_uninitialized_phi
        /src/gcc/master/gcc/tree-ssa-uninit.c:1149
0x1673090 execute_late_warn_uninitialized
        /src/gcc/master/gcc/tree-ssa-uninit.c:1275
0x167310b execute
        /src/gcc/master/gcc/tree-ssa-uninit.c:1288
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] 5+ messages in thread

* [Bug middle-end/102403] [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364
  2021-09-18 21:09 [Bug middle-end/102403] New: [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364 msebor at gcc dot gnu.org
@ 2021-09-18 21:11 ` msebor at gcc dot gnu.org
  2021-09-19 10:21 ` zhendong.su at inf dot ethz.ch
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-09-18 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-09-18
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|                            |ice-on-valid-code
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
             Blocks|                            |24639
   Target Milestone|---                         |12.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The ICE was observed on nios2-linux-gnu and csky-linux-gnu but the test case in
comment 0 reproduces it with the native GCC on x86_64.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues

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

* [Bug middle-end/102403] [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364
  2021-09-18 21:09 [Bug middle-end/102403] New: [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364 msebor at gcc dot gnu.org
  2021-09-18 21:11 ` [Bug middle-end/102403] " msebor at gcc dot gnu.org
@ 2021-09-19 10:21 ` zhendong.su at inf dot ethz.ch
  2021-09-19 23:23 ` cvs-commit at gcc dot gnu.org
  2021-09-19 23:33 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2021-09-19 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

Zhendong Su <zhendong.su at inf dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zhendong.su at inf dot ethz.ch

--- Comment #2 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Another repro:

[603] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210919 (experimental) [master r12-3660-ge9e46864cd0] (GCC)
[604] %
[604] % gcctk -O2 small.c
[605] %
[605] % gcctk -O2 -Wall -Wextra small.c
during GIMPLE pass: uninit
small.c: In function ‘main’:
small.c:6:5: internal compiler error: in init_from_control_deps, at
gimple-predicate-analysis.cc:2364
    6 | int main() {
      |     ^~~~
0x1a93e03 predicate::init_from_control_deps(vec<edge_def*, va_heap, vl_ptr>
const*, unsigned int)
        ../../gcc-trunk/gcc/gimple-predicate-analysis.cc:2364
0x1a954ff predicate::init_from_phi_def(gphi*)
        ../../gcc-trunk/gcc/gimple-predicate-analysis.cc:1829
0x1a989b4 predicate::is_use_guarded(gimple*, basic_block_def*, gphi*, unsigned
int, hash_set<gphi*, false, default_hash_traits<gphi*> >*)
        ../../gcc-trunk/gcc/gimple-predicate-analysis.cc:1874
0x1a99064 predicate::is_use_guarded(gimple*, basic_block_def*, gphi*, unsigned
int)
        ../../gcc-trunk/gcc/gimple-predicate-analysis.cc:1933
0x103df8f find_uninit_use
        ../../gcc-trunk/gcc/tree-ssa-uninit.c:1092
0x103df8f warn_uninitialized_phi
        ../../gcc-trunk/gcc/tree-ssa-uninit.c:1150
0x103df8f execute_late_warn_uninitialized
        ../../gcc-trunk/gcc/tree-ssa-uninit.c:1275
0x103df8f execute
        ../../gcc-trunk/gcc/tree-ssa-uninit.c:1288
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.
[606] %
[606] % cat small.c
int printf(const char *, ...);
int a[1], b, c, d, e, h;
static int f;
long g;
void i() { b = 1 ^ a[b ^ (c & 1)]; }
int main() {
  int j;
  if (!f && ~h) {
    if (g)
      goto L2;
  } else {
    int m = 0;
  L1:
    e = m;
  L2:
    m ^= 1;
    if (d)
      printf("0");
    for (j = 0; j < 10; j++)
      i();
    goto L1;
  }
  return 0;
}

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

* [Bug middle-end/102403] [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364
  2021-09-18 21:09 [Bug middle-end/102403] New: [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364 msebor at gcc dot gnu.org
  2021-09-18 21:11 ` [Bug middle-end/102403] " msebor at gcc dot gnu.org
  2021-09-19 10:21 ` zhendong.su at inf dot ethz.ch
@ 2021-09-19 23:23 ` cvs-commit at gcc dot gnu.org
  2021-09-19 23:33 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-19 23:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:825293da703aa1f7ce870b40afce91c1e8b6c0fa

commit r12-3674-g825293da703aa1f7ce870b40afce91c1e8b6c0fa
Author: Martin Sebor <msebor@redhat.com>
Date:   Sun Sep 19 17:18:48 2021 -0600

    Correct a function pre/postcondition [PR102403].

    Resolves:
    PR middle-end/102403 - ICE in init_from_control_deps, at
gimple-predicate-analysis.cc:2364

    gcc/ChangeLog:
            PR middle-end/102403
            * gimple-predicate-analysis.cc (predicate::init_from_control_deps):
            Correct a function pre/postcondition.

    gcc/testsuite/ChangeLog:
            PR middle-end/102403
            * gcc.dg/uninit-pr102403.c: New test.
            * gcc.dg/uninit-pr102403-c2.c: New test.

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

* [Bug middle-end/102403] [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364
  2021-09-18 21:09 [Bug middle-end/102403] New: [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364 msebor at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-09-19 23:23 ` cvs-commit at gcc dot gnu.org
@ 2021-09-19 23:33 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-09-19 23:33 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
Thanks for the additional test case!

The problem should be fixed now.

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

end of thread, other threads:[~2021-09-19 23:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18 21:09 [Bug middle-end/102403] New: [12 Regression] ICE in in init_from_control_deps, at gimple-predicate-analysis.cc:2364 msebor at gcc dot gnu.org
2021-09-18 21:11 ` [Bug middle-end/102403] " msebor at gcc dot gnu.org
2021-09-19 10:21 ` zhendong.su at inf dot ethz.ch
2021-09-19 23:23 ` cvs-commit at gcc dot gnu.org
2021-09-19 23:33 ` 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).