Error Syntax Error In If-expression At 1 Fortran
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about
Syntax Error In Data Declaration At 1 Fortran
Stack Overflow the company Business Learn more about hiring developers or posting ads with unterminated character constant us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is
Syntax Error In Argument List Fortran
a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Gfortran do loop if-statement error up vote 0 down vote favorite I have a fortran unterminated character constant simple Fortran code, and I am getting an error that I cannot find a solution to. Does anyone know how to fix this? subroutine sort(A,A_done,N,P) ! Sort a real array by algebraically increasing value and return the permutation that ! rearranges the array implicit none Integer N, TEMP1, K, L, P(N), TEMP2 real(8), dimension(:) :: A_done real(8), dimension(:) :: A DO K=1, N-1 DO L=K+1, N if A(K)>A(L) TEMP1=A(K) TEMP2=P(K) error: unclassifiable statement at (1) A(K)=A(L) P(K)=P(L) A(L)=TEMP1 P(L)=TEMP2 end if END DO END DO A_done=A RETURN END gfortran -Wall -Werror -fbounds-check -w -L -lm -o Simulation readinput.for noutfile.for mean.for covariance.for correlation.for rperm.for simmain.for sort.for In file sort.for:13 if A(K)>A(L) 1 Error: Unclassifiable statement at (1) In file sort.for:20 end if 1 Error: Expecting END DO statement at (1) make: * [Simulation] Error 1 Thanks for the help gfortran share|improve this question asked Apr 3 '13 at 19:37 user2241691 41 sorry, about that, I was thinking of another language, there you know, if then else pattern. –fedvasu Apr 3 '13 at 21:33 Well, I assume you looked at a language manual for the correct syntax of the if-block. What did it tell you? –eriktous Apr 3 '13 at 22:32 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote You have forgotten a pair of parentheses and a "then": At if A(K)>A(L) you must type if (A(K)>A(L)) then Other than that, your code has multiple issues: At TEMP1=A(K) and similar expressions, you pass a real(8) value to an integer variable I don't understand what the P variable does (could you describe please?), but you also mix real(8) and integer there. You MUST specify the dimensi
text] [patch, fortran] PR34325 Wrong error message for syntax error From: Jerry DeLisle dot gnu dot org> Cc: gcc-patches [x] User account creation filtered due to spam. Bug27613 - compile fails with "Unclassifiable statement" error message Summary: compile fails https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27613 with "Unclassifiable statement" error message Status: RESOLVED FIXED Alias: None Product: gcc Classification: Unclassified Component: fortran (show other bugs) Version: 4.1.0 Importance: P3 normal Target Milestone: --- Assignee: Paul Thomas URL: Keywords: rejects-valid Depends on: Blocks: Reported: 2006-05-15 01:09 UTC by Nicolas Bock Modified: 2009-05-26 09:38 UTC (History) CC List: 4 users (show) gcc-bugs paul.richard.thomas theresa.adelt tobi See syntax error Also: Host: Target: Build: Known to work: Known to fail: 4.2.0 Last reconfirmed: 2006-05-15 16:09:05 Attachments Patch for the problem (448 bytes, patch) 2006-05-15 13:59 UTC, Paul Thomas Details | Diff View All Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description Nicolas Bock syntax error in 2006-05-15 01:09:48 UTC The following code fails to compile with the error message: In file test.f90:14 stuff = stuff+stuff(n+1) 1 Error: Unclassifiable statement at (1) The program test.f90: program test integer :: stuff write(*, *) "called stuff ", stuff(1), " times" end program test recursive function stuff(n) integer :: stuff integer :: n stuff = 1 if(n < 5) then stuff = stuff+stuff(n+1) endif end function stuff Comment 1 Nicolas Bock 2006-05-15 01:14:39 UTC I would like to add the output of $ gfortran -v -save-temps test.f90 Driving: gfortran -v -save-temps test.f90 -lgfortranbegin -lgfortran -shared-libgcc Using built-in specs. Target: powerpc-apple-darwin8.6.0 Configured with: ../gcc-4.1.0/configure --prefix=/usr/local/gcc-4.1.0 --with-gmp=/sw --with-mpfr=/sw --enable-languages=c,fortran --disable-libssp : (reconfigured) ../gcc-4.1.0/configure --prefix=/usr/local/gcc-4.1.0 --with-gmp=/sw --with-mpfr=/sw --enable-languages=c,fortran --disable-multilib Thread model: posix gcc version 4.1.0 /usr/local/gcc-4.1.0/libexec/gcc/powerpc-apple-darwin8.6.0/4.1.0/f951 test.f90 -fPIC -quiet -dumpbase test.f90 -auxbase test -version -o test.s GNU F95 version 4.1.0 (powerpc-apple-darwin8.6.0) compiled by GNU C version 4.0.0 (Apple Computer, Inc. build 5026). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 In file test.f90:14 stuff = stuff+stuff(n+1) 1 Error: Unclassifiable statement at (1) Comment 2 Paul Thomas 2006-05-15 06:42:19 UTC A Unexpected Data Declaration Statement At (1)