https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94228
Bug ID: 94228 Summary: Preprocessor inconsistency for macros when invoked from gfortran Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: markwayne1969 at gmail dot com Target Milestone: --- This report details differing behavior for preprocessor directives containing variadic macros when processed directly by cpp $ cpp-9 --version cpp-9 (Homebrew GCC 9.2.0_3) 9.2.0 Copyright (C) 2019 Free Software Foundation, Inc. and when invoked from the gfortran compiler $ gfortran-9 --version GNU Fortran (Homebrew GCC 9.2.0_3) 9.2.0 Copyright (C) 2019 Free Software Foundation, Inc. An MWE is included. 1) The source ('test-function-macro.f90'): ! filename: test-function-macro.f90 ! v0: Thu Mar 19 11:06:40 2020 program test_function_macro implicit none #define F(...) print *, 0,__VA_ARGS__ F('1','2','3') end program test_function_macro 2) cpp direct processing: $ cpp-9 test-function-macro.f90 # 1 "test-function-macro.f90" # 1 "<built-in>" # 1 "<command-line>" # 1 "test-function-macro.f90" ! filename: test-function-macro.f90 ! v0: Thu Mar 19 11:06:40 2020 program test_function_macro implicit none print *, 0,'1','2','3' end program test_function_macro 3) gfortran invocation: $ gfortran-9 -cpp test-function-macro.f90 test-function-macro.f90:7:0: 7 | #define F(...) print *, 0,__VA_ARGS__ | Error: syntax error in macro parameter list 4) Comments i) the behavior in item 2) is the desired behavior ii) the behavior in item 3) is undesired iii) The system is runs mac OS; the behavior is identical whether the above cpp is used or the system cpp is used: $ cpp --version Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin