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: online archive of my book's examples


On 09/12/2011 06:08 PM, Janus Weil wrote:
Has anyone else here tried to build the archive with GCC trunk? Or 4.6?

I just tried with the trunk - and it works with the attach patch.


With 4.6 I somehow get errors of this kind:
/home/jweil/fort/Damian/online_archive/ssdSource/chapter06/semidiscrete_cpp/main.cpp:
In function ‘int main()’:
/home/jweil/fort/Damian/online_archive/ssdSource/chapter06/semidiscrete_cpp/main.cpp:53:12:
error: ‘EXIT_FAILURE’ was not declared in this scope

That's a bug in the program as it does not include <stdlib.h>. In previous version of GCC, several standard libraries were included by "#include <some C++ header>". However, that has been improved in recent GCC versions with the side effect that broken C++ programs now fail.


(I think the clean up is needed as without some valid C++ programs fail. Additionally, it speeds up the compilation if no headers are included unnecessarily. Downside: It breaks several existing [invalid] C++ programs.)

I think the issues
those examples identify are ones we have reported to you and the
corresponding bugs are listed in the archive's top-level README.txt file,
but if any of you tries to build archive and I can be of help in
understanding or isolating any issues you find, please let me know.
To summarize it, the missing F03/F08 features are:

  * derived-type 'constructors'
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39427)
  * finalization (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336)
  * non-trivial type-bound operator calls
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46328)
  * allocatable character lengths
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170)
  * coarrays (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18918)
In fact I think it would be nice if we could manage to implement some
of those for the 4.7 release. There were preliminary patches already
for the first two, and I might have a look at the third one soon. Also
I think also coarrays have made a bit of progress on the trunk, but
I'm not sure if it's enough for your examples (I haven't tried it
yet).

Regarding the constructor: Maybe. I tried my old patch with the current trunk - and it fails with 274 test cases. I think the main issue is related to module loading.


Regarding FINALIZE: No chance. That's a huge project and I do not see anyone who is currently working on it.

Non-trivial type-bound operator calls: I leave that to you ...

Coarrays: The example uses polymorphic coarrays. As soon as polymophic arrays work, I will try to implement them. I think Paul will implement polymorphic arrays for 4.7 - thus the chance is relatively high that it will be implemented for 4.7.

Tobias
diff -ur ../orig/online_archive/ssdSource/chapter06/common_cpp/Ref.h ssdSource/chapter06/common_cpp/Ref.h
--- ../orig/online_archive/ssdSource/chapter06/common_cpp/Ref.h	2011-08-24 21:34:41.000000000 +0200
+++ ssdSource/chapter06/common_cpp/Ref.h	2011-09-12 18:42:05.590044100 +0200
@@ -41,19 +41,19 @@
   Ref() {}
 
   Ref(const Self_t &other) {
-    assign(other.ptr());
+    this->assign(other.ptr());
     if(pointer<T>::ptr() != NULL) pointer<T>::ptr()->grab();
   }
 
   template <typename Other>
   Ref(Ref<Other> other){
-    assign(other.ptr());
+    this->assign(other.ptr());
     if(pointer<T>::ptr() != NULL) pointer<T>::ptr()->grab();
   }
 
   template <typename Other>
   Ref(Other *other) {
-    assign(other);
+    this->assign(other);
     if(pointer<T>::ptr() != NULL) pointer<T>::ptr()->grab();
   }
 
@@ -64,7 +64,7 @@
   Self_t& operator=(const Self_t &other) {
     if(other.ptr() != pointer<T>::ptr()) {
       if(pointer<T>::ptr() != NULL) pointer<T>::ptr()->release();
-      assign( other.ptr());
+      this->assign( other.ptr());
       if(pointer<T>::ptr() != NULL) pointer<T>::ptr()->grab();
     }
     return *this;
@@ -73,7 +73,7 @@
   Self_t& operator=(T *other) {
     if(pointer<T>::ptr() != other) {
       if(pointer<T>::ptr() != NULL) pointer<T>::ptr()->release();
-      assign( other);
+      this->assign( other);
       if(pointer<T>::ptr() != NULL) pointer<T>::ptr()->grab();
     }
     return *this;
diff -ur ../orig/online_archive/ssdSource/chapter06/semidiscrete_cpp/main.cpp ssdSource/chapter06/semidiscrete_cpp/main.cpp
--- ../orig/online_archive/ssdSource/chapter06/semidiscrete_cpp/main.cpp	2011-08-14 05:17:55.000000000 +0200
+++ ssdSource/chapter06/semidiscrete_cpp/main.cpp	2011-09-12 18:44:20.402565939 +0200
@@ -27,6 +27,7 @@
 #include "lorenz.h"
 #include "fmt.h"
 #include <iostream>
+#include <stdlib.h>
 
 int main () {
   using namespace std;

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