public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28174]  New: Corruption of multiple character arrays when passing array sections
@ 2006-06-26 20:58 anlauf at gmx dot de
  2006-06-26 21:01 ` [Bug fortran/28174] " anlauf at gmx dot de
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: anlauf at gmx dot de @ 2006-06-26 20:58 UTC (permalink / raw)
  To: gcc-bugs

Here's a very strange example of data corruption when passing
a character array section in the form

  call foo (a(:)(7:11))

to a subroutine even if the parameter is declared as INTENT(IN).
Furthermore, even another array gets corrupted which is intended
to hold a copy.

See testcase for details.

Cheers,
-ha


-- 
           Summary: Corruption of multiple character arrays when passing
                    array sections
           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=28174


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
@ 2006-06-26 21:01 ` anlauf at gmx dot de
  2006-06-27 20:13 ` pault at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gmx dot de @ 2006-06-26 21:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from anlauf at gmx dot de  2006-06-26 20:58 -------
Created an attachment (id=11759)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11759&action=view)
Testcase

Output of testcase:

 Before foo:
 a(1)=abc def ghij
 a(2)=klm nop qrst
 b(1)=abc def ghij
 b(2)=klm nop qrst

 In foo: c(1)=f ghi

 After foo:
 a(1)=abc d
 a(2)=klm n
 b(1)=abc d
 b(2)=klm n
 Bug: array a corrupted in subroutine call!
 Bug: array b corrupted in subroutine call!


-- 


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


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
  2006-06-26 21:01 ` [Bug fortran/28174] " anlauf at gmx dot de
@ 2006-06-27 20:13 ` pault at gcc dot gnu dot org
  2006-06-29 22:14 ` patchapp at dberlin dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-27 20:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2006-06-27 17:47 -------
As I said to you in my email, this represents a new problem, which is exposed
by the previous fix.  I should have noticed that this was happening but...., at
least it doesn't segfault any more!

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                     |


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


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
  2006-06-26 21:01 ` [Bug fortran/28174] " anlauf at gmx dot de
  2006-06-27 20:13 ` pault at gcc dot gnu dot org
@ 2006-06-29 22:14 ` patchapp at dberlin dot org
  2006-06-30  0:08 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: patchapp at dberlin dot org @ 2006-06-29 22:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from patchapp at dberlin dot org  2006-06-29 22:05 -------
Subject: Bug number PR28174

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-06/msg01509.html


-- 


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


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2006-06-29 22:14 ` patchapp at dberlin dot org
@ 2006-06-30  0:08 ` pault at gcc dot gnu dot org
  2006-07-04 20:16 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-30  0:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2006-06-29 22:30 -------
Does the bug not get confirmed when somebody is assigned to it?

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-06-29 22:30:05
               date|                            |


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


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2006-06-30  0:08 ` pault at gcc dot gnu dot org
@ 2006-07-04 20:16 ` pault at gcc dot gnu dot org
  2006-07-04 20:36 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-04 20:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2006-07-04 20:16 -------
Subject: Bug 28174

Author: pault
Date: Tue Jul  4 20:15:52 2006
New Revision: 115182

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

        PR fortran/28174
        * trans-array.c (gfc_conv_expr_descriptor): When building temp,
        ensure that the substring reference uses a new charlen.
        * trans-expr.c (gfc_conv_aliased_arg): Add the formal intent to
        the argument list, lift the treatment of missing string lengths
        from the above and implement the use of the intent.
        (gfc_conv_function_call): Add the extra argument to the call to
        the above.

        PR fortran/28167
        * trans-array.c (get_array_ctor_var_strlen): Treat a constant
        substring reference.
        * array.c (gfc_resolve_character_array_constructor): Remove 
        static attribute and add the gfc_ prefix, make use of element
        charlens for the expression and pick up constant string lengths
        for expressions that are not themselves constant.
        * gfortran.h : resolve_character_array_constructor prototype
        added.
        * resolve.c (gfc_resolve_expr): Call resolve_character_array_
        constructor again after expanding the constructor, to ensure
        that the character length is passed to the expression.

2006-07-04  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28174
        * gfortran.dg/actual_array_substr_2.f90: New test.

        PR fortran/28167
        * gfortran.dg/actual_array_constructor_2.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/actual_array_constructor_2.f90
    trunk/gcc/testsuite/gfortran.dg/actual_array_substr_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/array.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-expr.c


-- 


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


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2006-07-04 20:16 ` pault at gcc dot gnu dot org
@ 2006-07-04 20:36 ` pault at gcc dot gnu dot org
  2006-07-06 15:35 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-04 20:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2006-07-04 20:36 -------
Subject: Bug 28174

Author: pault
Date: Tue Jul  4 20:36:15 2006
New Revision: 115187

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

        PR fortran/28174
        * gfortran.dg/actual_array_substr_2.f90: New test.

        PR fortran/28167
        * gfortran.dg/actual_array_constructor_2.f90: New test.


Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2006-07-04 20:36 ` pault at gcc dot gnu dot org
@ 2006-07-06 15:35 ` pault at gcc dot gnu dot org
  2006-07-06 15:37 ` pault at gcc dot gnu dot org
  2006-07-13  5:07 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-06 15:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2006-07-06 15:35 -------
Subject: Bug 28174

Author: pault
Date: Thu Jul  6 15:35:24 2006
New Revision: 115222

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

        PR fortran/28174
        * trans-array.c (gfc_conv_expr_descriptor): When building temp,
        ensure that the substring reference uses a new charlen.
        * trans-expr.c (gfc_conv_aliased_arg): Add the formal intent to
        the argument list, lift the treatment of missing string lengths
        from the above and implement the use of the intent.
        (gfc_conv_function_call): Add the extra argument to the call to
        the above.

        PR fortran/28167
        * trans-array.c (get_array_ctor_var_strlen): Treat a constant
        substring reference.
        * array.c (gfc_resolve_character_array_constructor): Remove 
        static attribute and add the gfc_ prefix, make use of element
        charlens for the expression and pick up constant string lengths
        for expressions that are not themselves constant.
        * gfortran.h : resolve_character_array_constructor prototype
        added.
        * resolve.c (gfc_resolve_expr): Call resolve_character_array_
        constructor again after expanding the constructor, to ensure
        that the character length is passed to the expression.

2006-07-06  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28174
        * gfortran.dg/actual_array_substr_2.f90: New test.

        PR fortran/28167
        * gfortran.dg/actual_array_constructor_2.f90: New test.


Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/array.c
    branches/gcc-4_1-branch/gcc/fortran/gfortran.h
    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/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
                   ` (6 preceding siblings ...)
  2006-07-06 15:35 ` pault at gcc dot gnu dot org
@ 2006-07-06 15:37 ` pault at gcc dot gnu dot org
  2006-07-13  5:07 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-06 15:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2006-07-06 15:37 -------
Fixed on trunk and 4.1

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug fortran/28174] Corruption of multiple character arrays when passing array sections
  2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
                   ` (7 preceding siblings ...)
  2006-07-06 15:37 ` pault at gcc dot gnu dot org
@ 2006-07-13  5:07 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-13  5:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2006-07-13 05:07 -------
Subject: Bug 28174

Author: pault
Date: Thu Jul 13 05:07:35 2006
New Revision: 115410

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

        PR fortran/28174
        * trans-expr.c (gfc_conv_aliased_arg): Missing formal arg means
        that intent is INOUT (fixes regression).

        PR fortran/25097
        * check.c (check_present): The only permitted reference is a
        full array reference.

        PR fortran/20903
        * decl.c (variable_decl): Add error if a derived type is not
        from the current namespace if the namespace is an interface
        body.

2006-07-13  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/25097
        * gfortran.dg/present_1.f90: New test.

        PR fortran/20903
        * gfortran.dg/interface_derived_type_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/interface_derived_type_1.f90
    trunk/gcc/testsuite/gfortran.dg/present_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2006-07-13  5:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-26 20:58 [Bug fortran/28174] New: Corruption of multiple character arrays when passing array sections anlauf at gmx dot de
2006-06-26 21:01 ` [Bug fortran/28174] " anlauf at gmx dot de
2006-06-27 20:13 ` pault at gcc dot gnu dot org
2006-06-29 22:14 ` patchapp at dberlin dot org
2006-06-30  0:08 ` pault at gcc dot gnu dot org
2006-07-04 20:16 ` pault at gcc dot gnu dot org
2006-07-04 20:36 ` pault at gcc dot gnu dot org
2006-07-06 15:35 ` pault at gcc dot gnu dot org
2006-07-06 15:37 ` pault at gcc dot gnu dot org
2006-07-13  5:07 ` 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).