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/38849] New: ICE in fold_convert with C_F_POINTER and C binding


This program gives an ICE when compiled with gfortran 4.4 trunk:

FUNCTION myfortran_error ()
  USE ISO_C_BINDING
  IMPLICIT NONE
  CHARACTER(LEN=5) :: myfortran_error
  CHARACTER(KIND=C_CHAR, LEN=5), POINTER :: chararr
  TYPE(C_PTR) :: c_str

  c_str = C_NULL_PTR
  CALL C_F_POINTER (c_str, chararr)

  myfortran_error(1:1) = chararr(1)
END FUNCTION myfortran_error

bash-3.2# gfortran-dev reduced.f03 
reduced.f03: In function 'myfortran_error':
reduced.f03:8: internal compiler error: in fold_convert, at fold-const.c:2649
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

gfortran 4.3 compiles it but fails with an undefined reference to `chararr_'. 
Actually I'm not proficient with C binding, so I would not bet the code above
is legal or doing "correct" things with the pointers... However, it should not
ICE.


-- 
           Summary: ICE in fold_convert with C_F_POINTER and C binding
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: domob at gcc dot gnu dot org


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


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