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/66238] C/Fortran interoperability broken with -flto


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66238

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-06
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The two first tests are fixed with the patch

[Book15] gcc/work% diff -up
../_clean/gcc/testsuite/gfortran.dg/bind_c_usage_16_c.c
gcc/testsuite/gfortran.dg/bind_c_usage_16_c.c
--- ../_clean/gcc/testsuite/gfortran.dg/bind_c_usage_16_c.c     2009-11-25
18:17:40.000000000 +0100
+++ gcc/testsuite/gfortran.dg/bind_c_usage_16_c.c       2015-09-05
22:17:49.000000000 +0200
@@ -5,13 +5,13 @@

 #include <stdlib.h>

-char returnA(char *);
-char returnB(void);
+unsigned char returnA(unsigned char *);
+unsigned char returnB(void);
 void test(void);

 int main()
 {
-  char c;
+  unsigned char c;
   c = 'z';
   c = returnA(&c);
   if (c != 'A') abort();
[Book15] gcc/work% diff -up
../_clean/gcc/testsuite/gfortran.dg/bind_c_usage_17_c.c
gcc/testsuite/gfortran.dg/bind_c_usage_17_c.c
--- ../_clean/gcc/testsuite/gfortran.dg/bind_c_usage_17_c.c     2009-11-25
18:17:47.000000000 +0100
+++ gcc/testsuite/gfortran.dg/bind_c_usage_17_c.c       2015-09-05
22:19:22.000000000 +0200
@@ -1,4 +1,4 @@
 /* PR fortran/37201.
    Linked with bind_c_usage_17.f90.  */

-char cdir(void){return '/';}
+unsigned char cdir(void){return '/';}

> For c_char_tests, a possible problem is the declaration of arguments as
>   character(c_char), value :: foo
> This declares a character of len c_char and default kind as far as I know.
> According to
> https://gcc.gnu.org/onlinedocs/gfortran/Interoperable-Subroutines-and-Functions.html
> the canonical declaration is rather:
>  character(kind=c_char) :: foo(*)
> With the value attribute, I don't know how it should be handled though.

Either I don't understand this or it is not working.


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