https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119102
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- It can be reproduced even with just simple foo.H int foo (int) __attribute__((simd ("notinbranch"))); and foo.C import "foo.H"; int main () {} ./xg++ -B ./ -Ofast -fmodule-header foo.H ./xg++ -B ./ -Ofast -fmodules foo.C -S In module imported at foo.C:1:1: ./foo.H: error: module contains OpenMP, use ‘-fopenmp’ to enable ./foo.H: error: failed to read compiled module: Bad file data ./foo.H: note: compiled module file is ‘gcm.cache/,/foo.H.gcm’ ./foo.H: fatal error: returning to the gate for a mechanical issue compilation terminated. Doesn't reproduce with just __attribute__((simd)) though. The SE_OPENMP diagnostic is for some strange reason keyed on streaming out and in OMP_CLAUSE. Which is not a good idea. OMP_CLAUSE can be created even for the simd attribute with argument: if (strcmp (TREE_STRING_POINTER (id), "notinbranch") == 0) attr = build_omp_clause (DECL_SOURCE_LOCATION (*node), OMP_CLAUSE_NOTINBRANCH); else if (strcmp (TREE_STRING_POINTER (id), "inbranch") == 0) attr = build_omp_clause (DECL_SOURCE_LOCATION (*node), OMP_CLAUSE_INBRANCH); On the other side, when one actually uses some OpenMP construct without any clauses, say bar.H extern void bar (); inline int foo () { #pragma omp parallel bar (); return 0; } and bar.C import "bar.H"; int main () { foo (); } ./cc1plus -quiet bar.H -fopenmp -fmodule-header ./cc1plus -quiet -fmodules bar.C -fdump-tree-gimple during GIMPLE pass: *build_cgraph_edges In module ./bar.H, imported at bar.C:1: bar.H: In function ‘int foo()’: bar.H:3:1: internal compiler error: Segmentation fault 3 | foo () | ^~~ 0x30530a1 internal_error(char const*, ...) ../../gcc/diagnostic-global-context.cc:517 0x11d0928 crash_signal ../../gcc/toplev.cc:322 0x449b9d cgraph_node::get(tree_node const*) ../../gcc/cgraph.h:1346 0xaa4bcb cgraph_node::get_create(tree_node*) ../../gcc/cgraph.cc:537 0xab67db execute ../../gcc/cgraphbuild.cc:346 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.