public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12194] New: htons() gives warning if compiled with gcc -Wconversion
@ 2010-11-05  7:03 johan162 at gmail dot com
  2010-11-10  7:54 ` [Bug libc/12194] " drepper.fsp at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: johan162 at gmail dot com @ 2010-11-05  7:03 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12194

           Summary: htons() gives warning if compiled with gcc
                    -Wconversion
           Product: glibc
           Version: 2.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: johan162@gmail.com


The following (legitimate) code will generate a warning when both -O2 and 
-Wconversion is enabled but not when only -Wconversion is enabled. 

Code:
#include <arpa/inet.h>
// Nonsense code to illustrate problem
int main(void) {
    uint16_t portnbr=0;
    uint16_t n_portnbr = htons(portnbr);
    exit(0);
}

With optimization


$> gcc -std=gnu99 -Wconversion -Werror -O2 -c tsthtons.c
cc1: warnings being treated as errors
tsthtons.c: In function ‘main’:
tsthtons.c:6: error: conversion to ‘short unsigned int’ from ‘int’ may alter
its value


and without


$>gcc -std=gnu99 -Wconversion -Werror  -c tsthtons.c
$>

in both cases

gcc --version
gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]
Copyright (C) 2009 Free Software Foundation, Inc.


and gnu clib v2.10.1

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12194] htons() gives warning if compiled with gcc -Wconversion
  2010-11-05  7:03 [Bug libc/12194] New: htons() gives warning if compiled with gcc -Wconversion johan162 at gmail dot com
@ 2010-11-10  7:54 ` drepper.fsp at gmail dot com
  2012-06-20  5:56 ` andersk at mit dot edu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: drepper.fsp at gmail dot com @ 2010-11-10  7:54 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12194

Ulrich Drepper <drepper.fsp at gmail dot com> changed:

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

--- Comment #1 from Ulrich Drepper <drepper.fsp at gmail dot com> 2010-11-10 07:54:40 UTC ---
Changed in git.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12194] htons() gives warning if compiled with gcc -Wconversion
  2010-11-05  7:03 [Bug libc/12194] New: htons() gives warning if compiled with gcc -Wconversion johan162 at gmail dot com
  2010-11-10  7:54 ` [Bug libc/12194] " drepper.fsp at gmail dot com
@ 2012-06-20  5:56 ` andersk at mit dot edu
  2012-06-20  7:20 ` aj at suse dot de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: andersk at mit dot edu @ 2012-06-20  5:56 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12194

Anders Kaseorg <andersk at mit dot edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andersk at mit dot edu

--- Comment #2 from Anders Kaseorg <andersk at mit dot edu> 2012-06-20 05:56:27 UTC ---
Shouldn’t the same change
(http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=69da074d7adfab7b57004a0dea9403a928e310a5)
be applied to sysdeps/s390/bits/byteswap.h and the generic bits/byteswap.h?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12194] htons() gives warning if compiled with gcc -Wconversion
  2010-11-05  7:03 [Bug libc/12194] New: htons() gives warning if compiled with gcc -Wconversion johan162 at gmail dot com
  2010-11-10  7:54 ` [Bug libc/12194] " drepper.fsp at gmail dot com
  2012-06-20  5:56 ` andersk at mit dot edu
@ 2012-06-20  7:20 ` aj at suse dot de
  2012-06-21 13:52 ` aj at suse dot de
  2014-06-30  6:30 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: aj at suse dot de @ 2012-06-20  7:20 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12194

Andreas Jaeger <aj at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |aj at suse dot de
         Resolution|FIXED                       |
         AssignedTo|drepper.fsp at gmail dot    |aj at suse dot de
                   |com                         |

--- Comment #3 from Andreas Jaeger <aj at suse dot de> 2012-06-20 07:19:45 UTC ---
thanks, patch send: http://sourceware.org/ml/libc-alpha/2012-06/msg00550.html

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12194] htons() gives warning if compiled with gcc -Wconversion
  2010-11-05  7:03 [Bug libc/12194] New: htons() gives warning if compiled with gcc -Wconversion johan162 at gmail dot com
                   ` (2 preceding siblings ...)
  2012-06-20  7:20 ` aj at suse dot de
@ 2012-06-21 13:52 ` aj at suse dot de
  2014-06-30  6:30 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: aj at suse dot de @ 2012-06-21 13:52 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12194

Andreas Jaeger <aj at suse dot de> changed:

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

--- Comment #4 from Andreas Jaeger <aj at suse dot de> 2012-06-21 13:52:12 UTC ---
Fixed for glibc 2.16 now with:

commit 2174c6dd8555f654c30df2f8f3321b69e0f736f8
Author: Andreas Jaeger <aj@suse.de>
Date:   Thu Jun 21 15:49:33 2012 +0200

    Avoid -Wconversion warning for htons

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/12194] htons() gives warning if compiled with gcc -Wconversion
  2010-11-05  7:03 [Bug libc/12194] New: htons() gives warning if compiled with gcc -Wconversion johan162 at gmail dot com
                   ` (3 preceding siblings ...)
  2012-06-21 13:52 ` aj at suse dot de
@ 2014-06-30  6:30 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2014-06-30  6:30 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=12194

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-06-30  6:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-05  7:03 [Bug libc/12194] New: htons() gives warning if compiled with gcc -Wconversion johan162 at gmail dot com
2010-11-10  7:54 ` [Bug libc/12194] " drepper.fsp at gmail dot com
2012-06-20  5:56 ` andersk at mit dot edu
2012-06-20  7:20 ` aj at suse dot de
2012-06-21 13:52 ` aj at suse dot de
2014-06-30  6:30 ` fweimer at redhat dot com

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).