public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/60036] New: Spurious signedness conversion warning with relational operator
@ 2014-02-03  0:03 chengniansun at gmail dot com
  2014-02-04 10:59 ` [Bug c/60036] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: chengniansun at gmail dot com @ 2014-02-03  0:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60036

            Bug ID: 60036
           Summary: Spurious signedness conversion warning with relational
                    operator
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

Gcc-trunk emits a signedness conversion warning for the statement "f ^= fn1() >
a;". However, as the value of "fn1() > a" is either 1 or 0, the warning is not
true. 

Moreover, Gcc-4.8 and 4.7 do not output this warning. And if I change the
statement to "f = f ^ (fn1() > a);", gcc-trunk does not emit this warning,
either.



$: cat conversion-for-boolean.c
extern int fn1();
unsigned fn(int a) {
  unsigned f = 9;
  f ^= fn1() > a;
  return f;
}

$: gcc-trunk -c -Wconversion -std=c11 conversion-for-boolean.c
conversion-for-boolean.c: In function ‘fn’:
conversion-for-boolean.c:4:5: warning: conversion to ‘unsigned int’ from ‘int’
may change the sign of the result [-Wsign-conversion]
   f ^= fn1() > a;
     ^
$: gcc-4.8 -c -Wconversion -std=c11 conversion-for-boolean.c
$: gcc-4.7 -c -Wconversion -std=c11 conversion-for-boolean.c
$: gcc-trunk --version
gcc-trunk (GCC) 4.9.0 20140131 (experimental)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>From gcc-bugs-return-442340-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Feb 03 01:40:36 2014
Return-Path: <gcc-bugs-return-442340-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3922 invoked by alias); 3 Feb 2014 01:40:34 -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 3880 invoked by uid 48); 3 Feb 2014 01:40:29 -0000
From: "alexa.gerancho at hushmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/58854] [4.8 regression] "sub sp, fp, #40" hoisted above frame accesses
Date: Mon, 03 Feb 2014 01:40:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: alexa.gerancho at hushmail dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: ramana at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-58854-4-x3AD9ZUnsN@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58854-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58854-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-02/txt/msg00097.txt.bz2
Content-length: 567

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX854

Alexa <alexa.gerancho at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alexa.gerancho at hushmail dot com

--- Comment #13 from Alexa <alexa.gerancho at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen live from the domain http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.


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

* [Bug c/60036] Spurious signedness conversion warning with relational operator
  2014-02-03  0:03 [Bug c/60036] New: Spurious signedness conversion warning with relational operator chengniansun at gmail dot com
@ 2014-02-04 10:59 ` mpolacek at gcc dot gnu.org
  2014-02-04 12:17 ` [Bug c/60036] [4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-04 10:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60036

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This is so since r206620.


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

* [Bug c/60036] [4.9 Regression] Spurious signedness conversion warning with relational operator
  2014-02-03  0:03 [Bug c/60036] New: Spurious signedness conversion warning with relational operator chengniansun at gmail dot com
  2014-02-04 10:59 ` [Bug c/60036] " mpolacek at gcc dot gnu.org
@ 2014-02-04 12:17 ` mpolacek at gcc dot gnu.org
  2014-02-04 18:06 ` mpolacek at gcc dot gnu.org
  2014-02-04 18:08 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-04 12:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60036

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-02-04
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
            Summary|Spurious signedness         |[4.9 Regression] Spurious
                   |conversion warning with     |signedness conversion
                   |relational operator         |warning with relational
                   |                            |operator
     Ever confirmed|0                           |1


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

* [Bug c/60036] [4.9 Regression] Spurious signedness conversion warning with relational operator
  2014-02-03  0:03 [Bug c/60036] New: Spurious signedness conversion warning with relational operator chengniansun at gmail dot com
  2014-02-04 10:59 ` [Bug c/60036] " mpolacek at gcc dot gnu.org
  2014-02-04 12:17 ` [Bug c/60036] [4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2014-02-04 18:06 ` mpolacek at gcc dot gnu.org
  2014-02-04 18:08 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-04 18:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60036

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Tue Feb  4 18:05:29 2014
New Revision: 207481

URL: http://gcc.gnu.org/viewcvs?rev=207481&root=gcc&view=rev
Log:
    PR c/60036
c-family/
    * c-common.c (conversion_warning): Unwrap C_MAYBE_CONST_EXPR and/or
    SAVE_EXPR.
testsuite/
    * gcc.dg/pr60036.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr60036.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/60036] [4.9 Regression] Spurious signedness conversion warning with relational operator
  2014-02-03  0:03 [Bug c/60036] New: Spurious signedness conversion warning with relational operator chengniansun at gmail dot com
                   ` (2 preceding siblings ...)
  2014-02-04 18:06 ` mpolacek at gcc dot gnu.org
@ 2014-02-04 18:08 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-04 18:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60036

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-02-04 18:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-03  0:03 [Bug c/60036] New: Spurious signedness conversion warning with relational operator chengniansun at gmail dot com
2014-02-04 10:59 ` [Bug c/60036] " mpolacek at gcc dot gnu.org
2014-02-04 12:17 ` [Bug c/60036] [4.9 Regression] " mpolacek at gcc dot gnu.org
2014-02-04 18:06 ` mpolacek at gcc dot gnu.org
2014-02-04 18:08 ` mpolacek 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).