[Bug preprocessor/91517] Pragma expansion in variadic macro reorders pragmas and breaks code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91517 Lewis Hyatt changed: What|Removed |Added CC||duparq at free dot fr --- Comment #7 from Lewis Hyatt --- *** Bug 79948 has been marked as a duplicate of this bug. ***
[Bug preprocessor/91517] Pragma expansion in variadic macro reorders pragmas and breaks code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91517 Lewis Hyatt changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE CC||lhyatt at gcc dot gnu.org --- Comment #6 from Lewis Hyatt --- Same issue as bug 90400... was resolved as well by r12-5454. *** This bug has been marked as a duplicate of bug 90400 ***
[Bug preprocessor/91517] Pragma expansion in variadic macro reorders pragmas and breaks code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91517 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2020-01-29 CC||marxin at gcc dot gnu.org Ever confirmed|0 |1
[Bug preprocessor/91517] Pragma expansion in variadic macro reorders pragmas and breaks code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91517 --- Comment #5 from Peter Boyle --- Hi Jakub, The difference between these two cases (one maintaining the pragma in right place, the other note) suggested a viable work around in the code. I can eliminate the extra naked_for macro and (with some undesired code replication) get a working solution. However, that doesn't mean it isn't a bug, and it should of course be fixed, ! Thanks for the pointer - I will make the change to the code to tolerate the issue, because GCC is clearly an important target for us. Best wishes, Peter
[Bug preprocessor/91517] Pragma expansion in variadic macro reorders pragmas and breaks code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91517 --- Comment #4 from Peter Boyle --- Hi Jakob, thanks for looking at this. I'm trying to cut down a fail in 100k line of code package to the minimal thing that I can submit. www.github.com/paboyle/Grid Is the original package; WITH -fopenmp the following larger example still fails #define DO_PRAGMA_(x) _Pragma (#x) #define DO_PRAGMA(x) DO_PRAGMA_(x) #define thread_num(a) omp_get_thread_num() #define thread_max(a) omp_get_max_threads() #define naked_for(i,num,...) for ( uint64_t i=0;i inline void blockProject(Lattice > , const Lattice , const std::vector > ) { GridBase * fine = fineData.Grid(); GridBase * coarse= coarseData.Grid(); int _ndimension = coarse->_ndimension; // checks assert( nbasis == Basis.size() ); subdivides(coarse,fine); for(int i=0;i_rdimensions[d] / coarse->_rdimensions[d]; assert(block_r[d]*coarse->_rdimensions[d] == fine->_rdimensions[d]); } coarseData=Zero(); auto fineData_ = fineData.View(); auto coarseData_ = coarseData.View(); // Loop over coars parallel, and then loop over fine associated with coarse. thread_for( sf, fine->oSites(), { int sc; Coordinate coor_c(_ndimension); Coordinate coor_f(_ndimension); Lexicographic::CoorFromIndex(coor_f,sf,fine->_rdimensions); for(int d=0;d<_ndimension;d++) coor_c[d]=coor_f[d]/block_r[d]; Lexicographic::IndexFromCoor(coor_c,sc,coarse->_rdimensions); thread_critical { for(int i=0;i" # 1 "" # 1 "tmp.cc" # 19 "tmp.cc" template inline void blockProject(Lattice > , const Lattice , const std::vector > ) { GridBase * fine = fineData.Grid(); GridBase * coarse= coarseData.Grid(); int _ndimension = coarse->_ndimension; assert( nbasis == Basis.size() ); subdivides(coarse,fine); for(int i=0;i_rdimensions[d] / coarse->_rdimensions[d]; assert(block_r[d]*coarse->_rdimensions[d] == fine->_rdimensions[d]); } coarseData=Zero(); auto fineData_ = fineData.View(); auto coarseData_ = coarseData.View(); # 61 "tmp.cc" # 61 "tmp.cc" #pragma omp parallel for schedule(static) # 47 "tmp.cc" # 61 "tmp.cc" # 61 "tmp.cc" #pragma omp critical # 55 "tmp.cc" # 47 "tmp.cc" for ( uint64_t sf=0;sfoSites();sf++) { {{ int sc; Coordinate coor_c(_ndimension); Coordinate coor_f(_ndimension); Lexicographic::CoorFromIndex(coor_f,sf,fine->_rdimensions); for(int d=0;d<_ndimension;d++) coor_c[d]=coor_f[d]/block_r[d]; Lexicographic::IndexFromCoor(coor_c,sc,coarse->_rdimensions); { for(int i=0;i
[Bug preprocessor/91517] Pragma expansion in variadic macro reorders pragmas and breaks code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91517 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- It works properly if you use -fopenmp during preprocessing (or compilation). Without -fopenmp, the pragmas aren't recognized. In your use case, are you preprocessing separately without -fopenmp and then compiling with -fopenmp? If so, why?
[Bug preprocessor/91517] Pragma expansion in variadic macro reorders pragmas and breaks code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91517 --- Comment #2 from Peter Boyle --- GCC preprocessor moves location of _Pragma operator in sequence in a variadic macro: Simpler case: #define thread_for( i, num, ... ) for ( uint64_t i=0;i" # 1 "" # 1 "tmp.cc" #pragma omp critical # 3 "tmp.cc" for ( uint64_t i=0;i" 1 # 1 "" 3 # 374 "" 3 # 1 "" 1 # 1 "" 2 # 1 "tmp.cc" 2 for ( uint64_t i=0;i
[Bug preprocessor/91517] Pragma expansion in variadic macro reorders pragmas and breaks code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91517 --- Comment #1 from Peter Boyle --- Also occurs on 7.4.0, 8.3.0 gcc-7 (Homebrew GCC 7.4.0_2) 7.4.0 gcc-8 (Homebrew GCC 8.3.0) 8.3.0