For pgf90 15.7.0, on:
(1) Linux 2.6.18-308.13.1.el5PAE #1 SMP Tue Aug 21 17:50:26 EDT 2012 i686 i686 i386 GNU/Linux (pgf90 15.7-0 32-bit target on x86 Linux -tp penryn)
(2) Linux 2.6.32-573.3.1.el6.x86_64 #1 SMP Thu Aug 13 22:55:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux (pgf90 15.7-0 64-bit target on x86-64 Linux -tp nehalem)
The following C/Fortran program works on (1) but on (2) it seg. faults when va_start(ap, ier); is not commented out.
Fortran main:
PROGRAM main
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT) :: cg, base_no, ier, zone, discr_no
CALL cg_goto_f(cg, base_no, ier, ‘Zone_t’, zone, ‘DiscreteData_t’, discr_no, ‘end’)
END PROGRAM main
C:
#include <stdarg.h>
#include <stdio.h>
void cg_goto_f_(int *fn, int *B, int *ier, …)
{
va_list ap;
printf(“inside cg_goto_f\n”);
va_start(ap, ier);
return;
}
Makefile:
INTEL COMPILER
#CC = icc
#FC = ifort
GNU COMPILER
#CC = gcc
#FC = gfortran
CC = pgcc
FC = pgf90
F90FLAGS =
CFLAGS = -g
OBJ = ccode.o
OBJF90 = fcode.o
all: test
test: $(OBJ) $(OBJF90)
$(FC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(OBJF90) -o $@ $(LIB)
.SUFFIXES: .o .f90
.f90.o:
$(FC) $(F90FLAGS) -c $< -o $@ $(LIB)
.SUFFIXES: .o .c
.c.o:
$(CC) $(CFLAGS) $(LDFLAGS) -c $< -o $@ $(LIB)
clean:
rm -f *.o *.mod test
spotless:
rm -f *.o *.mod test *~