[ https://issues.apache.org/activemq/browse/AMQCPP-25?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_37891 ]
Albert Strasheim commented on AMQCPP-25: ---------------------------------------- Re: your first question. As we tried to debug this issue, we added some printfs to check values of variables and we noticed that the bugs would go away. Basically, any bit of code that changes the way the compiler optimizes the function can make the bug disappear (but it's still a bug). char c = new char, delete c is just the smallest bit of code we could come up with that would make the bug disappear. As for how to fix this, I did some further reading. Check this page: http://www.cellperformance.com/mike_acton/2006/05/demystifying_the_restrict_keyw.html In the summary they say: "... Enable strict aliasing related warnings with -Wstrict-aliasing, but do not expect to be warned in all cases." Most of the GCC versions I've tried *don't* warn on the strict aliasing violations in the current AMQCPP code. If we want to leave strict aliasing enabled, we'll have to give the code a quick review and carefully look at any future changes for strict aliasing bugs, since the compiler won't necessarily warn us. The Python folks went for the opposite approach: any C module you build with distuils is compiled with -fno-strict-aliasing, as people were probably running into this problem frequently. If AMQCPP goes the -fno-strict-aliasing route, we'll still have to check that we don't leak code that requires this option outside of the library. Fortunately this is easy -- put function implementations in cpp files so that users don't compile bits of the library when compiling their code. Linking against a library is fine, regardless of its strict aliasing flags. Of course if you have any templated stuff, you should probably make sure to not write code that depends on strict aliasing flags. > Bus error on Solaris OS from DataInput and DataOutput streams > ------------------------------------------------------------- > > Key: AMQCPP-25 > URL: https://issues.apache.org/activemq/browse/AMQCPP-25 > Project: ActiveMQ C++ Client > Issue Type: Bug > Components: CMS Impl > Affects Versions: 1.1 > Environment: Solaris 10 OS > Reporter: Timothy Bish > Assigned To: Timothy Bish > Priority: Minor > Fix For: 1.1 > > Attachments: optobug.cpp > > > Due to misaligned memory reads, there is a bus error that can occur in using > the new DataInputStream and DataOutputStream classes. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira