Fortran

Fail to link 64-bit Code

I have a working 32-bit software library written in Fortran with low-level stuff in C/C++ It has worked for years.

It is fine.

When I re-build the library in 64-bit mode, none of the C functions are linked in. I've checked the linker options, and they all seem to be right. The project appears to be referencing the 64-bit libraries.

Would someone mind just looking some sample  INTERFACE code and tell me whether there is anything at all that would cause a problem 

VALUE Attribute Vs INTENT(IN)

This is just a general question for peoples opinions on the VALUE attribute used in subroutines. I know it The VALUE attributie is sometimes necessary for interoperability with C, but my interest is what would be the benefit beyond that compared to INTENT(IN). I am assuming  that it makes no sense to have both at the same time.

 

Below is a simple example of what I am talking about

SUBROUTINE DOUBLER(X,Y) 
  REAL,      VALUE::X
  REAL,INTENT(OUT)::Y
  Y=2.*X
END SUBROUTINE

or

inconsistent treatment of TYPE vs. REAL in 'stream' write with Intel big-endian I/O conversion

I'm seeing different bit patterns when I write a REAL variable to file as component of a TYPE as opposed to when it's just a REAL in stream output while using the -convert big_endian option.

Given the following small program, which opens a file in 'stream' access mode and the proceeds to write two REAL's:

$ cat stream-write.f90
PROGRAM foo
  IMPLICIT NONE
  TYPE bar
    real :: x
  END TYPE bar
  INTEGER, PARAMETER :: file_id = 20
  INTEGER :: ierror
  REAL :: y
  TYPE(bar) :: z

Deferred length string component: segmentation fault

In a project I am working on, I changed a fixed length string in a structure within a module to a deferred length string and the result was an internal compiler error (the code compiled and ran without issue before the change).  I cannot reproduce the internal compiler error with a simple case, but I do get a segmentation fault in the below program when it hits the WRITE() statement.  It is unclear to me what the issue is or if this is even related to the internal compiler error I was trying to reproduce.  When compiling with '-std03', I get "warning #5436: Overlapping storage initializatio

Format label and Contains block

Hi all,

i'm working on a main routine with many other subroutine in a contains block. In the main one, I defined some format labels but I can't use them in the contains block : they are no more defined. At the moment, I avoid this problem by redefined format labels in each subroutine in the contains block ; but this solution isn't really suitable. Is there a way to define these labels only once ?

Thanks,

Sebastien.

ifort 11.1 and O2 optimization: wrong results

Dear all,

The code in question:

!##################

! MODULE FOR TYPES

!##################

MODULE mod_types

  IMPLICIT NONE

  PRIVATE

  PUBLIC :: type_glob, type_geom, type_edge

  !-------------

  ! Type node

  !-------------

  TYPE type_node

     REAL :: X = 0.D0

     REAL :: Y = 0.D0

     

  END type type_node

 

!$OMP SIMD or !DIR$ SIMD ?

Hi,

I have two quick questions regarding using SIMD directives.

(1) I am currently using !DIR$ SIMD to help the compiler to vectorize the loops. But I just noticed that in OpenMP 4.0 we have the following directives:

!$OMP SIMD

!$OMP END SIMD

I am a little bit confused about why we need !$OMP SIMD since !DIR$ SIMD works for both non-openmp code and openmp code. !$OMP SIMD only works when I add the compiler option -openmp to generate openmp code, right?

ifort-14.0 -cpp not referentially transparent

$ cat macro.F90
#define X_LT(a) (a < 3)
#define X_GE(a) (!X_LT(a))

#if !X_LT(3)
#warning no problem here
#endif

#if X_GE(3)
#warning "syntax error" with ifort, not with gfortran
#endif

$ ifort -c macro.F90                                                                                                                                                                                                          
macro.F90(5): #warning:  no problem here

macro.F90(8): #error: #if: syntax error.
macro.F90(9): #warning:  "syntax error" with ifort, not with gfortran

Can I compile a program here that will run on a tablet?

I guess its a different operating system entirely, but is there a way to generate executable code here

that I can migrate over to a tablet? Or does that require a separate compiler I would have to install on the

tablet?

I am not even sure I can compile any Fortran programs on a tablet.

Fortran abonnieren