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.
Created attachment 17581 [details] Testcase for optimizer bug
<arpa/inet.h> probably defines different versions of htons depending on optimisation level.
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...
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
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