There are two C_LOC issues related to not going through all expr->ref. The
second one was found by Scot Breitenfeld (in PR 36771 comment 4), the first one
I found while trying to reduce it.
* * *
use iso_c_binding
character(len=2),target :: str(2)
print *, c_loc(str(1))
end
Result:
Gives no error
Expected:
Error: CHARACTER argument 'str' to 'c_loc' at (1) must have a length of 1
Using C_LOC(str) an error is printed. Seemingly, is_scalar_expr_ptr either does
not work or it is the wrong function for the check in resolve.c's
gfc_iso_c_func_interface.
* * *
The following program gives:
Internal Error at (1):
Unexpected expression reference type in gfc_iso_c_func_interface
The problem also occurs in resolve.c's gfc_iso_c_func_interface, though at a
different line.
USE ISO_C_BINDING
TYPE test
CHARACTER(LEN=2), DIMENSION(1:2) :: c
INTEGER(C_INT) :: i
END TYPE test
TYPE(test), TARGET :: chrScalar
TYPE(C_PTR) :: f_ptr
f_ptr = c_loc(chrScalar%c(1)(1:1))
end
--
Summary: ICE with C_LOC in resolve.c due to not properly going
through expr->ref
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38536