public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12511] New: When building with -O2 getsockname may fail
@ 2003-10-04 23:22 john dot phelps at solipsys dot com
2003-10-04 23:38 ` [Bug c++/12511] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: john dot phelps at solipsys dot com @ 2003-10-04 23:22 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
Summary: When building with -O2 getsockname may fail
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: john dot phelps at solipsys dot com
CC: gcc-bugs at gcc dot gnu dot org
For some odd reason using the htons function causes the getsockname call to
fail under RedHat 9. A code snippet is included. The mere presence of the
htons call for the sockaddr_in.port member causes the problem with getsockname
to occur. Compiling with -O0 will allow things to function properly.
Not sure if this is HTMLized...
<pre>
# include <byteswap.h>
# include <errno.h>
# include <sys/socket.h>
# include <netinet/in.h>
#include <iostream>
// Compile with: g++ -O2 testGetsockname.C -o testGetsockname
//
// Set FIX_THE_PROBLEM to 1 in order to make things work.
//
# define FIX_THE_PROBLEM 0
//-------------------------------------------------------------------------
//
int
main()
{
# if FIX_THE_PROBLEM
if( false )
{
u_short junk = htons( 1234 );
}
# endif
// Create a socket to work with.
//
int sd = socket( AF_INET, SOCK_DGRAM, 0 );
// Create a sockaddr structure to work with.
//
struct sockaddr saddr;
socklen_t slen;
// The getsockname call will fail if htons is used with the sockaddr_in
// struture below. Note that the mere presence of the htons invocation
// will cause the getsockname call to fail.
//
if( getsockname( sd, &saddr, &slen ) < 0 )
{
std::cerr << "getsockname failed: " << errno << std::endl;
return(-1);
}
else
{
std::cerr << "getsockname SUCCESS" << std::endl;
}
// Create a sockaddr_in to cause the issue.
//
struct sockaddr_in sin;
sin.sin_family = AF_INET;
sin.sin_port = htons( 8000 ); // This is the problem line?
sin.sin_addr.s_addr = htonl( INADDR_ANY );
std::cerr << "sin.sin_port = " << sin.sin_port << std::endl;
return(0);
}
</pre>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12511] When building with -O2 getsockname may fail
2003-10-04 23:22 [Bug c++/12511] New: When building with -O2 getsockname may fail john dot phelps at solipsys dot com
@ 2003-10-04 23:38 ` pinskia at gcc dot gnu dot org
2003-10-06 12:46 ` john dot phelps at solipsys dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-04 23:38 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-04 23:37 -------
I can reproduce this under 3.3.1 (20030707) but it is fixed for 3.4 but this might be a glibc
problem though.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12511] When building with -O2 getsockname may fail
2003-10-04 23:22 [Bug c++/12511] New: When building with -O2 getsockname may fail john dot phelps at solipsys dot com
2003-10-04 23:38 ` [Bug c++/12511] " pinskia at gcc dot gnu dot org
@ 2003-10-06 12:46 ` john dot phelps at solipsys dot com
2003-12-15 22:18 ` dhazeghi at yahoo dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: john dot phelps at solipsys dot com @ 2003-10-06 12:46 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
------- Additional Comments From john dot phelps at solipsys dot com 2003-10-06 12:46 -------
Subject: RE: When building with -O2 getsockname may fail
A coworker pointed out to me that the problem was seen w/gcc 3.3, not 3.3.1,
because of build/install issues with 3.3.1 under RedHat 9. In any case, will
there be, or is that currently, a patch released for 3.3.x to fix the
problem? We have just recently switched over to using 3.3.1 and would like
to stay on track with this version for awhile.
Alternatively, is there a good reason to switch over to 3.4 as opposed to
sticking with 3.3.1? We have been using 2.95.3 for years now and had to drag
people kicking and screaming into the 3.3 release. I would like to stick
with this version unless there is a compelling reason not to do so.
Thanks.
--
John Phelps http://www.solipsys.com
Solipsys Corporation mailto:john.phelps@solipsys.com
-----Original Message-----
From: pinskia at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org]
Sent: Saturday, October 04, 2003 7:38 PM
To: john.phelps@solipsys.com
Subject: [Bug c++/12511] When building with -O2 getsockname may fail
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-04
23:37 -------
I can reproduce this under 3.3.1 (20030707) but it is fixed for 3.4 but this
might be a glibc
problem though.
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12511] When building with -O2 getsockname may fail
2003-10-04 23:22 [Bug c++/12511] New: When building with -O2 getsockname may fail john dot phelps at solipsys dot com
2003-10-04 23:38 ` [Bug c++/12511] " pinskia at gcc dot gnu dot org
2003-10-06 12:46 ` john dot phelps at solipsys dot com
@ 2003-12-15 22:18 ` dhazeghi at yahoo dot com
2004-02-06 1:31 ` [Bug c++/12511] [3.3 Regression] " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-15 22:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2003-12-15 22:18 -------
Another datapoint: works on 3.0.4 but fails on 3.2.3. This is with -O1 (as well as -O2). If I have
time, I'll try to narrow down where it started failing...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12511] [3.3 Regression] When building with -O2 getsockname may fail
2003-10-04 23:22 [Bug c++/12511] New: When building with -O2 getsockname may fail john dot phelps at solipsys dot com
` (2 preceding siblings ...)
2003-12-15 22:18 ` dhazeghi at yahoo dot com
@ 2004-02-06 1:31 ` pinskia at gcc dot gnu dot org
2004-02-15 12:35 ` gdr at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-06 1:31 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Known to fail| |3.2.3
Known to work| |3.4.0 3.5.0 3.0.4
Summary|When building with -O2 |[3.3 Regression] When
|getsockname may fail |building with -O2
| |getsockname may fail
Target Milestone|--- |3.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/12511] [3.3 Regression] When building with -O2 getsockname may fail
2003-10-04 23:22 [Bug c++/12511] New: When building with -O2 getsockname may fail john dot phelps at solipsys dot com
` (3 preceding siblings ...)
2004-02-06 1:31 ` [Bug c++/12511] [3.3 Regression] " pinskia at gcc dot gnu dot org
@ 2004-02-15 12:35 ` gdr at gcc dot gnu dot org
2004-03-10 12:21 ` [Bug optimization/12511] " giovannibajo at libero dot it
2004-04-18 17:29 ` gdr at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-02-15 12:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-02-15 12:35 -------
Adjust milestone
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.3.3 |3.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12511] [3.3 Regression] When building with -O2 getsockname may fail
2003-10-04 23:22 [Bug c++/12511] New: When building with -O2 getsockname may fail john dot phelps at solipsys dot com
` (4 preceding siblings ...)
2004-02-15 12:35 ` gdr at gcc dot gnu dot org
@ 2004-03-10 12:21 ` giovannibajo at libero dot it
2004-04-18 17:29 ` gdr at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-03-10 12:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-03-10 12:21 -------
This is confirmed by Dara and Andrew, but might be a glibc bug. Anyway, it
doesn't belong to the c++ component. Recategorizing it.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|c++ |optimization
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-03-10 12:21:44
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/12511] [3.3 Regression] When building with -O2 getsockname may fail
2003-10-04 23:22 [Bug c++/12511] New: When building with -O2 getsockname may fail john dot phelps at solipsys dot com
` (5 preceding siblings ...)
2004-03-10 12:21 ` [Bug optimization/12511] " giovannibajo at libero dot it
@ 2004-04-18 17:29 ` gdr at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-04-18 17:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-04-18 17:16 -------
Fixed in 3.4.0. Won't be fixed in 3.3.x
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|3.3.4 |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12511
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-04-18 17:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-04 23:22 [Bug c++/12511] New: When building with -O2 getsockname may fail john dot phelps at solipsys dot com
2003-10-04 23:38 ` [Bug c++/12511] " pinskia at gcc dot gnu dot org
2003-10-06 12:46 ` john dot phelps at solipsys dot com
2003-12-15 22:18 ` dhazeghi at yahoo dot com
2004-02-06 1:31 ` [Bug c++/12511] [3.3 Regression] " pinskia at gcc dot gnu dot org
2004-02-15 12:35 ` gdr at gcc dot gnu dot org
2004-03-10 12:21 ` [Bug optimization/12511] " giovannibajo at libero dot it
2004-04-18 17:29 ` gdr at gcc dot gnu dot org
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).