2

I use both intel and gnu fortran compilers. Syntastic gives the following errors when I compile my module, with these settings:

  1. syntastic_fortran_compiler set to 'ifort' & using ifort -c my_mod.f90, then it displays an error on the USE my_mod line.

  2. syntastic_fortran_compiler set to 'gfortran' & using gfortran -c my_mod.f90, then it displays an error on the CALL subroutine line.

To change the value of syntastic_fortran_compiler, I edit the file: syntastic-checkers.txt by accessing it through :help syntastic-checkers-fortran in vim.

There is no problem with the code running though; everything is fine. The module does what it is supposed to. I like the loc_list when it displays errors, but it is irritating when it comes up with a non-removable, non-error. For now, I have set let g:syntastic_auto_loc_list = 0.

This is produced on a machine with gcc version 4.8.4. An interesting thing is that when I do this on a machine with gcc version 5.*, the gfortran error disappears. Also, I use ifort version 16.0.3 .

EDIT1: I see the errors when I open the main program file with vim after I compile as above.

EDIT2: As lcd047 mentions in the comments, I am supposed to add let g:syntastic_fortran_compiler ="ifort" to my .vimrc. Doing so resolves error(1), and now both cases produce error(2).

EDIT3:

The funniest thing happened. After I performed EDIT2, I indented the code inside the SUBROUTINE contained in my MODULE, because the cursor kept jumping one indent every time I pressed enter, and it was getting irritating (up until now all code in the module was without indentation).

Then, when I opened my main file this time, syntastic actually tells me what is wrong as an error message (till now it only said error). Message: The type of the actual argument differs from the type of the dummy argument. It underlined all the REALs amongst the args (I have REAL and INTEGER args).

So then I open my_mod.f90 to check; everything seems okay. And this time when I open main.f90, there isn't an error anymore. What I wrote above is all I did. I have no idea how the error disappeared.

EDIT4: The above effect is reproducible. When g:syntastic_fortran_compiler = "ifort", if I compile once with gfortran, and open the file, syntastic says that it does not recognize the module. That is okay. Now, if I compile again with ifort, syntastic gives that error message of differing types again. Closing and opening the file again removes the error.

physkets
  • 183
  • 3
  • 12
  • 2
    Syntastic doesn't know, nor cares, about the contents of your files. What it does is run external checkers, then shows you the results in a window. If you don't like the results you get then you need to change the way checkers are run, and / or filter results. To __see__ how syntastic runs the checkers enable debugging and read the logs (`:h syntastic-debug`). To __change__ how syntastic runs the checkers set the various checker options (`:h syntastic-fortran-gfortran`). To filter results set `syntastic_fortran_gfortran_quiet_messages` (`:h syntastic-filtering-errors`). – lcd047 Jul 22 '16 at 06:54
  • @lcd047 So are you saying that I should forget the fact that a syntax checker is telling me that there is something wrong and just suppress the message instead of looking for the root of the issue? – physkets Jul 22 '16 at 08:48
  • 1
    No, I'm saying you should run the checks with the same options as the builds. Then you'd get the same results. – lcd047 Jul 22 '16 at 08:57
  • 1
    _To change the value of `syntastic_fortran_compiler`, I edit the file: syntastic-checkers.txt_ - That's a help file, editing it has exactly zero effect on syntastic's working. You're supposed to set the variable `g:syntastic_fortran_compiler` in your vimrc, not in the help file. – lcd047 Jul 22 '16 at 11:35
  • Oh! Shoot... Thanks! I added `let g:syntastic_fortran_compiler ="ifort"`. Okay, now both cases show an error on the `CALL subroutine` line. – physkets Jul 22 '16 at 15:01
  • @lcd047 Look at EDITs 3 and 4. The issue is basically resolved. Could you put your 3rd comment as an answer so I can accept? Or is this too trivial an issue? It was quite stupid of me to not have realised that that was a help file. But thanks a lot! – physkets Jul 22 '16 at 15:51
  • 2
    It is not very good to have edit1...edit99. A question should be for the future visitors in the form of a clear formulation of a problem for which there is an answer below. Notice the link **edited + date"** just below the question. Enyone can click there to see the history. No need to Have your **Edit42** with changes what to you wrote above it. Just rewrite your question when editing. – Vladimir F Героям слава Jul 23 '16 at 09:15

0 Answers0