public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ralgith at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/44924] Broken htons, invalid conversion warning
Date: Mon, 12 Jul 2010 20:18:00 -0000	[thread overview]
Message-ID: <20100712201744.8065.qmail@sourceware.org> (raw)
In-Reply-To: <bug-44924-15287@http.gcc.gnu.org/bugzilla/>



------- Comment #4 from ralgith at gmail dot com  2010-07-12 20:17 -------
(In reply to comment #3)
> >-Wconversion
> Will cause this warning.
> 
> 
>    sa.sin_port = (__extension__ ({ register unsigned short int __v, __x =
> (siteinfo->port); if (__builtin_constant_p (__x)) __v = ((((__x) >> 8) & 0xff)
> | (((__x) & 0xff) << 8)); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x)
> : "cc"); __v; }));
> 
> 
> __v = ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8));
> is the part which is causing the warning.  The issue is the (__x) >> 8 is
> implictly casted into int.
> 

Yet, if I remove the optimization flag -Os and keep the -Wconversion it doesn't
generate the warning. So there's still an issue here, even if the issue is that
-Wconversion is MISSING this when the code isn't optimized. Or perhaps I'm
missing something else here.

Regardless, is there a work around? I really enjoy using all my optimization
and -W flags because I like to have the best code possible. Thanks.


-- 


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


  parent reply	other threads:[~2010-07-12 20:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 20:03 [Bug c++/44924] New: " ralgith at gmail dot com
2010-07-12 20:04 ` [Bug c++/44924] " ralgith at gmail dot com
2010-07-12 20:07 ` ralgith at gmail dot com
2010-07-12 20:11 ` pinskia at gcc dot gnu dot org
2010-07-12 20:18 ` ralgith at gmail dot com [this message]
2010-07-24 18:48 ` pinskia at gcc dot gnu dot org
2010-07-24 20:02 ` ralgith at gmail dot com

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=20100712201744.8065.qmail@sourceware.org \
    --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).