[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2009-01-24 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|4.3.4   |4.3.3


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-23 Thread pault at gcc dot gnu dot org


--- Comment #17 from pault at gcc dot gnu dot org  2008-12-23 09:26 ---
(In reply to comment #12)
 (In reply to comment #11)
  Patch committed, fixed on trunk, 4.4
 I think it was the wrong PR number (35780 instead of PR34820).
 
Dang it! Sorry about that, I used the ChangeLogs from 35780 as a template and
forgot to update the numbers.

Thanks for helping out.

Paul


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread mikael at gcc dot gnu dot org


--- Comment #5 from mikael at gcc dot gnu dot org  2008-12-22 18:51 ---
Reduced:
program test_iso
   implicit none

   type varying_string
 character(LEN=1), dimension(:), allocatable :: chars
   end type varying_string

   CALL get_unit_set_ch ()

   contains

  subroutine get_unit_set_CH (separator)
type(varying_string), intent(out), optional :: separator
  end subroutine get_unit_set_CH

end


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread mikael at gcc dot gnu dot org


--- Comment #6 from mikael at gcc dot gnu dot org  2008-12-22 18:54 ---
(In reply to comment #5)
Generated code:

get_unit_set_ch (struct varying_string * separator)
{
  if (separator-chars.data != 0B)
{
  __builtin_free (separator-chars.data);
}
  separator-chars.data = 0B;
}


test_iso ()
{
  static integer(kind=4) options.0[8] = {68, 255, 0, 0, 0, 1, 0, 1};
  static void get_unit_set_ch (struct varying_string *);

  _gfortran_set_options (8, (void *) options.0);
  get_unit_set_ch (0B);
}


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread mikael at gcc dot gnu dot org


--- Comment #7 from mikael at gcc dot gnu dot org  2008-12-22 18:59 ---
This was probably a bad idea:
-  tmp = gfc_deallocate_alloc_comp (e-ts.derived, tmp, parm_rank);
- if (e-expr_type == EXPR_VARIABLE 
e-symtree-n.sym-attr.optional)
-   tmp = build3_v (COND_EXPR, gfc_conv_expr_present
(e-symtree-n.sym),
-   tmp, build_empty_stmt ());


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread pault at gcc dot gnu dot org


--- Comment #8 from pault at gcc dot gnu dot org  2008-12-22 19:39 ---
Created an attachment (id=16969)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16969action=view)
patch for the PR

This is a patch that I cannot commit until January 3rd at the earliest.  Please
could you do the honours, Jerry?  It runs all of alloc_comp*.f90 correctly but
I have NOT regtested it.

Paul

2008-12-22  Paul Thomas  pa...@gcc.gnu.org

PR fortran/35780
* trans-decl.c (init_intent_out_dt): Allow for optional args.

2008-12-22  Paul Thomas  pa...@gcc.gnu.org

PR fortran/35780
* gfortran.dg/alloc_comp_optional_1.f90: New test.

! { dg-do run }
! Tests the fix for PR38602, a regression caused by a modification
! to the nulling of INTENT_OUT dummies with allocatable components
! that caused a segfault with optional arguments.
!
! Contributed by David Kinniburgh davidkinnibu...@yahoo.co.uk
!
program test_iso
  type ivs
 character(LEN=1), dimension(:), allocatable :: chars
  end type ivs
  type(ivs) :: v_str
  integer :: i
  call foo(v_str, i)
  if (v_str%chars(1) .ne. a) call abort
  if (i .ne. 0) call abort
  call foo(flag = i)
  if (i .ne. 1) call abort
contains
  subroutine foo (arg, flag)
type(ivs), optional, intent(out) :: arg
integer :: flag
if (present(arg)) then
  arg = ivs([(char(i+96), i = 1,10)])
  flag = 0
else
  flag = 1
end if
  end subroutine
end


-- 

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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread pault at gcc dot gnu dot org


--- Comment #9 from pault at gcc dot gnu dot org  2008-12-22 20:03 ---
Created an attachment (id=16970)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16970action=view)
The real patch for the PR without the extra bits:-)

Have eliminated the extra bits on the patch - sorry about that!

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

  Attachment #16969|0   |1
is obsolete||


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread jvdelisle at gcc dot gnu dot org


--- Comment #10 from jvdelisle at gcc dot gnu dot org  2008-12-22 20:53 
---
Regression testing now and will commit when complete.


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread jvdelisle at gcc dot gnu dot org


--- Comment #11 from jvdelisle at gcc dot gnu dot org  2008-12-22 23:39 
---
Patch committed, fixed on trunk, 4.4


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread mikael at gcc dot gnu dot org


--- Comment #12 from mikael at gcc dot gnu dot org  2008-12-23 00:18 ---
(In reply to comment #11)
 Patch committed, fixed on trunk, 4.4
I think it was the wrong PR number (35780 instead of PR34820).


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread jvdelisle at verizon dot net


--- Comment #13 from jvdelisle at verizon dot net  2008-12-23 01:11 ---
Subject: Re:  [regression 4.4] segfault - optional
 arguments, generics, interface problem, iso_varying_string ??

mikael at gcc dot gnu dot org wrote:
 --- Comment #12 from mikael at gcc dot gnu dot org  2008-12-23 00:18 
 ---
 (In reply to comment #11)
 Patch committed, fixed on trunk, 4.4
 I think it was the wrong PR number (35780 instead of PR34820).
 
 
Yes, I will fix the log.


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread jvdelisle at gcc dot gnu dot org


--- Comment #14 from jvdelisle at gcc dot gnu dot org  2008-12-23 01:33 
---
Subject: Bug 38602

Author: jvdelisle
Date: Tue Dec 23 01:32:33 2008
New Revision: 142898

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142898
Log:
2008-12-22  Paul Thomas  pa...@gcc.gnu.org

PR fortran/38602
* trans-decl.c (init_intent_out_dt): Allow for optional args.

Modified:
branches/gcc-4_3-branch/gcc/fortran/ChangeLog
branches/gcc-4_3-branch/gcc/fortran/trans-decl.c


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread jvdelisle at gcc dot gnu dot org


--- Comment #15 from jvdelisle at gcc dot gnu dot org  2008-12-23 01:35 
---
Subject: Bug 38602

Author: jvdelisle
Date: Tue Dec 23 01:34:13 2008
New Revision: 142899

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142899
Log:
2008-12-22  Paul Thomas  pa...@gcc.gnu.org

PR fortran/38602
* gfortran.dg/alloc_comp_optional_1.f90: New test.

Added:
branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/alloc_comp_optional_1.f90
Modified:
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-22 Thread jvdelisle at gcc dot gnu dot org


--- Comment #16 from jvdelisle at gcc dot gnu dot org  2008-12-23 02:10 
---
Fixed on 4.3, closing.  Thanks everyone for the help with this.


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.3.4


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-21 Thread kargl at gcc dot gnu dot org


--- Comment #2 from kargl at gcc dot gnu dot org  2008-12-22 00:28 ---
Please attach long files instead of embedded the code within the bug report.
It makes it harder to copy and paste from a browser.

The code works with 4.3.3, so this is a regression.  Here's a reduced 
testcase that needs to be linked to iso_varying_string.  Save this 
as lkl.f90 and compile.

program test_iso

   use iso_varying_string

   implicit none

   type(varying_string) :: v_str
   integer  :: i, ios
   character(len=1) :: newlinechar=;

   open (unit=1,file='lkl.f90', status='OLD')

   i = 0

   do
  CALL get(unit=1,string=v_str, set=newlinechar, iostat=ios)
  if (ios.GT.0) stop 'Error on vs2 read'
  if (ios.EQ.-1) exit
  i = i + 1
  print *, i, trim(char(v_str))
   end do
end


-- 

kargl at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Priority|P3  |P4
   Last reconfirmed|-00-00 00:00:00 |2008-12-22 00:28:42
   date||
Summary|run time error (crash) -|[regression 4.4] segfault -
   |optional arguments, |optional arguments,
   |generics, interface problem,|generics, interface problem,
   |iso_varying_string ??   |iso_varying_string ??


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-21 Thread kargl at gcc dot gnu dot org


--- Comment #3 from kargl at gcc dot gnu dot org  2008-12-22 00:30 ---
Created an attachment (id=16956)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16956action=view)
iso_varying_string code.

Here's the iso_varying_string.f90 code as an attachment.


-- 


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



[Bug fortran/38602] [regression 4.4] segfault - optional arguments, generics, interface problem, iso_varying_string ??

2008-12-21 Thread jvdelisle at gcc dot gnu dot org


--- Comment #4 from jvdelisle at gcc dot gnu dot org  2008-12-22 05:18 
---
The test case passes at r142147 and fails at r142148

The patch to pr34820 caused this regression

PR fortran/34820
* trans-expr.c (gfc_conv_function_call): Remove all code to
deallocate intent out derived types with allocatable
components.
(gfc_trans_assignment_1): An assignment from a scalar to an
array of derived types with allocatable components, requires
a deep copy to each array element and deallocation of the
converted rhs expression afterwards.
* trans-array.c : Minor whitespace.
* trans-decl.c (init_intent_out_dt): Add code to deallocate
allocatable components of derived types with intent out.
(generate_local_decl): If these types are unused, set them
referenced anyway but allow the uninitialized warning.


-- 


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