Summary: | Return type of index operator for sequences of object references is incorrect | ||
---|---|---|---|
Product: | TAO | Reporter: | Matthew Waller <matthewrwaller> |
Component: | IDL Compiler | Assignee: | DOC Center Support List (internal) <tao-support> |
Status: | NEW --- | ||
Severity: | normal | CC: | mitza |
Priority: | P5 | ||
Version: | 1.8.3 | ||
Hardware: | All | ||
OS: | Windows XP | ||
Attachments: |
Test program which highlights issue
IDL for test program |
Created attachment 1344 [details]
IDL for test program
I've hit this same issue. Works fine in TAO 1.4a so the 1.5.x sequence re-write looks to be the source of the regression. I have a minimal test case that I will commit shortly. Per private email, Johnny is going to look at this one when he has time. pool |
Created attachment 1343 [details] Test program which highlights issue After porting from a previous version of TAO to this version of TAO (1.8.3) I encountered access violations in instances where I was assinging an object reference to an A_var type from a sequence. This is due to the generated code returning a pointer from the indexing operator. I've been looking at the CORBA C++ mapping spec (v1.2) with respect to the semantics of the return type of the indexing operator of sequences of object references, especially when used as a r-value. I think the relevant points in are "4.15 Mapping for Sequence Types" on page 38 where it states: "For strings, wide strings, and object references, operator[] for a sequence must return a type with the same semantics as the types used for string, wide string, and object reference members of structs and arrays …" Looking at section "4.12 Mapping for Struct Types", on page 27 it states: "Assignment between a string, wide string, or object reference member and a corresponding T_var type (String_var, WString_var, or A_var) always results in copying the data..." Putting these two statements together suggests that the following: MyInterface_var myInterface = mySequenceOfMyInterface[0]; should result in myInterface having a copy of the sequence element rather than owning it's pointer. Additionally, the spec states that the indexing operator for object references should have the same semantics as struct members. I think there's a fair case to be made that TAO isn't complying with the standard as far as the sequence indexing operator is concerned. I have attached a small bit of code which highlights this issue.