From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18948 invoked by alias); 4 Feb 2014 23:16:09 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18911 invoked by uid 48); 4 Feb 2014 23:16:04 -0000 From: "chengniansun at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59976] Spurious warning on converting const int variable to unsigned long (Also inconsistency between O0 and O1) Date: Tue, 04 Feb 2014 23:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: chengniansun at gmail 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: short_desc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg00346.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59976 Chengnian Sun changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Spurious warning on |Spurious warning on |converting const int |converting const int |variable to unsigned long |variable to unsigned long | |(Also inconsistency between | |O0 and O1) --- Comment #1 from Chengnian Sun --- The warning is gone if I compile the program with -O1.=20 I also have a similar example below: $: cat s.c unsigned g; void fn1() { int a; const unsigned char b =3D 0; a =3D b & g; } $: gcc-trunk -c -Wconversion -O0 s.c s.c: In function =E2=80=98fn1=E2=80=99: s.c:5:7: warning: conversion to =E2=80=98int=E2=80=99 from =E2=80=98unsigne= d int=E2=80=99 may change the sign of the result [-Wsign-conversion] a =3D b & g; ^ $: gcc-trunk -c -Wconversion -O1 s.c $: >>From gcc-bugs-return-442590-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Feb 04 23:53:50 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 5131 invoked by alias); 4 Feb 2014 23:53:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 5111 invoked by uid 48); 4 Feb 2014 23:53:45 -0000 From: "msebor at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60063] -Wunused-local-typedefs warning despite attribute used in a template Date: Tue, 04 Feb 2014 23:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gmail 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: Message-ID: In-Reply-To: References: 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/msg00347.txt.bz2 Content-length: 592 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60063 --- Comment #1 from Martin Sebor --- I confused attribute used with unused in the test case. With the latter, the warning is not emitted as one would expect. Attribute used isn't documented for types, so it's not completely clear whether the test is valid. Searching through the test suite, I came across Wunused-local-typedefs.c (apparently added for bug 33255) which exercises attribute used with a typedef, albeit in C code, so the test case might be valid after all and the documentation might need updating.