[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#456930: g++-4.3: Integer variable value lost due to optimizations?



Package: g++-4.3
Version: 4.3-20071130-1
Severity: normal

Hi,

I've got the following code to constructor an acceptor:
server::server(asio::io_service& io_service, request_handler& req_handler, int fcgi_port):
	acceptor_(io_service, asio::ip::tcp::endpoint(asio::ip::tcp::v4(), fcgi_port)),
	io_service_(io_service),
	new_connection_(new connection(io_service, *this)),
	request_handler_(req_handler)
{
#ifdef TCP_DEFER_ACCEPT
	int v = true;
	setsockopt(acceptor_.native(), IPPROTO_TCP, TCP_DEFER_ACCEPT, &v, sizeof(v));
#endif
	acceptor_.async_accept(new_connection_->socket(), boost::bind(&server::handle_accept, this, asio::placeholders::error));
}

With CMAKE_BUILD_TYPE release, bind is called with port = 0

bind(8, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0

although I'm quite sure it should be 2711.
Without CMAKE_BUILD_TYPE release, the code works fine.

I can't guarantee this is a bug in g++ though.
I'll try to reproduce this with less code.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.23-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.3 depends on:
ii  gcc-4.3                   4.3-20071130-1 The GNU C compiler
ii  gcc-4.3-base              4.3-20071130-1 The GNU Compiler Collection (base 
ii  libc6                     2.7-4          GNU C Library: Shared libraries
ii  libgmp3c2                 2:4.2.2+dfsg-1 Multiprecision arithmetic library
ii  libmpfr1ldbl              2.3.0.dfsg.1-2 multiple precision floating-point 
ii  libstdc++6-4.3-dev        4.3-20071130-1 The GNU Standard C++ Library v3 (d

g++-4.3 recommends no packages.

-- no debconf information



Reply to: