[Bug fortran/66238] New: C/Fortran interoperability broken with -flto
dominiq at lps dot ens.fr
gcc-bugzilla@gcc.gnu.org
Thu May 21 10:13:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66238
Bug ID: 66238
Summary: C/Fortran interoperability broken with -flto
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: dominiq at lps dot ens.fr
CC: hubicka at gcc dot gnu.org
Target Milestone: ---
When running the gfortran test suite with -flto, I get the following new
failures since r223288
FAIL: gfortran.dg/bind_c_usage_16.f03 -g -flto (test for excess errors)
FAIL: gfortran.dg/bind_c_usage_17.f90 -g -flto (test for excess errors)
FAIL: gfortran.dg/c_char_tests.f03 -g -flto (test for excess errors)
FAIL: gfortran.dg/proc_ptr_7.f90 -g -flto (test for excess errors)
The errors are
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_16_c.c:8:6: warning:
type of 'returnA' does not match original declaration [-Wlto-type-mismatch]
char returnA(char *);
^
lto1: note: return value type mismatch
lto1: note: type 'unsigned char' should match type 'char'
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_16.f03:12:0: note: 'bar'
was previously declared here
function bar(x) bind(c, name="returnA")
^
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_16_c.c:9:6: warning:
type of 'returnB' does not match original declaration [-Wlto-type-mismatch]
char returnB(void);
^
lto1: note: return value type mismatch
lto1: note: type 'unsigned char' should match type 'char'
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_16.f03:17:0: note: 'foo'
was previously declared here
function foo() bind(c, name="returnB")
^
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_17.f90:24:0: warning:
type of 'cdir' does not match original declaration [-Wlto-type-mismatch]
str1 = cdir()
^
lto1: note: return value type mismatch
lto1: note: type 'char' should match type 'unsigned char'
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/bind_c_usage_17_c.c:4:6: note: 'cdir'
was previously declared here
char cdir(void){return '/';}
^
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/c_char_driver.c:1:6: warning: type of
'param_test' does not match original declaration [-Wlto-type-mismatch]
void param_test(char my_char, char my_char_2);
^
lto1: note: type mismatch in parameter 1
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/c_char_tests.f03:10:0: note:
'param_test' was previously declared here
subroutine param_test(my_char, my_char_2) bind(c)
^
and
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/proc_ptr_7.f90:22:0: warning: type of
'assignf' does not match original declaration [-Wlto-type-mismatch]
call assignF(ptr)
^
lto1: note: type mismatch in parameter 1
/opt/gcc/_clean/gcc/testsuite/gfortran.dg/proc_ptr_7.c:8:6: note: 'assignf_'
was previously declared here
void assignf_(int(**ptr)(void)) {
^
The first two failures can be fixed by replacing 'char' with 'unsigned char' in
the C files. I don't know how to fix the two other ones.
More information about the Gcc-bugs
mailing list