Hello,
the example SwapValuation.cpp and all the zero curve generation don't work on Unix Sun Solaris 2.8. We found where the problem comes from and this is a fix proposal: in dir: $QuatLib/ql/Indexes/xibormanager.cpp the variable XiborManager::HistoryMap XiborManager::historyMap_; are never explicitely initialized. To solve this problem: in xibormanager.cpp remove the row // XiborManager::HistoryMap XiborManager::historyMap_; and replace QL_REQUIRE(i != historyMap_.end(), name + " history not loaded"); by if (i != historyMap_.end()) throw Error(name + " history not loaded"); in xibormanager.hpp we add #ifdef quantlib_global_define XiborManager::HistoryMap XiborManager::historyMap_ = XiborManager::HistoryMap(); #endif in xibor.cpp we add # define quantlib_global_define enclosed to this email the files changed. Could you please integrate this fix? Thanks Xavier (See attached file: xibormanager.cpp)(See attached file: xibormanager.hpp) (See attached file: xibor.cpp) ************************************************************************* Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. La Fimat et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. ******** This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither Fimat nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. ************************************************************************* xibormanager.cpp (2K) Download Attachment xibormanager.hpp (2K) Download Attachment xibor.cpp (4K) Download Attachment |
At 11:14 AM 9/24/02 +0200, [hidden email] wrote:
>Hello, >the example SwapValuation.cpp and all the zero curve generation don't work >on Unix Sun Solaris 2.8. >We found where the problem comes from and this is a fix proposal: Xavier, thanks a lot. I've been puzzled by this for quite a while. A few questions though: >replace >QL_REQUIRE(i != historyMap_.end(), > name + " history not loaded"); >by >if (i != historyMap_.end()) > throw Error(name + " history not loaded"); the if clause would be (i==historyMap_.end()) or (!(i!=historyMap_.end())), right? Also, did you have problems with leaving QL_REQUIRE (which expands to an if with the latter clause?) >in xibormanager.hpp we add >#ifdef quantlib_global_define > XiborManager::HistoryMap XiborManager::historyMap_ = >XiborManager::HistoryMap(); >#endif > >in xibor.cpp we add ># define quantlib_global_define I'm not entirely getting the conditional compilation thing. Wouldn't it be the same if we simply wrote XiborManager::HistoryMap XiborManager::historyMap_ = XiborManager::HistoryMap(); in xibormanager.cpp? The same goes for the other fix in europeanoption.cpp (especially since if europeanoption.cpp happened to include indirectly xibormanager.hpp, or the other way around, historyMap_ would be multiply defined.) Later, Luigi |
In reply to this post by Xavier.Abulker
Hi Luigi,
1) to avoid the crash I have to do the following change: either if (i != historyMap_.end()) throw Error(name + " history not loaded"); or QL_REQUIRE(i == historyMap_.end(), name + " history not loaded"); otherwise it doesn't work. 2) I agree with your second guess theoretically but I've tried just to add XiborManager::HistoryMap XiborManager::historyMap_ = XiborManager::HistoryMap(); and either gcc or c++ doesn't accept that. With my fix it works fine with EuropeanOption and Zero curve generation. Do you think it could be intergrated in CVS? Thanks Xavier Luigi Ballabio <luigi.ballabio@fast To: [hidden email], webnet.it> [hidden email] cc: 24/09/2002 12:33 Subject: Re: [Quantlib-users] bug in xibor.. At 11:14 AM 9/24/02 +0200, [hidden email] wrote: >Hello, >the example SwapValuation.cpp and all the zero curve generation don't work >on Unix Sun Solaris 2.8. >We found where the problem comes from and this is a fix proposal: Xavier, thanks a lot. I've been puzzled by this for quite a while. A few questions though: >replace >QL_REQUIRE(i != historyMap_.end(), > name + " history not loaded"); >by >if (i != historyMap_.end()) > throw Error(name + " history not loaded"); the if clause would be (i==historyMap_.end()) or (!(i!=historyMap_.end())), right? Also, did you have problems with leaving QL_REQUIRE (which expands to an if with the latter clause?) >in xibormanager.hpp we add >#ifdef quantlib_global_define > XiborManager::HistoryMap XiborManager::historyMap_ = >XiborManager::HistoryMap(); >#endif > >in xibor.cpp we add ># define quantlib_global_define I'm not entirely getting the conditional compilation thing. Wouldn't it be the same if we simply wrote XiborManager::HistoryMap XiborManager::historyMap_ = XiborManager::HistoryMap(); in xibormanager.cpp? The same goes for the other fix in europeanoption.cpp (especially since if europeanoption.cpp happened to include indirectly xibormanager.hpp, or the other way around, historyMap_ would be multiply defined.) Later, Luigi ************************************************************************* Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. La Fimat et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. ******** This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither Fimat nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. ************************************************************************* |
Hi,
At 09:42 AM 9/25/02 +0200, [hidden email] wrote: >1) to avoid the crash I have to do the following change: >either >if (i != historyMap_.end()) > throw Error(name + " history not loaded"); >or >QL_REQUIRE(i == historyMap_.end(), > name + " history not loaded"); >otherwise it doesn't work. But the above is reversing the logic of the test! i != historyMap_.end() means that the history was found---and that is what we're requiring. What happens if you use the original test? Do you get a segfault, or an exception? >2) I agree with your second guess theoretically but I've tried just to add >XiborManager::HistoryMap XiborManager::historyMap_ = > XiborManager::HistoryMap(); and either gcc or c++ doesn't accept that. Hmm. It looks like legal C++ to me. What does gcc say? >With my fix it works fine with EuropeanOption and Zero curve generation. >Do you think it could be intergrated in CVS? Yes, at the very least I can try and include it in an #ifdef block. Do you know if there are any #defines I can check in order to detect whether I'm on solaris? Thanks, Luigi |
On Wed, Sep 25, 2002 at 10:23:29AM +0200, Luigi Ballabio wrote:
> > Hi, > > At 09:42 AM 9/25/02 +0200, [hidden email] wrote: > >1) to avoid the crash I have to do the following change: > >either > >if (i != historyMap_.end()) > > throw Error(name + " history not loaded"); > >or > >QL_REQUIRE(i == historyMap_.end(), > > name + " history not loaded"); > >otherwise it doesn't work. > > But the above is reversing the logic of the test! > i != historyMap_.end() means that the history was found---and that is what > we're requiring. What happens if you use the original test? Do you get a > segfault, or an exception? > > > >2) I agree with your second guess theoretically but I've tried just to add > >XiborManager::HistoryMap XiborManager::historyMap_ = > > XiborManager::HistoryMap(); and either gcc or c++ doesn't accept that. > > Hmm. It looks like legal C++ to me. What does gcc say? > > > >With my fix it works fine with EuropeanOption and Zero curve generation. > >Do you think it could be intergrated in CVS? > > Yes, at the very least I can try and include it in an #ifdef block. > Do you know if there are any #defines I can check in order to detect > whether I'm on solaris? isn't a test for compiler and compiler version more appropriate? such sure exist for gcc, I can't remember them right now. -- ---------------------------------------------------------------------------. Patrik Sundberg Address: Rydsvägen 100C, 584 31 Linköping, Sweden | Email: [hidden email] || [hidden email] | Phone: +46 13 178567 || +46 707 602240 | .---> Applied Physics and Electrical Engineering student | |-----> Master of Science in Business Administration and Economics student | |-------> UNIX/Programming consultant | `--------------------------------------------------------------------------' |
At 12:25 PM 9/25/02 +0200, Patrik Sundberg wrote:
>On Wed, Sep 25, 2002 at 10:23:29AM +0200, Luigi Ballabio wrote: > > Yes, at the very least I can try and include it in an #ifdef block. > > Do you know if there are any #defines I can check in order to detect > > whether I'm on solaris? > >isn't a test for compiler and compiler version more appropriate? such sure >exist for gcc, I can't remember them right now. Patrik, maybe I'm misunderstading you, but I'd prefer to detect gcc on solaris, not merely gcc. The library works as it should when compiled with gcc (2.95.x, 3.0.x, amd 3.1.x) on Linux. I'd rather restrict the workaround to the specific platforms for which it is needed. Bye, Luigi |
On Wed, Sep 25, 2002 at 12:49:09PM +0200, Luigi Ballabio wrote:
> At 12:25 PM 9/25/02 +0200, Patrik Sundberg wrote: > >On Wed, Sep 25, 2002 at 10:23:29AM +0200, Luigi Ballabio wrote: > >> Yes, at the very least I can try and include it in an #ifdef block. > >> Do you know if there are any #defines I can check in order to detect > >> whether I'm on solaris? > > > >isn't a test for compiler and compiler version more appropriate? such sure > >exist for gcc, I can't remember them right now. > > Patrik, > maybe I'm misunderstading you, but I'd prefer to detect gcc on > solaris, not merely gcc. The library works as it should when compiled with > gcc (2.95.x, 3.0.x, amd 3.1.x) on Linux. I'd rather restrict the workaround > to the specific platforms for which it is needed. my bad - I didn't read the whole thread properly and got the impression it was a gcc issue and not gcc+solaris. solaris surely has defines - I think you can use #ifdef SOLARIS or #ifdef SUNOS hope you resolv this issue! -- ---------------------------------------------------------------------------. Patrik Sundberg Address: Rydsvägen 100C, 584 31 Linköping, Sweden | Email: [hidden email] || [hidden email] | Phone: +46 13 178567 || +46 707 602240 | .---> Applied Physics and Electrical Engineering student | |-----> Master of Science in Business Administration and Economics student | |-------> UNIX/Programming consultant | `--------------------------------------------------------------------------' |
Free forum by Nabble | Edit this page |