Hi! The following programs are built like this:
gfortran -c zdotu.f -ggdb g++ -c ztest.cpp -ggdb g++ -o ztest zdotu.o ztest.o The generated ztest segfaults on ARM on line 37 of zdotu.f with SIGSEGV, while it is perfect on other arches. Thanks! Kumar zdotu.f ------- DOUBLE COMPLEX FUNCTION ZDOTU(N,ZX,INCX,ZY,INCY) * .. Scalar Arguments .. INTEGER INCX,INCY,N * .. * .. Array Arguments .. DOUBLE COMPLEX ZX(*),ZY(*) * .. * * Purpose * ======= * * ZDOTU forms the dot product of two vectors. * * Further Details * =============== * * jack dongarra, 3/11/78. * modified 12/3/93, array(1) declarations changed to array(*) * * .. Local Scalars .. DOUBLE COMPLEX ZTEMP INTEGER I,IX,IY * .. ZTEMP = (0.0d0,0.0d0) ZDOTU = (0.0d0,0.0d0) IF (N.LE.0) RETURN IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20 * * code for unequal increments or equal increments * not equal to 1 * IX = 1 IY = 1 IF (INCX.LT.0) IX = (-N+1)*INCX + 1 IF (INCY.LT.0) IY = (-N+1)*INCY + 1 DO 10 I = 1,N ZTEMP = ZTEMP + ZX(IX)*ZY(IY) IX = IX + INCX IY = IY + INCY 10 CONTINUE ZDOTU = ZTEMP RETURN * * code for both increments equal to 1 * 20 DO 30 I = 1,N ZTEMP = ZTEMP + ZX(I)*ZY(I) 30 CONTINUE ZDOTU = ZTEMP RETURN END ztest.cpp --------- #include <complex> typedef std::complex<double> cdouble; extern "C" { cdouble zdotu_(const int *, const cdouble *, const int *, const cdouble *, const int *); } int main() { int incr = 1; int size = 6; cdouble a[] = {cdouble( 0.7219, 0.8871), cdouble( 0.7073,-0.7953), cdouble( 0.2610, 0.4325), cdouble(-0.0565,-0.0719), cdouble( 0.7277,-0.9754), cdouble(-0.3780, 1.0718)}; cdouble b[] = {cdouble(-0.0821,+0.8410), cdouble(-0.0749, 0.0729), cdouble(-0.6094,-0.2975), cdouble( 0.2106,-0.2026), cdouble( 0.1043,-0.8300), cdouble( 0.0806, 0.3698)}; cdouble x_ref(-2.01767031,-0.45861365); cdouble x = zdotu_(&size, a, &incr, b, &incr); return (std::abs(x - x_ref) < 1e-6) ? 0 : 1; } -- Summary: zdotu (copy of BLAS version) works in x86, x86_64, segfaults in arm. Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: akumar at ee dot iitm dot ac dot in GCC build triplet: arm-linux-gnu GCC host triplet: arm-linux-gnu GCC target triplet: arm-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35220