public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/25746]  New: Elemental assignment gives wrong result
@ 2006-01-11  8:26 anlauf at gmx dot de
  2006-01-11 13:58 ` [Bug fortran/25746] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: anlauf at gmx dot de @ 2006-01-11  8:26 UTC (permalink / raw)
  To: gcc-bugs

Hi,

now that elemental subroutines appear to not ICE anymore,
I found that the example code at

http://home.comcast.net/~kmbtib/Fortran_stuff/elem_assign.f90

gives a wrong result.

gfortran prints:

 original x =            7          11          13
 permuted x =           11          13           7
      new x =           11          13          11

However, the last line should equal the second.  It appears that
the assignment

   x = x((/2,3,1/))

does not properly recognize that source and target overlap.

Cheers,
-ha


-- 
           Summary: Elemental assignment gives wrong result
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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



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

* [Bug fortran/25746] Elemental assignment gives wrong result
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
@ 2006-01-11 13:58 ` pinskia at gcc dot gnu dot org
  2006-01-15 20:33 ` pault at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-11 13:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-11 13:58 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2006-01-11 13:58:09
               date|                            |


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



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

* [Bug fortran/25746] Elemental assignment gives wrong result
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
  2006-01-11 13:58 ` [Bug fortran/25746] " pinskia at gcc dot gnu dot org
@ 2006-01-15 20:33 ` pault at gcc dot gnu dot org
  2006-04-07 10:13 ` paul dot richard dot thomas at cea dot fr
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-01-15 20:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2006-01-15 20:33 -------
(In reply to comment #1)
> Confirmed.
> 
Thanks, Harald.  I will follow this up on a ~few weekish timescale.

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


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


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

* [Bug fortran/25746] Elemental assignment gives wrong result
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
  2006-01-11 13:58 ` [Bug fortran/25746] " pinskia at gcc dot gnu dot org
  2006-01-15 20:33 ` pault at gcc dot gnu dot org
@ 2006-04-07 10:13 ` paul dot richard dot thomas at cea dot fr
  2006-04-07 10:16 ` paul dot richard dot thomas at cea dot fr
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-04-07 10:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paul dot richard dot thomas at cea dot fr  2006-04-07 10:13 -------
Created an attachment (id=11220)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11220&action=view)
Patch to fix elemental subroutine dependences.


-- 


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


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

* [Bug fortran/25746] Elemental assignment gives wrong result
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2006-04-07 10:13 ` paul dot richard dot thomas at cea dot fr
@ 2006-04-07 10:16 ` paul dot richard dot thomas at cea dot fr
  2006-04-21 11:35 ` patchapp at dberlin dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-04-07 10:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paul dot richard dot thomas at cea dot fr  2006-04-07 10:16 -------
> Patch to fix elemental subroutine dependences.
This is still a little bit ragged insofar as it produces and excess of
temporaries and that it still gets one case wrong:

x(1:2) = x(2:3) is broken.
However, the bulk of the work is done and the submission is a few days away.  I
will add the conformance checks too.

Cheers

Paul 


-- 


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


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

* [Bug fortran/25746] Elemental assignment gives wrong result
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2006-04-07 10:16 ` paul dot richard dot thomas at cea dot fr
@ 2006-04-21 11:35 ` patchapp at dberlin dot org
  2006-05-15 19:36 ` patchapp at dberlin dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2006-04-21 11:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2006-04-21 11:35 -------
Subject: Bug number PR25746

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-04/msg00795.html


-- 


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


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

* [Bug fortran/25746] Elemental assignment gives wrong result
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2006-04-21 11:35 ` patchapp at dberlin dot org
@ 2006-05-15 19:36 ` patchapp at dberlin dot org
  2006-05-21  7:35 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2006-05-15 19:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from patchapp at dberlin dot org  2006-05-15 19:36 -------
Subject: Bug number PR25746

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-05/msg00296.html


-- 


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


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

* [Bug fortran/25746] Elemental assignment gives wrong result
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2006-05-15 19:36 ` patchapp at dberlin dot org
@ 2006-05-21  7:35 ` pault at gcc dot gnu dot org
  2006-05-28 19:48 ` [Bug fortran/25746] Elemental assignment gives wrong result (fixed in trunk) pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-05-21  7:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2006-05-21 07:35 -------
Subject: Bug 25746

Author: pault
Date: Sun May 21 07:35:05 2006
New Revision: 113949

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

        PR fortran/25746
        * interface.c (gfc_extend_assign): Use new code EXEC_ASSIGN_CALL.
        * gfortran.h : Put EXEC_ASSIGN_CALL in enum.
        * trans-stmt.c (gfc_conv_elemental_dependencies): New function.
        (gfc_trans_call): Call it.  Add new boolian argument to flag
        need for dependency checking. Assert intent OUT and IN for arg1
        and arg2.
        (gfc_trans_forall_1): Use new code EXEC_ASSIGN_CALL.
        trans-stmt.h : Modify prototype of gfc_trans_call.
        trans.c (gfc_trans_code): Add call for EXEC_ASSIGN_CALL.
        st.c (gfc_free_statement): Free actual for EXEC_ASSIGN_CALL.
        * dependency.c (gfc_check_fncall_dependency): Don't check other
        against itself.

        PR fortran/25090
        * resolve.c : Remove resolving_index_expr.
        (entry_parameter): Remove.
        (gfc_resolve_expr, resolve_charlen, resolve_fl_variable): Remove
        calls to entry_parameter and references to resolving_index_expr.

        PR fortran/27584
        * check.c (gfc_check_associated): Replace NULL assert with an
        error message, since it is possible to generate bad code that
        has us fall through to here..

        PR fortran/19015
        * iresolve.c (maxloc, minloc): If DIM is not present, pass the
        rank of ARRAY as the shape of the result.  Otherwise, pass the
        shape of ARRAY, less the dimension DIM.
        (maxval, minval): The same, when DIM is present, otherwise no
        change.

2006-05-21  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/25746
        * gfortran.dg/elemental_subroutine_3.f90: New test.

        PR fortran/25090
        * gfortran.dg/entry_dummy_ref_1.f90: Remove.

        PR fortran/27584
        * gfortran.dg/associated_target_1.f90: New test.

        PR fortran/19015
        * gfortran.dg/maxloc_shape_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/associated_target_1.f90
    trunk/gcc/testsuite/gfortran.dg/elemental_subroutine_3.f90
    trunk/gcc/testsuite/gfortran.dg/maxloc_shape_1.f90
Removed:
    trunk/gcc/testsuite/gfortran.dg/entry_dummy_ref_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/dependency.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/st.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/fortran/trans-stmt.h
    trunk/gcc/fortran/trans.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/25746] Elemental assignment gives wrong result (fixed in trunk)
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
                   ` (6 preceding siblings ...)
  2006-05-21  7:35 ` pault at gcc dot gnu dot org
@ 2006-05-28 19:48 ` pault at gcc dot gnu dot org
  2006-05-28 19:52 ` pault at gcc dot gnu dot org
  2006-05-28 19:54 ` [Bug fortran/25746] Elemental assignment gives wrong result pault at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-05-28 19:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2006-05-28 19:47 -------
Subject: Bug 25746

Author: pault
Date: Sun May 28 19:46:22 2006
New Revision: 114173

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

        PR fortran/25082
        * resolve.c (resolve_code): Add error condition that the return
        expression must be scalar.

        PR fortran/27411
        * matchexp.c (gfc_get_parentheses): New function.
        (match_primary): Remove inline code and call above.
        * gfortran.h: Provide prototype for gfc_get_parentheses.
        * resolve.c (resolve_array_ref): Call the above, when start is a
        derived type variable array reference.

        PR fortran/27613
        * primary.c (gfc_match_rvalue): Test if symbol represents a
        direct recursive function reference.  Error if array valued,
        go to function0 otherwise.

        PR fortran/25746
        * interface.c (gfc_extend_assign): Use new EXEC_ASSIGN_CALL.
        * gfortran.h : Put EXEC_ASSIGN_CALL in enum.
        * trans-stmt.c (gfc_conv_elemental_dependencies): New function.
        (gfc_trans_call): Call it.  Add new boolian argument to flag
        need for dependency checking. Assert intent OUT and IN for arg1
        and arg2.
        (gfc_trans_forall_1): Use new code EXEC_ASSIGN_CALL.
        trans-stmt.h : Modify prototype of gfc_trans_call.
        trans.c (gfc_trans_code): Add call for EXEC_ASSIGN_CALL.
        st.c (gfc_free_statement): Free actual for EXEC_ASSIGN_CALL.
        * dependency.c (gfc_check_fncall_dependency): Don't check other
        against itself.

        PR fortran/27584
        * check.c (gfc_check_associated): Replace NULL assert with an
        error message, since it is possible to generate bad code that
        has us fall through to here..

        PR fortran/19015
        * iresolve.c (maxloc, minloc): If DIM is not present, pass the
        rank of ARRAY as the shape of the result.  Otherwise, pass the
        shape of ARRAY, less the dimension DIM.
        (maxval, minval): The same, when DIM is present, otherwise no
        change.

        PR fortran/27709
        * resolve.c (find_array_spec): Add gfc_symbol, derived, and
        use to track repeated component references.

        PR fortran/27155
        PR fortran/27449
        * trans-intrinsic.c (gfc_conv_intrinsic_array_transfer): Use
        se->string_length throughout and use memcpy to populate the
        expression returned to the scalarizer.
        (gfc_size_in_bytes): New function.

        * trans-intrinsic.c (gfc_conv_associated): If pointer in first
        arguments has zero array length of zero string length, return
        false.

2006-05-28  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/25082
        * gfortran.dg/scalar_return_1.f90: New test.

        PR fortran/27411
        * gfortran.dg/derived_comp_array_ref_1.f90: New test.

        PR fortran/25746
        * gfortran.dg/elemental_subroutine_3.f90: New test.

        PR fortran/27584
        * gfortran.dg/associated_target_1.f90: New test.

        PR fortran/19015
        * gfortran.dg/maxloc_shape_1.f90: New test.

        PR fortran/27613
        * gfortran.dg/recursive_reference_1.f90: New test.

        PR fortran/27709
        * gfortran.dg/spec_expr_4.f90: New test.

        PR fortran/27155
        * gfortran.dg/transfer_array_intrinsic_4.f90: New test.

        * gfortran.dg/associated_2.f90: New test.

Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/check.c
    branches/gcc-4_1-branch/gcc/fortran/gfortran.h
    branches/gcc-4_1-branch/gcc/fortran/interface.c
    branches/gcc-4_1-branch/gcc/fortran/iresolve.c
    branches/gcc-4_1-branch/gcc/fortran/matchexp.c
    branches/gcc-4_1-branch/gcc/fortran/primary.c
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/st.c
    branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_1-branch/gcc/fortran/trans-stmt.c
    branches/gcc-4_1-branch/gcc/fortran/trans-stmt.h
    branches/gcc-4_1-branch/gcc/fortran/trans.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/25746] Elemental assignment gives wrong result (fixed in trunk)
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
                   ` (7 preceding siblings ...)
  2006-05-28 19:48 ` [Bug fortran/25746] Elemental assignment gives wrong result (fixed in trunk) pault at gcc dot gnu dot org
@ 2006-05-28 19:52 ` pault at gcc dot gnu dot org
  2006-05-28 19:54 ` [Bug fortran/25746] Elemental assignment gives wrong result pault at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-05-28 19:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2006-05-28 19:51 -------
Subject: Bug 25746

Author: pault
Date: Sun May 28 19:50:51 2006
New Revision: 114174

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

        PR fortran/25082
        * gfortran.dg/scalar_return_1.f90: New test.

        PR fortran/27411
        * gfortran.dg/derived_comp_array_ref_1.f90: New test.

        PR fortran/25746
        * gfortran.dg/elemental_subroutine_3.f90: New test.

        PR fortran/27584
        * gfortran.dg/associated_target_1.f90: New test.

        PR fortran/19015
        * gfortran.dg/maxloc_shape_1.f90: New test.

        PR fortran/27613
        * gfortran.dg/recursive_reference_1.f90: New test.

        PR fortran/27709
        * gfortran.dg/spec_expr_4.f90: New test.

        PR fortran/27155
        * gfortran.dg/transfer_array_intrinsic_4.f90: New test.

        * gfortran.dg/associated_2.f90: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/associated_2.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/associated_target_1.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/derived_comp_array_ref_1.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/elemental_subroutine_3.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/maxloc_shape_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/recursive_reference_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/scalar_return_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/spec_expr_4.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/transfer_array_intrinsic_4.f90


-- 


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


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

* [Bug fortran/25746] Elemental assignment gives wrong result
  2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
                   ` (8 preceding siblings ...)
  2006-05-28 19:52 ` pault at gcc dot gnu dot org
@ 2006-05-28 19:54 ` pault at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-05-28 19:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pault at gcc dot gnu dot org  2006-05-28 19:54 -------
Fixed in trunk and 4.1

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|Elemental assignment gives  |Elemental assignment gives
                   |wrong result (fixed in      |wrong result
                   |trunk)                      |


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


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

end of thread, other threads:[~2006-05-28 19:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-11  8:26 [Bug fortran/25746] New: Elemental assignment gives wrong result anlauf at gmx dot de
2006-01-11 13:58 ` [Bug fortran/25746] " pinskia at gcc dot gnu dot org
2006-01-15 20:33 ` pault at gcc dot gnu dot org
2006-04-07 10:13 ` paul dot richard dot thomas at cea dot fr
2006-04-07 10:16 ` paul dot richard dot thomas at cea dot fr
2006-04-21 11:35 ` patchapp at dberlin dot org
2006-05-15 19:36 ` patchapp at dberlin dot org
2006-05-21  7:35 ` pault at gcc dot gnu dot org
2006-05-28 19:48 ` [Bug fortran/25746] Elemental assignment gives wrong result (fixed in trunk) pault at gcc dot gnu dot org
2006-05-28 19:52 ` pault at gcc dot gnu dot org
2006-05-28 19:54 ` [Bug fortran/25746] Elemental assignment gives wrong result 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).