public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29916]  New: Dimension of a function result as host association does not work
@ 2006-11-20 18:13 burnus at gcc dot gnu dot org
  2006-11-20 20:38 ` [Bug fortran/29916] " pault at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-11-20 18:13 UTC (permalink / raw)
  To: gcc-bugs

The following valid code by Marco Restelli, 
http://gcc.gnu.org/ml/fortran/2006-11/msg00520.html
fails to compile with current gfortran 4.3:

host.f90:8.20:
 real :: internal_f(n)
                   1
Error: Variable 'n' cannot appear in the expression at (1)

This program compiles with NAG f95, ifort, g95, sunf95 and Lahey.

----------------------------
program test_internal
implicit none
integer :: n
n = 4
contains
function internal_f()
 real :: internal_f(n)
 internal_f = 2
end function internal_f
end program test_internal
----------------------------


-- 
           Summary: Dimension of a function result as host association does
                    not work
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
GCC target triplet: x86_64-unknown-linux-gnu


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
@ 2006-11-20 20:38 ` pault at gcc dot gnu dot org
  2006-11-20 22:44 ` burnus at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-11-20 20:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2006-11-20 20:38 -------
Created an attachment (id=12653)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12653&action=view)
A patch for this PR.

Tobias and Dominique,

This is nearly identical to PR23446, which I fixed.  It was therefore and easy
job to extend the principle of host associated variables in dummy specification
expressions to those of array-valued functions.

I bolstered up the test for both by insisting that not only the
gfc_is_formal_arg flag being set but that the symbol should be in the current
namespace.  If this seems odd, remember that contained procedures' symbols are
found in their parent's namespace.

I have checked that host_dummy_index_1.f90 works OK but have not regtested yet.
  It is possible that ENTRYs are messed up but I have not checked this.

I am 1000km from my workstation right now and will be there for some 10 days
yet.  I have not managed to penetrate the firewalls(x4!) here with svn+ssh and
so can commit nothing.  If you are moved to do so, please take the fix and make
it fly. Otherwise, I'll do it when I get home.

Best regards

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|UNCONFIRMED                 |ASSIGNED


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
  2006-11-20 20:38 ` [Bug fortran/29916] " pault at gcc dot gnu dot org
@ 2006-11-20 22:44 ` burnus at gcc dot gnu dot org
  2006-11-21  1:27 ` patchapp at dberlin dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-11-20 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2006-11-20 22:44 -------
Created an attachment (id=12654)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12654&action=view)
Paul's patch + gfortran.dg/host_dummy_index_1.f90 diff

I modified gfortran.dg/host_dummy_index_1.f90 to also test this PR.
Build and regression tested on x86_64-unknown-linux-gnu.

Thanks for the patch.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #12653|0                           |1
        is obsolete|                            |


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
  2006-11-20 20:38 ` [Bug fortran/29916] " pault at gcc dot gnu dot org
  2006-11-20 22:44 ` burnus at gcc dot gnu dot org
@ 2006-11-21  1:27 ` patchapp at dberlin dot org
  2006-11-21  8:42 ` paulthomas2 at wanadoo dot fr
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: patchapp at dberlin dot org @ 2006-11-21  1:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from patchapp at dberlin dot org  2006-11-21 01:27 -------
Subject: Bug number PR29916

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/2006-11/msg01456.html


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-11-21  1:27 ` patchapp at dberlin dot org
@ 2006-11-21  8:42 ` paulthomas2 at wanadoo dot fr
  2006-12-04 11:16 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2006-11-21  8:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paulthomas2 at wanadoo dot fr  2006-11-21 08:41 -------
Subject: Re:  Dimension of a function result as host association
 does not work

burnus at gcc dot gnu dot org wrote:
> ------- Comment #2 from burnus at gcc dot gnu dot org  2006-11-20 22:44 -------
> Created an attachment (id=12654)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12654&action=view)
>  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12654&action=view)
> Paul's patch + gfortran.dg/host_dummy_index_1.f90 diff
>
> I modified gfortran.dg/host_dummy_index_1.f90 to also test this PR.
> Build and regression tested on x86_64-unknown-linux-gnu.
>
> Thanks for the patch.
>
>
>   
Tobias,

Thanks to you!

Paul


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-11-21  8:42 ` paulthomas2 at wanadoo dot fr
@ 2006-12-04 11:16 ` burnus at gcc dot gnu dot org
  2006-12-04 17:53 ` [Bug fortran/29916] [4.1 and 4.2 only] " pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-12-04 11:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2006-12-04 11:16 -------
Subject: Bug 29916

Author: burnus
Date: Mon Dec  4 11:16:12 2006
New Revision: 119489

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119489
Log:
fortran/
2006-12-04  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/29916
    * resolve.c (resolve_symbol): Allow host-associated variables
      in the specification expression of an array-valued function.
    * expr.c (check_restricted): Accept host-associated dummy
      array indices.

testsuite/
2006-12-04  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/29916
    * gfortran.dg/host_dummy_index_1.f90: Added additional test.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/host_dummy_index_1.f90


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] [4.1 and 4.2 only] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-12-04 11:16 ` burnus at gcc dot gnu dot org
@ 2006-12-04 17:53 ` pault at gcc dot gnu dot org
  2006-12-04 18:05 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-04 17:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2006-12-04 17:53 -------
(In reply to comment #5)
> Subject: Bug 29916
Tobias,

Thank you!  I had a bit of a surprise when I tried, a few minutes ago, to apply
the patch...  I thought that I was going even madder than usual, when it came
back with the information that there was an unreversed patch in place!

I suppose that this should float down to 4.2 before it is cleared?

Paul


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] [4.1 and 4.2 only] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-12-04 17:53 ` [Bug fortran/29916] [4.1 and 4.2 only] " pault at gcc dot gnu dot org
@ 2006-12-04 18:05 ` burnus at gcc dot gnu dot org
  2006-12-04 18:38 ` paulthomas2 at wanadoo dot fr
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-12-04 18:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2006-12-04 18:05 -------
> Thank you!  I had a bit of a surprise when I tried, a few minutes ago, to 
> apply the patch...  I thought that I was going even madder than usual, when it
> came back with the information that there was an unreversed patch in place!
I thought you saw the submission email (autoattached to this PR and thus also
in your mailbox).

> I suppose that this should float down to 4.2 before it is cleared?
Yes -- and maybe also to 4.1.


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] [4.1 and 4.2 only] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-12-04 18:05 ` burnus at gcc dot gnu dot org
@ 2006-12-04 18:38 ` paulthomas2 at wanadoo dot fr
  2006-12-09 15:18 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paulthomas2 at wanadoo dot fr @ 2006-12-04 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from paulthomas2 at wanadoo dot fr  2006-12-04 18:38 -------
Subject: Re:  [4.1 and 4.2 only] Dimension of a function
 result as host association does not work

Tobias,
> t you saw the submission email (autoattached to this PR and thus also
> in your mailbox).
>   
As I said yesterday, I am trying keep the ia64 clean of email :-)

I just saw your message now.


Thanks a lot!

Paul


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] [4.1 and 4.2 only] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-12-04 18:38 ` paulthomas2 at wanadoo dot fr
@ 2006-12-09 15:18 ` pault at gcc dot gnu dot org
  2006-12-09 15:22 ` [Bug fortran/29916] [4.1 " pault at gcc dot gnu dot org
  2006-12-09 17:48 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-09 15:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2006-12-09 15:17 -------
Subject: Bug 29916

Author: pault
Date: Sat Dec  9 15:17:16 2006
New Revision: 119690

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119690
Log:
2006-12-09  Paul Thomas  <pault@gcc.gnu.org>

        Backports from trunk

        PR fortran/29821
        * resolve.c (resolve_operator): Only return result of
        gfc_simplify_expr if expression is constant.

        PR fortran/29912
        * trans-expr.c (gfc_trans_arrayfunc_assign): Return NULL if the
        lhs and rhs character lengths are not constant and equal for
        character array valued functions.

        PR fortran/29916
        * resolve.c (resolve_symbol): Allow host-associated variables
        in the specification expression of an array-valued function.
        * expr.c (check_restricted): Accept host-associated dummy
        array indices.

        PR fortran/30003
        * trans-array.c (gfc_trans_create_temp_array): Set the section
        ends to zero.
        (gfc_conv_array_transpose): Likewise.
        (gfc_conv_section_startstride): Declare an expression for end,
        set it from a the array reference and evaluate it for the info
        structure. Zero the ends in the ss structure and set end, used
        in the bounds check, from the info structure.
        trans.h: Add and end array to the gfc_ss_info structure.

2006-12-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/29821
        * gfortran.dg/parameter_array_section_1.f90: New test.

        PR fortran/29912
        * gfortran.dg/char_result_12.f90: New test.

        PR fortran/29916
        * gfortran.dg/host_dummy_index_1.f90: Added additional test.

        PR fortran/30003
        * gfortran.dg/allocatable_function_1.f90: Increase the number
        of expected calls of free to 10; the lhs section reference is
        now evaluated so there is another call to bar.  Change the
        comment appropriately.
        * gfortran.dg/array_section_1.f90: New test.


Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/array_section_1.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/char_result_12.f90
   
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/parameter_array_section_1.f90
Modified:
    branches/gcc-4_2-branch/gcc/fortran/ChangeLog
    branches/gcc-4_2-branch/gcc/fortran/expr.c
    branches/gcc-4_2-branch/gcc/fortran/resolve.c
    branches/gcc-4_2-branch/gcc/fortran/trans-array.c
    branches/gcc-4_2-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_2-branch/gcc/fortran/trans.h
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
   
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/allocatable_function_1.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/host_dummy_index_1.f90


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] [4.1 only] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-12-09 15:18 ` pault at gcc dot gnu dot org
@ 2006-12-09 15:22 ` pault at gcc dot gnu dot org
  2006-12-09 17:48 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-09 15:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pault at gcc dot gnu dot org  2006-12-09 15:21 -------
Fixed in trunk and 4.2.  If I have time, I will patch 4.1 someday.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[4.1 and 4.2 only] Dimension|[4.1 only] Dimension of a
                   |of a function result as host|function result as host
                   |association does not work   |association does not work


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29916] [4.1 only] Dimension of a function result as host association does not work
  2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2006-12-09 15:22 ` [Bug fortran/29916] [4.1 " pault at gcc dot gnu dot org
@ 2006-12-09 17:48 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-09 17:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pault at gcc dot gnu dot org  2006-12-09 17:48 -------
Subject: Bug 29916

Author: pault
Date: Sat Dec  9 17:47:45 2006
New Revision: 119694

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119694
Log:
2006-12-09  Paul Thomas  <pault@gcc.gnu.org>

        Backports from trunk

        PR fortran/29821
        * resolve.c (resolve_operator): Only return result of
        gfc_simplify_expr if expression is constant.

        PR fortran/29912
        * trans-expr.c (gfc_trans_arrayfunc_assign): Return NULL if the
        lhs and rhs character lengths are not constant and equal for
        character array valued functions.

        PR fortran/29916
        * resolve.c (resolve_symbol): Allow host-associated variables
        in the specification expression of an array-valued function.
        * expr.c (check_restricted): Accept host-associated dummy
        array indices.

        PR fortran/30003
        * trans-array.c (gfc_trans_create_temp_array): Set the section
        ends to zero.
        (gfc_conv_section_startstride): Declare an expression for end,
        set it from a the array reference and evaluate it for the info
        structure. Zero the ends in the ss structure and set end, used
        in the bounds check, from the info structure.
        trans.h: Add and end array to the gfc_ss_info structure.

        PR fortran/29820
        * trans-array.c (gfc_get_derived_type): Once done, spread the
        backend_decl to all identical derived types in all sibling
        namespaces.

2006-12-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/29821
        * gfortran.dg/parameter_array_section_1.f90: New test.

        PR fortran/29912
        * gfortran.dg/char_result_12.f90: New test.

        PR fortran/29916
        * gfortran.dg/host_dummy_index_1.f90: Added additional test.

        PR fortran/30003
        * gfortran.dg/allocatable_function_1.f90: Increase the number
        of expected calls of free to 10; the lhs section reference is
        now evaluated so there is another call to bar.  Change the
        comment appropriately.
        * gfortran.dg/array_section_1.f90: New test.

        PR fortran/29820
        * gfortran.dg/used_types_13.f90: New test.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_section_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/char_result_12.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/parameter_array_section_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/used_types_13.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/expr.c
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_1-branch/gcc/fortran/trans-types.c
    branches/gcc-4_1-branch/gcc/fortran/trans.h
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/host_dummy_index_1.f90


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-12-09 17:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-20 18:13 [Bug fortran/29916] New: Dimension of a function result as host association does not work burnus at gcc dot gnu dot org
2006-11-20 20:38 ` [Bug fortran/29916] " pault at gcc dot gnu dot org
2006-11-20 22:44 ` burnus at gcc dot gnu dot org
2006-11-21  1:27 ` patchapp at dberlin dot org
2006-11-21  8:42 ` paulthomas2 at wanadoo dot fr
2006-12-04 11:16 ` burnus at gcc dot gnu dot org
2006-12-04 17:53 ` [Bug fortran/29916] [4.1 and 4.2 only] " pault at gcc dot gnu dot org
2006-12-04 18:05 ` burnus at gcc dot gnu dot org
2006-12-04 18:38 ` paulthomas2 at wanadoo dot fr
2006-12-09 15:18 ` pault at gcc dot gnu dot org
2006-12-09 15:22 ` [Bug fortran/29916] [4.1 " pault at gcc dot gnu dot org
2006-12-09 17:48 ` pault at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).