public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "chengniansun at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/40752] -Wconversion generates false warnings for operands not larger than target type
Date: Mon, 10 Feb 2014 01:14:00 -0000	[thread overview]
Message-ID: <bug-40752-4-iugUYFWX5f@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-40752-4@http.gcc.gnu.org/bugzilla/>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 2897 bytes --]

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

--- Comment #25 from Chengnian Sun <chengniansun at gmail dot com> ---
Today I encountered a similar case as follows. The conversion warning by gcc is
not true as right-shifting an unsigned short decreases the value. 

BTW clang does not emit warnings for this code snippet. 


$: cat s1.c
unsigned short fn(unsigned short a, int right) {
  return a >> right;
}
$: gcc-trunk -c -Wconversion s1.c
s1.c: In function ‘fn’:
s1.c:2:3: warning: conversion to ‘short unsigned int’ from ‘int’ may alter its
value [-Wconversion]
   return a >> right;
   ^
$: clang-trunk -c -Wconversion s1.c
$:
>From gcc-bugs-return-443154-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Feb 10 01:28:47 2014
Return-Path: <gcc-bugs-return-443154-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15230 invoked by alias); 10 Feb 2014 01:28:47 -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 15198 invoked by uid 48); 10 Feb 2014 01:28:43 -0000
From: "dartmetrash at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60113] Internal compiler error
Date: Mon, 10 Feb 2014 01:28: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.6.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dartmetrash at gmail dot com
X-Bugzilla-Status: WAITING
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: attachments.created
Message-ID: <bug-60113-4-qIPcKsoEnk@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60113-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60113-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/msg00911.txt.bz2
Content-length: 461

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`113

--- Comment #2 from lmat <dartmetrash at gmail dot com> ---
Created attachment 32090
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id2090&actioníit
Bug report including command line output.

My apologies! I was quite sure I had attached it, but I see quite plainly that
I had failed! It appears that my upload was too big. I've divided it up using

split --lines 35000 ...

which creates three files.


  parent reply	other threads:[~2014-02-10  1:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-40752-4@http.gcc.gnu.org/bugzilla/>
2011-09-25 21:55 ` manu at gcc dot gnu.org
2012-03-24 20:21 ` manu at gcc dot gnu.org
2012-03-24 21:40 ` DeusExSophismata at gmail dot com
2012-05-05 15:31 ` wessjunk at gmail dot com
2012-05-05 16:05 ` manu at gcc dot gnu.org
2012-06-20 14:59 ` dichlofos-mv at yandex dot ru
2014-02-10  1:14 ` chengniansun at gmail dot com [this message]
2014-09-16 21:07 ` hariharan.gcc at gmail dot com
2009-07-14 19:17 [Bug c++/40752] New: -Wconversion generates false warnings photon at seznam dot cz
2009-07-16  7:07 ` [Bug c++/40752] -Wconversion generates false warnings for operands not larger than target type photon at seznam dot cz
2009-07-23 15:35 ` manu at gcc dot gnu dot org
2009-09-05 14:05 ` manu at gcc dot gnu dot org
2010-06-11 20:22 ` manu at gcc dot gnu dot org
2010-06-12 16:46 ` photon at seznam dot cz

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-40752-4-iugUYFWX5f@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).