Bug 39623 - Optimizer changes return from htons(uint16)
Summary: Optimizer changes return from htons(uint16)
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-03 08:57 UTC by Sandro Santilli
Modified: 2009-04-03 09:27 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Testcase for optimizer bug (219 bytes, text/plain)
2009-04-03 09:01 UTC, Sandro Santilli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sandro Santilli 2009-04-03 08:57:40 UTC
The bug is known to occur with the following versions:
 - gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)
 - g++ (Ubuntu 4.3.2-2ubuntu11) 4.3.3 20090111 (prerelease) 

The symptom of the bug is that when you use -O2 htons(short) returns
'unsigned int' (32 bit) rather then the expected 16bit value.
With no optimization it returns the correct 16bit.

I'll attach a testcase.
Comment 1 Sandro Santilli 2009-04-03 09:01:51 UTC
Created attachment 17581 [details]
Testcase for optimizer bug
Comment 2 Andreas Schwab 2009-04-03 09:22:52 UTC
<arpa/inet.h> probably defines different versions of htons depending on optimisation level.
Comment 3 Sandro Santilli 2009-04-03 09:27:24 UTC
You mean I should file a bug against libc ? Or that it's a non-bug ?
The htons() manual page states it'd return a short...
Comment 4 Steve Ellcey 2009-04-22 15:53:29 UTC
Subject: Bug 39623

Author: sje
Date: Wed Apr 22 15:53:05 2009
New Revision: 146593

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146593
Log:
	PR testsuite/39623
	* gcc.dg/vect/no-vfa-vect-43.c Fix vect_no_align check.
	

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c

Comment 5 Steve Ellcey 2009-04-23 15:37:10 UTC
Subject: Bug 39623

Author: sje
Date: Thu Apr 23 15:36:48 2009
New Revision: 146650

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146650
Log:
	PR testsuite/39623
	* gcc.dg/vect/no-vfa-vect-57.c: XFAIL when vect_no_align.
	* gcc.dg/vect/no-vfa-vect-61.c: Ditto.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c
    trunk/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c