Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bug with switch statements and iterator reference

User_GB9G3Oct 12 2020

devstudio-test.tar.gz (391 Bytes)I believe I have found a bug in the Developer Studio 12.6 compiler. I've included a tar file which contains the file that triggers the bug (bad.cxx) and a workaround (good.cxx). Basically, if you try to reference-iterate over a vector inside a switch statement, the created reference is invalid, resulting in a segfault. bad.cxx demonstrates this. Iterating inside an if statement instead does not trigger the bug. good.cxx demonstrates this. I was able to reproduce this on Solaris 11 on both SPARC and x86. I did not try it on Linux.

Comments

Post Details

Added on Oct 12 2020
0 comments
160 views