bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug c++/94905] Bogus warning -Werror=maybe-uninitialized


From: asolokha at gmx dot com
Subject: [Bug c++/94905] Bogus warning -Werror=maybe-uninitialized
Date: Sun, 03 May 2020 15:02:37 +0000

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

Arseny Solokha <asolokha at gmx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asolokha at gmx dot com

--- Comment #3 from Arseny Solokha <asolokha at gmx dot com> ---
The best I've been able to come up with is the following, reduced from APL 1.8:

enum { MAX_RANK = 8 };

struct Shape {
  Shape(int len) { rho[0] = len; }

  Shape(Shape &other) {
    for (int r = 0; r < MAX_RANK; ++r)
      rho[r] = other.rho[r];
  }

  Shape insert_axis() const;

  int rho[MAX_RANK];
};

int insert_axis_len;

Shape Shape::insert_axis() const {
  {
    Shape ret(insert_axis_len);
    return ret;
  }
}

% g++-10.1.0 -O2 -Wall -Werror -c fojcdnsn.cc
fojcdnsn.cc: In member function 'Shape Shape::insert_axis() const':
fojcdnsn.cc:8:27: error: ''target_mem_ref' not supported by
dump_expr<expression error>' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
    8 |       rho[r] = other.rho[r];
      |                ~~~~~~~~~~~^

That's with gcc-10.1.0-RC-20200430; I failed to reproduce it at all with gcc 9.
However, without preprocessed source provided by the reporter it's impossible
to tell whether that's the issue in question.

So please, provide a self-contained testcase! It's not even necessary to
minimize it, as in many cases it's easy to do with tools like C-Reduce or newly
emerged C-Vise and can later be done by developers themselves. But without the
testcase developers cannot and likely won't do anything about the issue you
have in the first place.

-- 
You are receiving this mail because:
You reported the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]