[csw-users] 64bit g++ 4.7.2 exception handling ...

Edward Maros emaros at ligo.caltech.edu
Wed Feb 13 23:06:08 CET 2013


I have a very simple piece of code that behaves differently depending if
it is compiled 32bit vs 64bit. Is this an issue with the compiler or how
it was packaged?

#include
<stdexcept>                                                                            


int                                                                                             

main( int, char**
)                                                                             

{                                                                                               

  try
{                                                                                         

    throw std::runtime_error( "Catch me if you can!"
);                                         
  } catch(...)
{                                                                                

    return
0;                                                                                   

 
}                                                                                             

  return
1;                                                                                     

}          

When compiled and executed using "g++ t.cc", the return status is 0

When compiled and executed using "g++ -m64 t.cc", the return status is,

terrminate called after throwing an instance of 'std::runtime_error'
terminate called recursively
Abort (core dumped)

-bash-3.2$ uname -a
SunOS x4270-qfs 5.10 Generic_147441-27 i86pc i386 i86pc
-bash-3.2$ g++ --version
g++ (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-bash-3.2$ which g++
/opt/csw/bin/g++

Thanks,
Ed


More information about the users mailing list