public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59293] New: Bogus -Wsign-compare warning when using typeof() on a constant
@ 2013-11-25 19:59 shawn at churchofgit dot com
2013-11-25 21:44 ` [Bug c/59293] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: shawn at churchofgit dot com @ 2013-11-25 19:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59293
Bug ID: 59293
Summary: Bogus -Wsign-compare warning when using typeof() on a
constant
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: shawn at churchofgit dot com
#define MAX(a,b) \
__extension__ ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a > _b ? _a : _b; \
})
int main() {
if (MAX(5, (unsigned)3))
return 1;
return 0;
}
gives:
excessive_signed_compare.c:5:28: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
_a > _b ? _a : _b; \
^
excessive_signed_compare.c:9:6: note: in expansion of macro ‘MAX’
if (MAX(5, (unsigned)3))
^
excessive_signed_compare.c:5:38: warning: signed and unsigned type in
conditional expression [-Wsign-compare]
_a > _b ? _a : _b; \
>From gcc-bugs-return-435821-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Nov 25 20:10:39 2013
Return-Path: <gcc-bugs-return-435821-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4057 invoked by alias); 25 Nov 2013 20:10:39 -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 3933 invoked by uid 48); 25 Nov 2013 20:10:36 -0000
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/59258] ubsan: ICE(segfault): stack-buffer-overflow with -fsanitize=undefined
Date: Mon, 25 Nov 2013 20:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: burnus at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59258-4-sYzqgZEv4L@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59258-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59258-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: 2013-11/txt/msg02598.txt.bz2
Content-length: 624
http://gcc.gnu.org/bugzilla/show_bug.cgi?idY258
--- Comment #11 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #10)
> Created attachment 31289 [details]
> Untested fix for the dwarf2out.c ICE.
Seem to solve the problem with both -g and no "-g" for one unreduced test file.
Thanks!
> Perhaps my
> * ubsan.c (ubsan_source_location): Don't crash on unknown locations.
> change will be unneeded now?
Possibly yes; when I revert it, PR59250's test case still passes and also the
unreduced test case (for this PR's problem) passes. (I will try the bigger code
tomorrow.)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/59293] Bogus -Wsign-compare warning when using typeof() on a constant
2013-11-25 19:59 [Bug c/59293] New: Bogus -Wsign-compare warning when using typeof() on a constant shawn at churchofgit dot com
@ 2013-11-25 21:44 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-11-25 21:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59293
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I don't think this is a bogus warning as the warning is correct as you have a
signed int variable > unsigned int variable. The compiler does not know that
variable is assigned to a constant here.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-25 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-25 19:59 [Bug c/59293] New: Bogus -Wsign-compare warning when using typeof() on a constant shawn at churchofgit dot com
2013-11-25 21:44 ` [Bug c/59293] " pinskia 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).