The following code produces a wrong error while cpp (4.9.1 power8 ppc64le).
This gets cpp correctly on different archs.
end program test
cpp (Ubuntu 4.9.1-15ubuntu1) 4.9.1
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cpp -traditional -P tmp.F90
tmp.F90:2:0: error: detected recursion whilst expanding macro "vector"
end program test
I don't see it on x86_64-apple-darwin14 (4.8.3, 4.9.2, 5.0).
This should reported to Ubuntu. Note that cpp is not part of Fortran, so the component is probably wrong.
s/This should reported/This should be reported/
By the way,
cpp -dM </dev/null
shows all predefined macros - there should be also a definition for 'vector', I presume. (On my system, there isn't.)
You could try processing the file with "-undef", which should drastically reduce the number of defines.
OR, looking at the code below, you could try: -std= (such as "c90", cf. "man cpp"), which seems to disable the "vector" expansion.
What's missing is a proper Fortran support in libcpp, which is able to handle Fortran comments etc. That's tracked, e.g., in PR 28662.
* * *
Code wise, it comes from the following code in gcc/config/spu/spu-c.c:
/* Define this when supporting context-sensitive keywords. */
cpp_define (pfile, "__VECTOR_KEYWORD_SUPPORTED__");
cpp_define (pfile, "vector=vector");
/* Initialize vector keywords. */
__vector_keyword = get_identifier ("__vector");
C_CPP_HASHNODE (__vector_keyword)->flags |= NODE_CONDITIONAL;
vector_keyword = get_identifier ("vector");
C_CPP_HASHNODE (vector_keyword)->flags |= NODE_CONDITIONAL;
/* Enable context-sensitive macros. */
cpp_get_callbacks (pfile)->macro_to_expand = spu_macro_to_expand;
> What's missing is a proper Fortran support in libcpp, which is able
> to handle Fortran comments etc. That's tracked, e.g., in PR 28662.
Thus marked as duplicate.
*** This bug has been marked as a duplicate of bug 28662 ***