This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/36319] New: Segfault with wide characters in DATA


The following code draws a compile time segfault.  This is derived from
data_array_1.f90 that I have modified while working on wide character I/O.

program chkdata
    integer, parameter,dimension(4) :: myint = [ 4,3,2,1 ]
    character(len=3, kind=4), parameter, dimension(3) :: mychar = [ "abc",
"def", "ghi" ]
    character(50) :: buffer
    integer :: a(5)
    character(5) :: c(5)
    data a(1:2) / myint(4), myint(2) /
    data a(3:5) / myint(1), myint(3), myint(1) /
    data c / mychar(1), mychar(2), mychar(3), mychar(1), mychar(2) /
    buffer = ""
    if (any(a.ne.[1,3,4,2,4])) call abort
    write(buffer,'(5(a))')c
    if (buffer.ne."abc  def  ghi  abc  def  ") call abort
end program chkdata

Starting program: /home/jerry/bin/f951 test2.f90

Program received signal SIGSEGV, Segmentation fault.
0x0000003ff067b40b in memcpy () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install gmp.x86_64 mpfr.x86_64
(gdb) bt
#0  0x0000003ff067b40b in memcpy () from /lib64/libc.so.6
#1  0x000000000046875e in gfc_convert_char_constant (e=0x106d6d0, 
    type=<value optimized out>, kind=4)
    at ../../gcc44/gcc/fortran/simplify.c:4832
#2  0x000000000042a901 in do_simplify (specific=0x1068ba0, e=0x106d9a0)
    at ../../gcc44/gcc/fortran/intrinsic.c:3286
#3  0x000000000042ac11 in gfc_convert_chartype (expr=0x106d9a0, 
    ts=0x7ffffad42a58) at ../../gcc44/gcc/fortran/intrinsic.c:3820
#4  0x000000000042286d in gfc_check_assign (lvalue=0x7ffffad42a50, 
    rvalue=0x106d9a0, conform=1) at ../../gcc44/gcc/fortran/expr.c:2855
#5  0x00000000004229a0 in gfc_check_assign_symbol (sym=0x106d530, 
    rvalue=0x106d9a0) at ../../gcc44/gcc/fortran/expr.c:3029
#6  0x000000000041963d in add_init_expr_to_sym (name=<value optimized out>, 
    initp=0x7ffffad42c50, var_locus=0x7ffffad42c10)
    at ../../gcc44/gcc/fortran/decl.c:1231
#7  0x000000000041a01d in gfc_match_data_decl ()
    at ../../gcc44/gcc/fortran/decl.c:1776
#8  0x00000000004512d3 in match_word (str=0x2aaaaf664010 "", 
    subr=0x419da0 <gfc_match_data_decl>, old_locus=0x7ffffad42cd0)
    at ../../gcc44/gcc/fortran/parse.c:64
#9  0x00000000004518a3 in decode_statement ()
    at ../../gcc44/gcc/fortran/parse.c:280
#10 0x000000000045292b in next_statement ()


-- 
           Summary: Segfault with wide characters in DATA
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jvdelisle at gcc dot gnu dot org
  GCC host triplet: x86_64-unknown-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]