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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.6 Regression] [OOP] tree |[OOP] tree check: expected
                   |check: expected             |function_type or
                   |function_type or            |method_type, have
                   |method_type, have           |pointer_type
                   |pointer_type                |

--- Comment #9 from janus at gcc dot gnu.org 2011-01-05 09:33:56 UTC ---
(In reply to comment #1)
> -fdump-tree-original shows wrong code being generated:
> 
> 
>       struct class$integrable_model_a <T3f8> (struct class$integrable_model &
> restrict) D.1529;
>       static real(kind=4) C.1528 = 2.0e+0;
>       struct class$integrable_model_a D.1527;
> 
>       D.1527 = d_dt ((struct class$integrable_model *) model);
>       D.1529 = d_dt (&D.1527, &C.1528);
>       _gfortran_transfer_real_write (&dt_parm.0, &D.1529, 4);
> 
> 
> The second call to "d_dt" should actually be a call to
> "D.1527->$vptr->multiply".

Note that 4.5 also produces wrong code here:

      real(kind=4) D.1560;
      static real(kind=4) C.1559 = 2.0e+0;
      struct .class.integrable_model.a D.1558;

      D.1558 = d_dt ((struct .class.integrable_model *) model);
      D.1560 = multiply (&D.1558, &C.1559);
      _gfortran_transfer_real (&dt_parm.0, &D.1560, 4);

It has a static call to 'multiply', instead of a polymorphic call via the vptr.
So, since 4.5 also does not handle the test case correctly, I think it's fair
to remove the "regression" tag.

In a way one could even argue that the ICE in 4.6 is an improvement over 4.5
silently giving wrong results for such cases, since the user does at least get
*some* error message (even though a crude and uninformative one), instead of
assuming the feature was supported and getting wrong results in the end!

Reply via email to