public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36795]  New: crash with character allocatable array argument
@ 2008-07-10 20:10 vivekrao4 at yahoo dot com
  2008-07-11  6:00 ` [Bug fortran/36795] " burnus at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vivekrao4 at yahoo dot com @ 2008-07-10 20:10 UTC (permalink / raw)
  To: gcc-bugs

For the code

program main
implicit none
character (len=10), allocatable :: xx(:)
character (len=10)              :: yy
print*,"(5)"
allocate (xx(1))
xx(1)      = "dog"
call foo((xx),xx)
contains
subroutine foo(xx,yy)
character (len=*), intent(in)               :: xx(:)
character (len=*), intent(out), allocatable :: yy(:)
allocate (yy(size(xx)))
yy = xx
end subroutine foo
end program main

the program compiled by gfortran with the default options crashes at run time
with a pop-up box saying "An unhandled win32 exception occurred in a.exe
[55596]"

gfortran -v says

Using built-in specs.
Target: i586-pc-mingw32
Configured with: ../trunk/configure --prefix=/mingw
--enable-languages=c,fortran --with-gmp=/home/FX/local --with-ld=/mingw/bin/ld
--with-as=/mingw/bin/as --disable-werror --enable-bootstrap --enable-threads
--disable-nls --build=i586-pc-mingw32 --enable-libgomp --disable-shared
Thread model: win32
gcc version 4.4.0 20080603 (experimental) [trunk revision 136333] (GCC)


-- 
           Summary: crash with character allocatable array argument
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vivekrao4 at yahoo dot com


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
@ 2008-07-11  6:00 ` burnus at gcc dot gnu dot org
  2008-07-11  6:14 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-07-11  6:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-07-11 06:00 -------
The problem is:
   call foo((xx),xx)

gfortran simplifies the "(xx)" to "xx" by passing (-fdump-tree-orignal):
  foo (&xx, &xx, 10, 10);

Since the second argument is nullified in "foo" as it is INTENT(OUT), it is
obvious that accessing the first argument causes a crash.

NAG f95 solves this by creating a temporary for "(xx)" - as does g95.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
  2008-07-11  6:00 ` [Bug fortran/36795] " burnus at gcc dot gnu dot org
@ 2008-07-11  6:14 ` burnus at gcc dot gnu dot org
  2008-07-17 21:10 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-07-11  6:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-07-11 06:14 -------
Looking at PR 36803, I think the general algorithm could be correct, however,
it might not trigger for CHARACTER arrays. Maybe a fix for either PRs fixes
both.


-- 

burnus 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         |2008-07-11 06:14:04
               date|                            |


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
  2008-07-11  6:00 ` [Bug fortran/36795] " burnus at gcc dot gnu dot org
  2008-07-11  6:14 ` burnus at gcc dot gnu dot org
@ 2008-07-17 21:10 ` burnus at gcc dot gnu dot org
  2008-07-17 21:13 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-07-17 21:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2008-07-17 21:09 -------
*** Bug 36803 has been marked as a duplicate of this bug. ***


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
                   ` (2 preceding siblings ...)
  2008-07-17 21:10 ` burnus at gcc dot gnu dot org
@ 2008-07-17 21:13 ` burnus at gcc dot gnu dot org
  2008-07-19 18:30 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-07-17 21:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2008-07-17 21:12 -------
The problem is the following in matchexp.c:

gfc_get_parentheses (gfc_expr *e)
{
  gfc_expr *e2;

  /* This is a temporary fix, awaiting the patch for various
     other character problems.  The resolution and translation
     of substrings and concatenations are so kludged up that
     putting parentheses around them breaks everything.  */
  if (e->ts.type == BT_CHARACTER && e->ref)
    return e;

If one removes that part, this PR (and the one marked as duplicate) is solved.
I have not checked, whether this still opens Pandora's box.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
                   ` (3 preceding siblings ...)
  2008-07-17 21:13 ` burnus at gcc dot gnu dot org
@ 2008-07-19 18:30 ` burnus at gcc dot gnu dot org
  2008-08-08 22:34 ` jv244 at cam dot ac dot uk
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-07-19 18:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2008-07-19 18:30 -------
Subject: Bug 36795

Author: burnus
Date: Sat Jul 19 18:29:18 2008
New Revision: 137986

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137986
Log:
2008-07-19  Tobias Burnus  <burnus@net-b.de>

        PR fortran/36795
        * matchexp.c (gfc_get_parentheses): Remove obsolete workaround,
        which caused the generation of wrong code.

2008-07-19  Tobias Burnus  <burnus@net-b.de>

        PR fortran/36795
        * char_expr_1.f90: New.
        * char_expr_2.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/char_expr_1.f90
    trunk/gcc/testsuite/gfortran.dg/char_expr_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/matchexp.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
                   ` (4 preceding siblings ...)
  2008-07-19 18:30 ` burnus at gcc dot gnu dot org
@ 2008-08-08 22:34 ` jv244 at cam dot ac dot uk
  2008-10-21 18:59 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-08-08 22:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jv244 at cam dot ac dot uk  2008-08-08 22:33 -------
I wonder if this bug can be closed, the testcase appears to work with trunk


-- 

jv244 at cam dot ac dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.4.0


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
                   ` (5 preceding siblings ...)
  2008-08-08 22:34 ` jv244 at cam dot ac dot uk
@ 2008-10-21 18:59 ` pault at gcc dot gnu dot org
  2008-10-21 20:30 ` pault at gcc dot gnu dot org
  2008-10-21 20:32 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-10-21 18:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2008-10-21 18:58 -------
(In reply to comment #6)
> I wonder if this bug can be closed, the testcase appears to work with trunk
> 

Joost,

I don't know what happened here.  I have made a testsuite case out of the
original and will commit it to trunk and close this PR.

Thanks for pointing it out and sorry it's taken so long to notice.

Cheers

Paul


-- 


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
                   ` (6 preceding siblings ...)
  2008-10-21 18:59 ` pault at gcc dot gnu dot org
@ 2008-10-21 20:30 ` pault at gcc dot gnu dot org
  2008-10-21 20:32 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-10-21 20:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2008-10-21 20:28 -------
Subject: Bug 36795

Author: pault
Date: Tue Oct 21 20:27:27 2008
New Revision: 141277

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

        PR libfortran/36795
        * gfortran.dg/char_expr_3.f90:  Add the original test case.


Added:
    trunk/gcc/testsuite/gfortran.dg/char_expr_3.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/36795] crash with character allocatable array argument
  2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
                   ` (7 preceding siblings ...)
  2008-10-21 20:30 ` pault at gcc dot gnu dot org
@ 2008-10-21 20:32 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-10-21 20:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2008-10-21 20:30 -------
Fixed on trunk as per #7.

Thanks for the report

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=36795


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

end of thread, other threads:[~2008-10-21 20:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-10 20:10 [Bug fortran/36795] New: crash with character allocatable array argument vivekrao4 at yahoo dot com
2008-07-11  6:00 ` [Bug fortran/36795] " burnus at gcc dot gnu dot org
2008-07-11  6:14 ` burnus at gcc dot gnu dot org
2008-07-17 21:10 ` burnus at gcc dot gnu dot org
2008-07-17 21:13 ` burnus at gcc dot gnu dot org
2008-07-19 18:30 ` burnus at gcc dot gnu dot org
2008-08-08 22:34 ` jv244 at cam dot ac dot uk
2008-10-21 18:59 ` pault at gcc dot gnu dot org
2008-10-21 20:30 ` pault at gcc dot gnu dot org
2008-10-21 20:32 ` 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).