This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: I'm back -- ISO C binding merge plans.


Hi Steve,

Steve Kargl wrote:
> I'm back from my recent foray into ocean acoustics.  Although my
> gfortran time over the next few weeks is going to be small, I intend
> to constantly merge mainline into my local fortran-experiments
>   
If the fortran-experiments branch is up to date, one can use
diff -x .svn -u -rN
to compare the branch with the trunk.

> and hopefully cut a ISO C binding patch against mainline for submission.
> Chris has done an outstanding job on implementing this feature, and
> think it is time to integrate it into gfortran 4.3.  Yes, there are
> some missing parts (eg procedure pointer) and there may be some things
> that need so cleanup, but it is time.  I would like to see Chris'
> code committed to mainline in the next few weeks.
>   
That would be great. One thing I would like to see be fixed before the
merge is the namespacing FX mentioned the other day.
(Chris uses in libgfortran the ISO_C_BINDING_PREFIX macro, which should
be converted into export_proto/iexport_proto/export/iexport macros.)

In addition, one needs to change the kind test as it currently fails
(C_INT_FAST*_T is not available). I have a modified test (see
attachment), ok for check in?

(Could you check whether loop_nest_1.f90 and pr29581.f90 fail for you?
Chris had problems with those whereas I couldn't reproduce the problems.)

Otherwise, my status is at
http://gcc.gnu.org/wiki/Fortran2003Bind_C

> Tobias, can you send me a short synopsis of your experience with previous svnmerge use?
>   
In general, svnmerge.py seems to work well:
svnmerge.py avail # list available revision
svnmerge.py merge -r '<revision to be merged>'
Afterwards one should check whether there are any conflicts:
svn status|grep ^C
and one should bootstrap/regtest.
The commit message should be something like "Merged from the trunk (rev.
122018-122208)." and not the content of the svnmerge* file (otherwise
one spams bugzilla.)

The only thing I dislike about svnmerge.py is: One can not add or remove
further revisions after a merge. As the trunk was quite often broken in
January, I had to "svn revert -R" + "svnmerge.py merge" + bootstrap a
couple of times and both svnmerge.py and bootstrapping is slow.

Tobias
2007-04-01  Tobias Burnus  <burnus@net-b.de>

* iso-c-binding.def: Add PR reference.
* gfortran.dg/c_kind_params.f90: Make test runable.
* gfortran.dg/c_kinds.c: Ditto.

Index: gcc/fortran/iso-c-binding.def
===================================================================
--- gcc/fortran/iso-c-binding.def	(Revision 123090)
+++ gcc/fortran/iso-c-binding.def	(Arbeitskopie)
@@ -76,6 +76,7 @@
 NAMED_INTCST (ISOCBINDING_INT_LEAST64_T, "c_int_least64_t", \
               get_int_kind_from_minimal_width (64))
 
+/* TODO: Implement c_int_fast*_t. Depends on PR 448.  */ 
 NAMED_INTCST (ISOCBINDING_INT_FAST8_T, "c_int_fast8_t", -2)
 NAMED_INTCST (ISOCBINDING_INT_FAST16_T, "c_int_fast16_t", -2)
 NAMED_INTCST (ISOCBINDING_INT_FAST32_T, "c_int_fast32_t", -2)
Index: gcc/testsuite/gfortran.dg/c_kind_params.f90
===================================================================
--- gcc/testsuite/gfortran.dg/c_kind_params.f90	(Revision 123087)
+++ gcc/testsuite/gfortran.dg/c_kind_params.f90	(Arbeitskopie)
@@ -3,14 +3,17 @@
 ! { dg-options "-w -std=c99" }
 ! the -w option is needed to make f951 not report a warning for 
 ! the -std=c99 option that the C file needs.
+!
+! Note: int_fast*_t currently not supported, cf. PR 448.
 module c_kind_params
   use, intrinsic :: iso_c_binding
+  implicit none
 
 contains
   subroutine param_test(my_short, my_int, my_long, my_long_long, &
-       my_int8_t, my_int_least8_t, my_int_fast8_t, my_int16_t, &
-       my_int_least16_t, my_int_fast16_t, my_int32_t, my_int_least32_t, &
-       my_int_fast32_t, my_int64_t, my_int_least64_t, my_int_fast64_t, &
+       my_int8_t, my_int_least8_t, my_int16_t, &
+       my_int_least16_t, my_int32_t, my_int_least32_t, &
+       my_int64_t, my_int_least64_t, &
        my_intmax_t, my_intptr_t, my_float, my_double, my_long_double, &
        my_char, my_bool) bind(c)
     integer(c_short), value :: my_short
@@ -19,16 +22,16 @@
     integer(c_long_long), value :: my_long_long
     integer(c_int8_t), value :: my_int8_t
     integer(c_int_least8_t), value :: my_int_least8_t
-    integer(c_int_fast8_t), value :: my_int_fast8_t
+!   integer(c_int_fast8_t), value :: my_int_fast8_t
     integer(c_int16_t), value :: my_int16_t
     integer(c_int_least16_t), value :: my_int_least16_t
-    integer(c_int_fast16_t), value :: my_int_fast16_t
+!   integer(c_int_fast16_t), value :: my_int_fast16_t
     integer(c_int32_t), value :: my_int32_t
     integer(c_int_least32_t), value :: my_int_least32_t
-    integer(c_int_fast32_t), value :: my_int_fast32_t
+!   integer(c_int_fast32_t), value :: my_int_fast32_t
     integer(c_int64_t), value :: my_int64_t
     integer(c_int_least64_t), value :: my_int_least64_t
-    integer(c_int_fast64_t), value :: my_int_fast64_t
+!   integer(c_int_fast64_t), value :: my_int_fast64_t
     integer(c_intmax_t), value :: my_intmax_t
     integer(c_intptr_t), value :: my_intptr_t
     real(c_float), value :: my_float
@@ -37,37 +40,36 @@
     character(c_char), value :: my_char
     logical(c_bool), value :: my_bool
 
-    print *, 'my_short is:              ', my_short
-    print *, 'my_int is:                ', my_int
-    print *, 'my_long is:               ', my_long
-    print *, 'my_long_long is:          ', my_long_long
-    print *
-    print *, 'my_int8_t is:             ', my_int8_t
-    print *, 'my_int_least8_t is:       ', my_int_least8_t
-    print *, 'my_int_fast8_t is:        ', my_int_fast8_t
-    print *
-    print *, 'my_int16_t is:            ', my_int16_t
-    print *, 'my_int_least16_t is:      ', my_int_least16_t
-    print *, 'my_int_fast16_t is:       ', my_int_fast16_t
-    print *
-    print *, 'my_int32_t is:            ', my_int32_t
-    print *, 'my_int_least32_t is:      ', my_int_least32_t
-    print *, 'my_int_fast32_t is:       ', my_int_fast32_t
-    print *
-    print *, 'my_int64_t is:            ', my_int64_t
-    print *, 'my_int_least64_t is:      ', my_int_least64_t
-    print *, 'my_int_fast64_t is:       ', my_int_fast64_t
-    print *
-    print *, 'my_intmax_t is:           ', my_intmax_t
-    print *, 'my_intptr_t is:           ', my_intptr_t
-    print *
-    print *, 'my_float is:              ', my_float
-    print *, 'my_double is:             ', my_double
-    print *, 'my_long_double is:        ', my_long_double
-    print *
-    print *, 'my_char is:               ', my_char
-    print *, 'my_bool is:               ', my_bool
+    if(my_short     /= 1_c_short)     call abort()
+    if(my_int       /= 2_c_int)       call abort()
+    if(my_long      /= 3_c_long)      call abort()
+    if(my_long_long /= 4_c_long_long) call abort()
 
+    if(my_int8_t      /= 1_c_int8_t)        call abort()
+    if(my_int_least8_t  /= 2_c_int_least8_t ) call abort()
+    print *, 'c_int_fast8_t is:        ', c_int_fast8_t
+
+    if(my_int16_t     /= 1_c_int16_t)       call abort()
+    if(my_int_least16_t /= 2_c_int_least16_t) call abort()
+    print *, 'c_int_fast16_t is:       ', c_int_fast16_t
+
+    if(my_int32_t     /= 1_c_int32_t)       call abort()
+    if(my_int_least32_t /= 2_c_int_least32_t) call abort()
+    print *, 'c_int_fast32_t is:       ', c_int_fast32_t
+
+    if(my_int64_t     /= 1_c_int64_t)       call abort()
+    if(my_int_least64_t /= 2_c_int_least64_t) call abort()
+    print *, 'c_int_fast64_t is:       ', c_int_fast64_t
+
+    if(my_intmax_t /= 1_c_intmax_t) call abort()
+    if(my_intptr_t /= 4_c_intptr_t) call abort()
+
+    if(my_float       /= 1.0_c_float) call abort()
+    if(my_double      /= 2.0_c_double) call abort()
+    if(my_long_double /= 3.0_c_long_double) call abort()
+
+    if(my_char        /= c_char_'y') call abort()
+    if(my_bool      .neqv. .true._c_bool) call abort()
   end subroutine param_test
     
 end module c_kind_params
Index: gcc/testsuite/gfortran.dg/c_kinds.c
===================================================================
--- gcc/testsuite/gfortran.dg/c_kinds.c	(Revision 123087)
+++ gcc/testsuite/gfortran.dg/c_kinds.c	(Arbeitskopie)
@@ -3,14 +3,15 @@
 
 #include <stdint.h>
 
+/* Note: int_fast*_t is currently not supported, cf. PR 448 */
 void param_test(short int my_short, int my_int, long int my_long,
                 long long int my_long_long, int8_t my_int8_t,
-                int_least8_t my_int_least8_t, int_fast8_t my_int_fast8_t,
+                int_least8_t my_int_least8_t, /*int_fast8_t my_int_fast8_t,*/
                 int16_t my_int16_t, int_least16_t my_int_least16_t,
-                int_fast16_t my_int_fast16_t, int32_t my_int32_t,
-                int_least32_t my_int_least32_t, int_fast32_t my_int_fast32_t,
+                /*int_fast16_t my_int_fast16_t,*/ int32_t my_int32_t,
+                int_least32_t my_int_least32_t, /*int_fast32_t my_int_fast32_t,*/
                 int64_t my_int64_t, int_least64_t my_int_least64_t,
-                int_fast64_t my_int_fast64_t, intmax_t my_intmax_t,
+                /*int_fast64_t my_int_fast64_t,*/ intmax_t my_intmax_t,
                 intptr_t my_intptr_t, float my_float, double my_double,
                 long double my_long_double, char my_char, _Bool my_bool);
    
@@ -42,12 +43,12 @@
    _Bool my_bool = 1;
 
    param_test(my_short, my_int, my_long, my_long_long, my_int8_t,
-              my_int_least8_t, my_int_fast8_t, my_int16_t,
-              my_int_least16_t, my_int_fast16_t, my_int32_t,
-              my_int_least32_t, my_int_fast32_t, my_int64_t,
-              my_int_least64_t, my_int_fast64_t, my_intmax_t,
+              my_int_least8_t, /*my_int_fast8_t,  */ my_int16_t,
+              my_int_least16_t,/* my_int_fast16_t,*/ my_int32_t,
+              my_int_least32_t,/* my_int_fast32_t,*/ my_int64_t,
+              my_int_least64_t,/* my_int_fast64_t,*/ my_intmax_t,
               my_intptr_t, my_float, my_double, my_long_double, my_char,
               my_bool);
-   
+
    return 0;
 }/* end main() */

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