On 29.10.21 12:53, Jakub Jelinek wrote: > On Fri, Oct 29, 2021 at 12:09:55PM +0200, Tobias Burnus wrote: >> [...] only routines calls to >> omp_get_num_teams() and omp_get_team_num() >> are permitted in teams when closely nested. > I'm afraid using DECL_ASSEMBLER_NAME opens a new can of worms. [...] > At least for C++, [...] > is meant to be checked by > || (DECL_CONTEXT (fndecl) != NULL_TREE > && TREE_CODE (DECL_CONTEXT (fndecl)) != TRANSLATION_UNIT_DECL) > If that doesn't work for Fortran modules, we need to find out something > different, e.g. setjmp_or_longjmp_p also relies on that... It turned out that the current (pre-patch) code works correctly, except that DECL_NAME for Fortran does not have the '_' suffix. I have now updated the comments and just for omp_* and omp_*_8. That simplifies the code and, fortunately, DECL_NAME does seem to work. > On the other side, when we use DECL_NAME we don't currently differentiate > between: > extern "C" int omp_is_initial_device (); > and say > extern int omp_is_initial_device (double, float); > where the latter is in C++ mangled differently. Sure, one can't use > the latter together with #include ... The question is whether anyone cares that we reject the latter? > As mentioned in the PR, I really don't like this permit_num_teams argument, > IMHO it is a caller that should check it, otherwise we end up in the > function with myriads of future exceptions etc. I concur – given that DECL_NAME seems to work fine (ignoring C++ w/o extern "C"). > As for tests where you are adding parallel to avoid the new diagnostics, > I'd suggest parallel if(0) instead, no need to create any extra threads... Done. Thanks for the comments! Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955