Hi Dave, Tobias! Tobias, are you aware of any known issue in context of OpenMP 'metadirective', such that GCC would emit "truncated" diagnostics? (See "'#' missing", below.)
Dave: On 2026-10-29T15:00:15-0400, John David Anglin <[email protected]> wrote: > Thank you for the catch on dg-regexp! I wasn't aware that it completely > ignored target selectors. > > I'm working on an alternative fix for the test but I'm not sure this isn't a > libcpp issues. Indeed, per the information you're providing below, it looks like an issue in (some part, to be determined..., of) the implementation rather than in the test case: > On 2026-10-29 11:06 a.m., Thomas Schwinge wrote: >> On 2026-10-26T20:28:09-0400, John David Anglin <[email protected]> wrote: >>> testsuite: Fix g++.dg/gomp/deprecate-1.C on hppa targets (v2) >> >> That's confusing (... to me), in several aspects. ;-) >> >>> The g++.dg/gomp/deprecate-1.C test fails on hppa targets (such as >>> hppa64-hp-hpux11.11 and hppa-unknown-linux-gnu) because the leading '#' >>> character is stripped from the diagnostic source line mirror snippet >>> during metadirective warning expansions. > > I believe the statement is accurate, This is the actual diagnostic output on > linux: > > /home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/gomp/deprecate-1.C:117:71: > warning: 'default' clause on metadirectives deprecated since OpenMP 5.2, > use 'otherwise' [-Wdeprecated-openmp] > pragma omp metadirective when (device={arch("blahblah")}: nothing) default > (nothing) /* { dg-warning "'default' clause on metadirectives > deprecated since OpenMP 5.2, use 'otherwise'" } */ > ^~~~~~~ > otherwise Uh, indeed there is a '#' missing there! This is expected to be: [...] [...]/g++.dg/gomp/deprecate-1.C:117:71: warning: 'default' clause on metadirectives deprecated since OpenMP 5.2, use 'otherwise' [-Wdeprecated-openmp] #pragma omp metadirective when (device={arch("blahblah")}: nothing) default (nothing) /* { dg-warning "'default' clause on metadirectives deprecated since OpenMP 5.2, use 'otherwise'" } */ ^~~~~~~ otherwise >> I have difficulties (a) parsing that last sentence, and (b) understanding >> why/how '#' appearing as part of diagnostics would be handled differently >> for HPPA vs. other targets? > > There is some endian dependence in libcpp/lex.cc but the test doesn't fail on > powerpc64be. > At this time, I don't know why hppa is different. It's only different on > line 117 which > has a parenthetical nested expression. Now I understand the "diagnostic [...]" sentence from your earlier email. So, this -- probably... -- then isn't a HPPA *target* but rather HPPA *host* issue? >> Why is this (apparently) a problem only in 'g++.dg/gomp/deprecate-1.C', >> but not 'gcc.dg/gomp/deprecate-1.c', which uses a lot of the same >> patterns? > > From my research, the C front end handles macro line tracking using a simpler > source location > cache. The C++ front end uses tokenized fix-hits. But I have no knowledge > of the details. OK, thanks. >>> This patch fixes the failure by restricting the rigid literal multiline >> >> This test case 'g++.dg/gomp/deprecate-1.C' was added in >> commit d5320610cd3614a83ea1f2c8122a6cfbad987eab >> "openmp: Provide fixit hints for -Wdeprecated-openmp diagnostics from C++ >> FE", >> and I presume Jakub's intent was to test the exact multiline output >> formatting -- which we've now (partly) lost? >> >>> block to non-hppa targets, and appending target-specific dg-regexp >>> directives to the end of the file to gracefully consume the unhashed >>> caret fragments on PA-RISC architectures without altering file line >>> indices. >> >> As far as I can tell, there doesn't exist a concept of "target-specific >> dg-regexp directives": 'dg-regexp' effectively only considers its first >> argument, and silently drops everything else. >> >> (Of course, that's not the most friendly API, and also it's not >> documented in 'gcc/doc/sourcebuild.texi' at all. ..., and I've just >> realized that I already had filed <https://gcc.gnu.org/PR119511> >> "Harden 'dg-regexp', fix misuses"...) ;-) >> >>> gcc/testsuite/ChangeLog: >>> >>> * g++.dg/gomp/deprecate-1.C: Restrict the final literal multiline >>> verification block to non-hppa targets, and append trailing >>> dg-regexp directives to consume the unhashed diagnostic caret >>> fragments on hppa targets. >> >>> --- a/gcc/testsuite/g++.dg/gomp/deprecate-1.C >>> +++ b/gcc/testsuite/g++.dg/gomp/deprecate-1.C >>> @@ -109,16 +109,14 @@ bar () >>> { dg-end-multiline-output "" } */ >>> ; >>> #pragma omp master /* { dg-warning >>> "'master' construct deprecated since OpenMP 5.1, use 'masked'" } */ >>> -/* { dg-begin-multiline-output "" } >>> +/* { dg-begin-multiline-output "" { target { ! hppa*-*-* } } } >>> #pragma omp master >>> >>> ^ >>> { dg-end-multiline-output "" } */ >>> ; >>> #pragma omp metadirective when (device={arch("blahblah")}: nothing) >>> default (nothing) /* { dg-warning "'default' clause on >>> metadirectives deprecated since OpenMP 5.2, use 'otherwise'" } */ >>> -/* { dg-begin-multiline-output "" } >>> - #pragma omp metadirective when (device={arch("blahblah")}: nothing) >>> default (nothing) >>> - >>> ^~~~~~~ >>> - >>> otherwise >>> - { dg-end-multiline-output "" } */ >> >> Was it intentional that you've dropped this multiline output check >> entirely, instead of restricting to 'target { ! hppa*-*-* }' (as above)? >> >>> +/* { dg-regexp ".*pragma omp metadirective when.*" { target hppa*-*-* } } >>> */ >>> +/* { dg-regexp ".*\\^~~~~~~.*" { target hppa*-*-* } } */ >>> +/* { dg-regexp ".*otherwise.*" { target hppa*-*-* } } */ >>> ; >>> } >> >> As per my comment above, while the '{ target hppa*-*-* }' appears to >> conditionalize this DejaGnu directive in the usual way, in reality it >> doesn't, so these 'dg-regexp's are actually effective unconditionally. >> They PASS, at least, but not anymore fully testing what was intended to >> be tested. >> >> I don't want us to get hung up about this one test case, but... :-) > > Maybe I should revert the change and file a bug report? I spent a lot of > time trying > to fix the match and I'm not convinced there's currently a way to do it > without modifying > the original intent. This is definitely frustrating! Yes, indeed. 'dg-begin-multiline-output'/'dg-end-multiline-output' has limitations, and 'dg-regexp' as well... But: I'm "happy" ;-) that my underlying suspicion was right that this isn't just a test case to be adapted, but rather we appear to have identified an implementation issue to be investiaged. (Until that's resolved, I don't have a strong opinion on whether to keep or revert your commit 8ed21dfa6f62b80147fd5f444e9fd0da1ffc5a36 "testsuite: Fix g++.dg/gomp/deprecate-1.C on hppa targets (v2)". I don't see an HPPA system listed on <https://portal.cfarm.net/machines/list/>, but if anyone (maybe you?) is able to provide remote access, I might (at some point...) have a look at this. (Such access, to an HP-UX installation and/or a GNU/Linux one, might also come useful for another task I'm currently working on. But, please, only if external access may be provided without a lot of effort.) Grüße Thomas
