public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "asolokha at gmx dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/94905] Bogus warning -Werror=maybe-uninitialized
Date: Sun, 03 May 2020 15:02:37 +0000	[thread overview]
Message-ID: <bug-94905-4-LvQ7JzZTQy@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94905-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2020-05-03 15:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 16:25 [Bug c++/94905] New: " bug-apl at gnu dot org
2020-05-01 22:41 ` [Bug c++/94905] " glisse at gcc dot gnu.org
2020-05-03 13:28 ` bug-apl at gnu dot org
2020-05-03 15:02 ` asolokha at gmx dot com [this message]
2020-05-03 16:10 ` bug-apl at gnu dot org
2020-05-03 16:16 ` bug-apl at gnu dot org
2020-05-03 16:26 ` asolokha at gmx dot com
2020-07-02 15:47 ` moller at mollerware dot com
2020-07-02 15:51 ` moller at mollerware dot com
2020-09-03 18:34 ` manu at gcc dot gnu.org
2020-09-03 18:46 ` [Bug c++/94905] [10 Regression] " manu at gcc dot gnu.org
2021-04-08 16:34 ` [Bug tree-optimization/94905] [10/11 " jason at gcc dot gnu.org
2022-01-21 13:41 ` rguenth at gcc dot gnu.org
2022-01-21 13:41 ` rguenth at gcc dot gnu.org
2022-01-21 13:43 ` rguenth at gcc dot gnu.org
2022-01-31 14:50 ` marxin at gcc dot gnu.org
2022-04-07  9:39 ` rguenth at gcc dot gnu.org
2022-04-07 10:01 ` jakub at gcc dot gnu.org
2022-06-28 10:40 ` jakub at gcc dot gnu.org
2023-07-07 10:37 ` [Bug tree-optimization/94905] [11 " rguenth 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-94905-4-LvQ7JzZTQy@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).