public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/2972] -Wuninitialized could warn about uninitialized member variable usage in constructors
Date: Mon, 29 Sep 2014 14:54:00 -0000	[thread overview]
Message-ID: <bug-2972-4-WiLDWqPjnY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-2972-4@http.gcc.gnu.org/bugzilla/>

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #21 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #20)
> Perhaps a better alternative is to warn only if the uninitialized member is
> used in a mem-initializer. Then, when building the constructor call, mark
> the uninitialized members somehow as uninitialized for the middle-end, and
> let the middle-end handle the cases in the body of the constructor. The
> first part would already fix PR19808. The second part will fix this bug with
> fewer false positives than the proposed patch.

And this comment gives some ideas:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19808#c9

Richard B, you say that: "using <error-mark> [for marking undefined memory] is
just a random (and probably bad) idea."  Intuitively this seems more scalable,
since one could propagate the undefined value like VRP does.

The other alternative "Introducing a SSA name default definition for A (even
though not of register type)", however, seems possible already. no? We do
already check for default definitions in virtual operands, tree-ssa-uninit.c
says:

      /* For memory the only cheap thing we can do is see if we
         have a use of the default def of the virtual operand.

So what is missing here?
>From gcc-bugs-return-462857-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Sep 29 15:15:44 2014
Return-Path: <gcc-bugs-return-462857-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1903 invoked by alias); 29 Sep 2014 15:15:43 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 1875 invoked by uid 48); 29 Sep 2014 15:15:37 -0000
From: "itay at phobotic dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/63408] New: GCC emits incorrect FMA instruction
Date: Mon, 29 Sep 2014 15:15:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.8.4
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: itay at phobotic dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-63408-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-09/txt/msg02691.txt.bz2
Content-length: 1035

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc408

            Bug ID: 63408
           Summary: GCC emits incorrect FMA instruction
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: itay at phobotic dot com

When compiling the following function

float f(float a, int b)
{
    return a - (((float)b / 0x7fffffff) * 100);
}

with the following command-line options

arm-none-eabi-gcc -O2 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
-mcpu=cortex-m4

I get this code for f:

    fmsr    s14, r1    @ int
    flds    s15, .L2
    vcvt.f32.s32    s14, s14, #31
    fmsr    s13, r0
    vfma.f32    s13, s14, s15
    fmrs    r0, s13
    bx    lr
.L3:
    .align    2
.L2:
    .word    1120403456

The resulting code clearly adds the parenthesized expression to a rather than
subtracting it.

Replacing the minus sign with a plus sign results in the same code.


  parent reply	other threads:[~2014-09-29 14:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-2972-4@http.gcc.gnu.org/bugzilla/>
2010-12-03 19:07 ` redi at gcc dot gnu.org
2011-11-07 22:00 ` redi at gcc dot gnu.org
2012-08-21 17:21 ` paolo.carlini at oracle dot com
2012-08-21 17:27 ` redi at gcc dot gnu.org
2012-08-21 17:55 ` paolo.carlini at oracle dot com
2014-09-29 14:54 ` manu at gcc dot gnu.org [this message]
2021-11-19  3:54 ` mpolacek at gcc dot gnu.org
     [not found] <bug-2972-381@http.gcc.gnu.org/bugzilla/>
2006-01-22  3:43 ` gdr at gcc dot gnu dot org
2008-09-10 15:31 ` bangerth at dealii dot org
2010-02-24 13:05 ` manu at gcc dot gnu dot org
2010-06-03  1:14 ` redi at gcc dot gnu dot org
2010-06-03  8:48 ` manu at gcc dot gnu dot org
2010-06-03  9:18 ` jwakely dot gcc at gmail dot com
2010-06-03  9:28 ` jwakely dot gcc at gmail dot com
2010-06-03 10:16 ` paolo dot carlini at oracle dot com
2010-06-03 11:25 ` jwakely dot gcc at gmail dot com
     [not found] <20010527045600.2972.pere@hungry.com>
2003-08-04  0:41 ` pinskia at physics dot uc dot edu
2004-01-07  3:35 ` eric-gcc at omnifarious dot 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-2972-4-WiLDWqPjnY@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).