BUG: gcc optimizer

strk strk at keybit.net
Mon Mar 30 21:43:34 UTC 2009


g++ (Ubuntu 4.3.2-2ubuntu11) 4.3.3 20090111 (prerelease)

  // Check what you get to tell SUCCESS/FAILURE:
  //
  //  SUCCESS: g++ test.cpp
  //   invalid cast from type 'uint16_t' to type 'uint16_t'
  //
  //  FAILURE: g++ -O2 test.cpp
  //   invalid cast from type 'unsigned int' to type 'uint16_t'
  //                           ^^^^^^^^^^^^ from htons ??
  //
  
  #include <arpa/inet.h> // for htons
  
  void
  test(uint16_t version)
  {
      version = reinterpret_cast<uint16_t>(htons(version));
  }

--strk; 

 Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
 http://foo.keybit.net/~strk/services.html  /\  Keep it simple! 




More information about the Ubuntu-devel-discuss mailing list