This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/86058] New: TARGET_MEM_REF causing incorrect message for -Wmaybe-uninitialized warning


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

            Bug ID: 86058
           Summary: TARGET_MEM_REF causing incorrect message for
                    -Wmaybe-uninitialized warning
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrew.burgess at embecosm dot com
  Target Milestone: ---

The following:

    /* { dg-do compile } */
    /* { dg-options "-O2 -Wuninitialized -Wmaybe-uninitialized" } */

    extern void foo (int *);

    void
    zip (int *out, int indx)
    {
      int arr[10];

      for (int i = 0; i < indx; ++i)
        out[i] = arr[i] + 1;  /* { dg-warning "'arr[i]' may be used
uninitialized in this function" } */

      foo (arr);
      foo (out);
    }

When compiled gives this warning:

    $ gcc -Wuninitialized -Wmaybe-uninitialized -O2 test.c
    #‘target_mem_ref’ not supported by expression#’ test.c: In function ‘zip’:
    test.c:12:17: warning:  may be used uninitialized in this function
[-Wmaybe-uninitialized]
         out[i] = arr[i] + 1;  /* { dg-warning "'arr[i]' may be used
uninitialized in this function" } */
                  ~~~^~~

The problem seems to arise from tree-ssa-uninit.c:warn_uninitialized_vars which
ends up calling warning_at and using %qE to format a tree, which is of type
TRAGET_MEM_REF.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]