https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108493

            Bug ID: 108493
           Summary: Interaction with implicit includes and
                    -traditional-cpp
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

On powerpc-apple-darwin, we -include 'altivec.h' which predefines some relevant
vector stuff...
(This is behind the scenes, not a user action, when the VMX instruction set is
in use, which is essentially always in reality)

The contains the following line
#define vector __vector

-----

before starting ; To be fair, I am not 100% sure if there's also a bug in the
traditional-cpp impl.

----

$ cat t.mod
MODULE T

IMPORT bug ;

BEGIN
END T.

$ cat bug.def

(* vector *)

$ grep vector
/opt/iains/powerpc-apple-darwin9/gcc-13-0-1-wip/lib/gcc/powerpc-apple-darwin9/13.0.1/include/altivec.h
 
/* If __APPLE_ALTIVEC__ is defined, the compiler supports 'vector',
#define vector __vector


---- bug.def is preprocessed recursively from the main.

$ gcc/cc1 -E -v -iprefix
/scratch/10-5-leo/gcc-master-wip/gcc/../lib/gcc/powerpc-apple-darwin9/13.0.1/
-isystem gcc/include -isystem gcc/include-fixed -iplugindir=gcc/plugin -D
__DYNAMIC__  -iplugindir=gcc/plugin -fPIC -dumpbase t.mod -dumpbase-ext .mod
-mmacosx-version-min=10.5.0 -traditional-cpp -version bug.def

# 0 "<command-line>"
# 1 "bug.def"
bug.def:2: error: detected recursion whilst expanding macro "vector"
    2 | (* vector *)

regular CPP does not exhibit this problem - is there a reason we need to use
"traditional" ?

As noted there could be a bug with the preprocessor too .. I do not know.

Reply via email to