http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53876



Paul Thomas <pault at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |pault at gcc dot gnu.org

         AssignedTo|unassigned at gcc dot       |pault at gcc dot gnu.org

                   |gnu.org                     |



--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> 2012-12-15 16:27:12 
UTC ---

Tobias,



Your analysis is completely correct.



> 

>   /* Set the data.  */

>   ctree = gfc_class_data_get (var);



Inserting

      parmse->expr = fold_convert (TREE_TYPE (ctree), parmse->expr);



before this line fixes the problem.

>   gfc_add_modify (&parmse->pre, ctree, parmse->expr);

> 

> 

....snip...



> The problem is that the LHS and the RHS have a different type. Both are

> pointers to a record_type, which contains "genes" (type "array1_real(kind=4)")

> as component.

> 

> However, the decl for both the record type and the "genes" type is different

> (only their respective canonical type is the same).



which is why the above works.



> I wonder whether it has something to do with restricted and not. (See also PR

> 45586). Though, as marking all variables as TARGET doesn't help, I might also

> be off track.



I will try to understand why the regression occurred.  However, the above fix

is perfectly OK.



The testcase of comment 2 works with the above.  The original needs a call to

the constructor before the assignment in the main program to avoid the runtime

fault.



After I have got the unlimited polymorphic patch out of the way, I will submit

this fix (my tree is too poluted right no :-) )



Cheers



Paul

Reply via email to