[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument

2007-03-24 Thread patchapp at dberlin dot org


--- Comment #5 from patchapp at dberlin dot org  2007-03-24 08:10 ---
Subject: Bug number PR31200

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg01595.html


-- 


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



[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument

2007-03-24 Thread pault at gcc dot gnu dot org


--- Comment #6 from pault at gcc dot gnu dot org  2007-03-24 12:31 ---
Subject: Bug 31200

Author: pault
Date: Sat Mar 24 12:30:58 2007
New Revision: 123183

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=123183
Log:
2007-03-24  Paul Thomas  [EMAIL PROTECTED]

PR fortran/31215
* trans-expr.c (gfc_apply_interface_mapping_to_expr): Return
int result that is non-zero if the expression is the function
result.  Only the characteristics of the result expression
can be used in a procedure interface, so simplify LEN in situ
using its character length.

PR fortran/31219
PR fortran/31200
* trans-expr.c (gfc_conv_function_call): Do not use
gfc_conv_expr_reference for actual pointer function with formal
target because a temporary is created that does not transfer
the reference correctly.  Do not indirect formal pointer
functions since it is the function reference that is needed.

2007-03-24  Paul Thomas  [EMAIL PROTECTED]

PR fortran/31219
* gfortran.dg/pointer_function_actual_1.f90: New test.

PR fortran/31200
* gfortran.dg/pointer_function_actual_2.f90: New test.

PR fortran/31215
* gfortran.dg/result_in_spec_1.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/pointer_function_actual_1.f90
trunk/gcc/testsuite/gfortran.dg/pointer_function_actual_2.f90
trunk/gcc/testsuite/gfortran.dg/result_in_spec_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument

2007-03-24 Thread pault at gcc dot gnu dot org


--- Comment #7 from pault at gcc dot gnu dot org  2007-03-24 13:58 ---
Fixed on trunk

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument

2007-03-24 Thread pault at gcc dot gnu dot org


--- Comment #8 from pault at gcc dot gnu dot org  2007-03-24 14:17 ---
Subject: Bug 31200

Author: pault
Date: Sat Mar 24 14:17:34 2007
New Revision: 123184

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=123184
Log:
2007-03-24  Paul Thomas  [EMAIL PROTECTED]

PR fortran/31215
* trans-expr.c (gfc_apply_interface_mapping_to_expr): Return
int result that is non-zero if the expression is the function
result.  Only the characteristics of the result expression
can be used in a procedure interface, so simplify LEN in situ
using its character length.

PR fortran/31219
PR fortran/31200
* trans-expr.c (gfc_conv_function_call): Do not use
gfc_conv_expr_reference for actual pointer function with formal
target because a temporary is created that does not transfer
the reference correctly.  Do not indirect formal pointer
functions since it is the function reference that is needed.

2007-03-24  Paul Thomas  [EMAIL PROTECTED]

PR fortran/31219
* gfortran.dg/pointer_function_actual_1.f90: New test.

PR fortran/31200
* gfortran.dg/pointer_function_actual_2.f90: New test.

PR fortran/31215
* gfortran.dg/result_in_spec_1.f90: New test.

Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/pointer_function_actual_1.f90


-- 


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



[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument

2007-03-21 Thread burnus at gcc dot gnu dot org


--- Comment #4 from burnus at gcc dot gnu dot org  2007-03-21 17:13 ---
*** Bug 31211 has been marked as a duplicate of this bug. ***


-- 


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



[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument

2007-03-17 Thread pault at gcc dot gnu dot org


--- Comment #3 from pault at gcc dot gnu dot org  2007-03-17 15:52 ---
This fixes the bug (and PR31209) and regtests OK.  Will package it up as a
submission tomorrow morning.

Index: gcc/fortran/trans-expr.c
===
*** gcc/fortran/trans-expr.c(revision 122943)
--- gcc/fortran/trans-expr.c(working copy)
*** gfc_conv_function_call (gfc_se * se, gfc
*** 2074,2083 
--- 2074,2091 
/* Argument list functions %VAL, %LOC and %REF are signalled
   through arg-name.  */
conv_arglist_function (parmse, arg-expr, arg-name);
+ else if ((e-expr_type == EXPR_FUNCTION)
+  e-symtree-n.sym-attr.pointer
+  fsym  fsym-attr.target)
+   {
+ gfc_conv_expr (parmse, e);
+ parmse.expr = build_fold_addr_expr (parmse.expr);
+   }
  else
{
  gfc_conv_expr_reference (parmse, e);
  if (fsym  fsym-attr.pointer
+fsym-attr.flavor != FL_PROCEDURE
 e-expr_type != EXPR_NULL)
{
  /* Scalar pointer dummy args require an extra level of

Paul


-- 


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



[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument

2007-03-16 Thread burnus at gcc dot gnu dot org


--- Comment #1 from burnus at gcc dot gnu dot org  2007-03-16 14:07 ---
The problem is:
  s3(f(x))
which is translated as
  {
real4 D.1254;

D.1254 = *f (x);
s3 (D.1254);
  }
instead of
  D.1254 = f(x)


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords||wrong-code
   Last reconfirmed|-00-00 00:00:00 |2007-03-16 14:07:34
   date||
Summary|wrong code generated with   |wrong code: procedure call
   |gfortran|with pointer-returning-
   ||function as argument


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



[Bug fortran/31200] wrong code: procedure call with pointer-returning-function as argument

2007-03-16 Thread pault at gcc dot gnu dot org


--- Comment #2 from pault at gcc dot gnu dot org  2007-03-16 17:10 ---
(In reply to comment #1)

 real4 D.1254;
 D.1254 = *f (x);
 s3 (D.1254);
   }
 instead of
   D.1254 = f(x)

Funnily enough, I have been hit by the same problem in implementing procedure
pointers.  I will attempt to come to grips with it.

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2007-03-16 14:07:34 |2007-03-16 17:10:34
   date||


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