Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Exception catch are being ignored on 11.1.076 on Mac 10.6.2

regis_vincent
Beginner
1,031 Views
I'm compiling the same code using 11.1.076 on Mac OS X 10.6.2 and I'm seeing two different behaviors if I compile with the debug flag on or off.

Debug mode on: -g-static-intel -openmp

Reading dataset: test.xml
Tag = Logger
Exception catching 1
Reading format 1.0

Debug mode off: -static-intel -openmp
Reading dataset: test.xml
Tag = Logger
terminate called after throwing an instance of 'kt::Exception'

The code does try to read an xml file in one format, if the initial tag is not the right one, it throws an exception that we catch and
try to read the file with another reader.


That code works perfectly fine in debug or optimized code in Windows(11.1.051) , Linux (11.1.064).
I have been trying to use the -fexceptions to turn the exception on but no luck.



0 Kudos
19 Replies
Quoc-An_L_Intel
Moderator
1,031 Views
1) Do you see the same behavior with gcc on Mac?
2) Can you provide some sample code that would demonstrate this behavior?
0 Kudos
Bradley_Lowekamp
Beginner
1,031 Views
Hello,

I am experiencing this error and problem with my software project. I spent a while trying to write a small section of code to reproduce the problem but I was not successful.

Were you able to resolve your problem?
0 Kudos
Bradley_Lowekamp
Beginner
1,031 Views
I have narrowed down this problem just a little. It occurs with -01 optimization levels and above, but does not happen with just -O0

Still unable to get a small test to reproduce this problem.
0 Kudos
Quoc-An_L_Intel
Moderator
1,031 Views
I have narrowed down this problem just a little. It occurs with -01 optimization levels and above, but does not happen with just -O0

Still unable to get a small test to reproduce this problem.

What happens when you remove -openmp?
0 Kudos
Bradley_Lowekamp
Beginner
1,031 Views
Quoting - Qale (Intel)

What happens when you remove -openmp?

Hello,

I suppose I have hi jacked this thread, as I am not the original poster. But I ran into the exact same problem, with the same version of OS and compiler, so I thought I shouldn't create a new thread on the same subject.

I just got this compiler yesterday, and went to build a toolkit I work on. With no real compiler flags set, the toolkit did not past all of it's tests due to exceptions being terminated as described above.

Unfortunately, I realize I made a mistake in my prior report. With the -O1 optimization, I get an ICE [ "(0): internal error: 0_0" ]. So I was using the old library built with -O2, for that test with out realizing it. I however did try to manual added the flags defined by -O1, after the -O0 option. But that produced some warnings about disabling optimization specified on the command line, however it did pass the tests.

And gcc has always worked fine with the toolkit.

I believe I last used a version 10 of the Intel compiler on a Linux system to build the toolkit with out problem as well.

Thanks,
Brad
0 Kudos
Bradley_Lowekamp
Beginner
1,031 Views
Wahoo! After much effort I have narrowed this bug down to the following little bit of code:


====== test1.cpp =====
#include "iostream"

void foo(void);

int main(int argc, char *argv[])
{
try
{
foo();
}
catch(...)
{
std::cout << "exception caught" << std::endl;
return EXIT_SUCCESS;
}
return EXIT_FAILURE;
}

====== test2.cpp =====


#include

struct C1
{
virtual void Throw(void) { throw std::exception(); }
};


struct C2
: public C1
{
C2() {}
};


void foo(void)
{
C2 c2;
C1& c1= c2;
c1.Throw();
}


And then it's built with:

icpc test.cpp test2.cpp -o test


icpc -V
Intel C++ Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20091012 Package ID: m_cproc_p_11.1.076
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.


Bug is reproducible on my system with the 32-bit compiler too.
g++4.0 and g++4.2 function fine with the test code, and real world code.

Do I need to do anything to report this bug?
Are there any work arounds besides using -O0?


Thanks,
Brad

0 Kudos
Quoc-An_L_Intel
Moderator
1,031 Views

Thanks, I was able to reproduce this problem. I will provide an update after my investigation. BTW, it seems that only compiling test2.cpp with ICC result in the problem. ICC does not have a problem with test1.cpp.
0 Kudos
Bradley_Lowekamp
Beginner
1,031 Views
Quoting - Qale (Intel)

Thanks, I was able to reproduce this problem. I will provide an update after my investigation. BTW, it seems that only compiling test2.cpp with ICC result in the problem. ICC does not have a problem with test1.cpp.

Do you know if this bug exists with older versions of the compiler?

I don't know how to access or download difference versions.

Thanks,
Brad
0 Kudos
Quoc-An_L_Intel
Moderator
1,031 Views

Do you know if this bug exists with older versions of the compiler?

I don't know how to access or download difference versions.

Thanks,
Brad

This problem only reproduced on Snow Leopard 10.6/Xcode combos. ICC 11.1058, 11.1.067, 11.1.076 all works with the test case in Leopard, but fails on Snow leopard.



0 Kudos
Quoc-An_L_Intel
Moderator
1,031 Views

As a work around for this problem, please try passing the option -no_compact_unwind to the linker. You can do it as follow:


icpc -Xlinker -no_compact_unwind
or
icpc -Wl,-no_compact_unwind
0 Kudos
Robert_Lupton
Beginner
1,031 Views

Hmm,

$ icpc --version
icpc (ICC) 11.1 20091130
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
$ icpc -o lib/libpex_exceptions.dylib -Wl,-no_compact_unwind -dynamiclib -Wl,-install_name -Wl,libpex_exceptions.dylib src/Exception.os -L/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config -Llib
ipo: warning #11015: Warning unknown option -no_compact_unwind

I'm seeing this problem; it's a killer on my os/x 10.2 box where I'm seeing gcc's problem with RTTI across dylibs with template classes. And now icpc is showing this one...

0 Kudos
troyer
Beginner
1,031 Views

This did not help.

0 Kudos
Quoc-An_L_Intel
Moderator
1,031 Views

For the problem with the test case thatwas reported in this thread, the work around did help. If the work around did not work for you, it might be a different issue.

If you can provide a case where the work around did not help, either here or through Premier support, we will look in to it.

0 Kudos
Robert_Lupton
Beginner
1,031 Views

You didn't address the issue I raised in #10, namely that the recommended switch doesn't exist on my machine. Do you have any insights into this, or should I raise it on premier support?

0 Kudos
Quoc-An_L_Intel
Moderator
1,031 Views

This option is only available with the linker that comes with Xcode 3.2.

$ ld -v

@(#)PROGRAM:ld PROJECT:ld64-95.2.12

0 Kudos
Robert_Lupton
Beginner
1,031 Views

I have xcode 3.2.1 installed;

$ /usr/bin/ld -v

@(#)PROGRAM:ld PROJECT:ld64-95.2.12

$ icpc --version
icpc (ICC) 11.1 20091130
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

ld accepts the -no_compact_unwind argument. However, trying to pass this through from ipcp fails as reported. Is there some magic option beyond than -Wl or -Xlinker?

icpc -o tests/statistics_noboost tests/statistics_noboost.o -L/u/lsst/products/DarwinX86/boost/1.40.0/lib -L/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config -L/u/lsst/products/DarwinX86/external/cfitsio/3006.2/lib -L/u/lsst/products/DarwinX86/external/wcslib/4.4.4/lib -L/u/lsst/products/DarwinX86/external/xpa/2.1.7b2/lib -L/u/lsst/products/DarwinX86/external/minuit2/5.22.00+1/lib -L/u/lsst/products/DarwinX86/external/gsl/1.8/lib -L/Users/rhl/LSST/pex/exceptions/lib -L/u/lsst/products/DarwinX86/utils/3.4.3/lib -L/Users/rhl/LSST/daf/base/lib -L/u/lsst/products/DarwinX86/pex_logging/3.3.4/lib -L/u/lsst/products/DarwinX86/security/3.2.2/lib -L/u/lsst/products/DarwinX86/pex_policy/3.4.1/lib -L/Users/rhl/LSST/daf/persistence/lib -L/Users/rhl/LSST/daf/data/lib -L/u/lsst/products/DarwinX86/external/fftw/3.1.2+1/lib -Llib -lafw -lboost_system -lboost_filesystem -lboost_regex -lboost_serialization -lboost_unit_test_framework -lwcs -lcfitsio -lMinuit2 -lgslcblas -lgsl -lutils -ldaf_base -ldaf_data -ldaf_persistence -lpex_exceptions -lpex_logging -lpex_policy -lsecurity -lfftw3 -Wl,-no_compact_unwind
ipo: warning #11015: Warning unknown option -no_compact_unwind

R

0 Kudos
Robert_Lupton
Beginner
1,031 Views

The answer is that this warning message is just a warning, and ld does get the option (check with -v). So I'm using

-Wl,-no_compact_unwind -wd,11015

to get the code working without warnings. Intel expect to remove the warning in some future release.

0 Kudos
Quoc-An_L_Intel
Moderator
1,031 Views

The warning is because the icpc driver does not recognize the new linker option -no_compact_unwind. If you run the following command, you will see the icpc driver ispassing a set of options to the compiler "mcpcom" and the linker "ld". The -no_compact_unwind option is included under the "ld" section.

$ icpc -v -Wl,-no_compact_unwind main.cpp

Version 11.1

/opt/intel/Compiler/11.1/080/bin/intel64/mcpcom -_g -mP3OPT_inline_alloca -D__HONOR_STD -D__ICC=1110 -D__INTEL_COMPILER=1110 -D_MT "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__INTEL_COMPILER_BUILD_DATE=20091130 -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__PIC__ -D__LONG_MAX__=9223372036854775807L -D__APPLE__ -D__MACH__ -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__GNUG__=4 -D__GNUC__=4 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=1 -D__NO_INLINE__ -D__APPLE_CC__=5646 -D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1060 -D__LITTLE_ENDIAN__ -D__DYNAMIC__ -D__private_extern__=extern -D__pentium4 -D__pentium4__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__tune_pentium4__ -D__MMX__ -D__SSE__ -D__LP64__ -D_LP64 -D_GNU_SOURCE=1 -D__DEPRECATED=1 -D__GXX_WEAK__=1 -D__GXX_ABI_VERSION=1002 -D__USER_LABEL_PREFIX__=_ -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__EXCEPTIONS=1 -D__x86_64 -D__x86_64__ -_k -_8 -_l -_D -_a -_b --gnu_version=421 -_W5 --gcc-extern-inline -p --bool -tused -mGLOB_eh_linux -x --mspp --multibyte_chars --bool -mP1OPT_version=11.1-intel64 -mGLOB_diag_file=/tmp/icpcwjwURN.diag -mGLOB_diag_use_message_catalog=FALSE -mP1OPT_print_version=FALSE -mP3OPT_use_mspp_call_convention -mCG_use_gas_got_workaround=F -mP2OPT_align_option_used=TRUE "-mGLOB_options_string=-v -Wl,-no_compact_unwind" -mGLOB_position_independent_code -mGLOB_preemption_model=1 -mGLOB_cxx_limited_range=FALSE -mGLOB_as_output_backup_file_name=/tmp/icpcT8XVa3as_.s -mIPOPT_activate -mIPOPT_lite -mGLOB_machine_model=GLOB_MACHINE_MODEL_EFI2 -mGLOB_extended_instructions=0x80 -mGLOB_advanced_optim=TRUE -mIPOPT_args_in_regs=0 -mPGOPTI_value_profile_use=T -mP2OPT_hlo_level=2 -mP2OPT_hlo -mIPOPT_obj_output_file_name=/tmp/icpcwjwURN.o -mGLOB_os_target=GLOB_OS_TARGET_MACH -mGLOB_obj_output_file=/tmp/icpcwjwURN.o -mGLOB_source_dialect=GLOB_SOURCE_DIALECT_C_PLUS_PLUS -mP1OPT_source_file_name=main.cpp main.cpp

#include "..." search starts here:

#include <...> search starts here:

/opt/intel/Compiler/11.1/080/include/intel64

/usr/include/c++/4.2.1

/usr/include/c++/4.2.1/i686-apple-darwin10

/usr/include/c++/4.2.1/backward

/opt/intel/Compiler/11.1/080/include/intel64

/opt/intel/Compiler/11.1/080/include

/opt/intel/Compiler/11.1/080/Frameworks

/System/Library/Frameworks

/Library/Frameworks

/usr/include

/usr/lib/gcc/i686-apple-darwin10/4.2.1/include

End of search list.

ld -lcrt1.10.5.o -dynamic -arch x86_64 -weak_reference_mismatches non-weak -o a.out -no_compact_unwind /tmp/icpcwjwURN.o -L/opt/intel/Compiler/11.1/080/lib -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64/ -L/usr/lib/i686-apple-darwin10/4.2.1/ -L/usr/lib/ -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/ -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1/ -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /opt/intel/Compiler/11.1/080/lib/libimf.a /opt/intel/Compiler/11.1/080/lib/libsvml.a /opt/intel/Compiler/11.1/080/lib/libipgo.a /opt/intel/Compiler/11.1/080/lib/libdecimal.a -lstdc++ -lgcc_s.10.5 -lgcc -lSystemStubs -lmx -lSystem /opt/intel/Compiler/11.1/080/lib/libirc.a -ldl

0 Kudos
Quoc-An_L_Intel
Moderator
1,031 Views
This issue is resolved in the latest version 11.1 update 5. The download file is m_cproc_p_11.1.084.dmg.
0 Kudos
Reply