Bug 31306 - ICE with implicit character variables
Summary: ICE with implicit character variables
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Jerry DeLisle
URL:
Keywords: ice-on-invalid-code
: 31294 32488 (view as bug list)
Depends on:
Blocks: Fortran_character
  Show dependency treegraph
 
Reported: 2007-03-22 00:01 UTC by Francois-Xavier Coudert
Modified: 2007-10-27 18:29 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-10-20 23:10:32


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2007-03-22 00:01:27 UTC
No time to reduce this one, filing it so it doesn't get lost:

module cyclic
   implicit none
   contains
      function ouch(x,y)
         implicit character(len(ouch)) (x)
         implicit character(len(x)+1) (y)
         implicit character(len(y)-1) (o)
         intent(in) x,y
         character(len(y)-1) ouch
         integer i

         do i = 1, len(ouch)
            ouch(i:i) = achar(ieor(iachar(x(i:i)),iachar(y(i:i))))
         end do
      end function ouch
end module cyclic

program test
   use cyclic
   implicit none

   write(*,*) ouch('YOW!','     ')   
end program test
Comment 1 Paul Thomas 2007-03-23 12:55:58 UTC
This is a case of cyclic specification so I have changed the keyword to ice-on-ivalid.

Confirmed

Paul 
Comment 2 Tobias Schlüter 2007-03-25 23:07:50 UTC
*** Bug 31294 has been marked as a duplicate of this bug. ***
Comment 3 Jerry DeLisle 2007-05-02 04:57:39 UTC
backtrace is uggly, repeats the following for a long long time

#3554 0x000000000043c63e in mio_expr (ep=<value optimized out>)
    at ../../gcc43/gcc/fortran/module.c:2133
#3555 0x000000000043c779 in mio_expr (ep=0xef2f60)
    at ../../gcc43/gcc/fortran/module.c:2685
#3556 0x000000000043c8dd in mio_charlen (clp=0xf31728)
    at ../../gcc43/gcc/fortran/module.c:1769
#3557 0x000000000043c979 in mio_typespec (ts=0xf31718)
    at ../../gcc43/gcc/fortran/module.c:1831
#3558 0x000000000043c393 in mio_expr (ep=0xef2a38)
    at ../../gcc43/gcc/fortran/module.c:2649
#3559 0x000000000043c9ad in mio_actual_arg (a=<value optimized out>)
    at ../../gcc43/gcc/fortran/module.c:2118
#3560 0x000000000043c63e in mio_expr (ep=<value optimized out>)
    at ../../gcc43/gcc/fortran/module.c:2133
Comment 4 Daniel Franke 2007-06-25 11:33:15 UTC
*** Bug 32488 has been marked as a duplicate of this bug. ***
Comment 5 Daniel Franke 2007-06-25 11:43:07 UTC
The problem of the cyclic definition is (more or less), the same described in
PR24886, isn't it? E.g. replace

  implicit character(len(ouch)) (x)
  implicit character(len(x)+1) (y)
  intent(in) x,y

by

  character(len=*), intent(in)        :: x  ! or character(len=n), n integer
  character(len=len(x)+1), intent(in) :: y

to get a working binary. My meaning: "len(ouch)" is not known when defining the length of the dummy argument x, thus it is a length that's different from the actual length.
Comment 6 patchapp@dberlin.org 2007-10-20 05:45:22 UTC
Subject: Bug number PR31306

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/2007-10/msg01207.html
Comment 7 Jerry DeLisle 2007-10-27 18:00:16 UTC
Subject: Bug 31306

Author: jvdelisle
Date: Sat Oct 27 17:59:59 2007
New Revision: 129685

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129685
Log:
2007-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/31306
	* decl.c (char_len_param_value): Add check for conflicting attributes of
	function argument.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c

Comment 8 Jerry DeLisle 2007-10-27 18:25:55 UTC
Subject: Bug 31306

Author: jvdelisle
Date: Sat Oct 27 18:25:43 2007
New Revision: 129686

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129686
Log:
2007-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/31306
	* gfortran.dg/argument_check_7.f90: New test.
	* gfortran.dg/argument_check_8.f90: New test.

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

Comment 9 Jerry DeLisle 2007-10-27 18:29:16 UTC
Fixed and closing.