Many (all?) diagnostic numbers increased by 1 from previous values

I’m updating Hedley to support the new nvcc/nvc++/pgcc/pgc++, and I’m noticing that a lot of diagnostic numbers are one value higher than they were before. For example:

static const char* non_null(const char* msg) {
  return msg;

int main (void) {

  return 0;
nemequ@peltast:~/t$ /opt/nvidia/hpc_sdk/Linux_x86_64/20.7/compilers/bin/nvc++ --display_error_number -Minform=inform -Werror -o wtf wtf.cpp
"wtf.cpp", line 7: error #1623: null argument provided for parameter marked
          with attribute "nonnull"

1 error detected in the compilation of "wtf.cpp".
nemequ@peltast:~/t$ /opt/pgi/19.10/linux86-64/19.10/bin/pgc++ --display_error_number -Minform=inform -Werror -o wtf wtf.cpp
"wtf.cpp", line 7: error #1622: null argument provided for parameter marked
          with attribute "nonnull"

1 error detected in the compilation of "wtf.cpp".

It’s not just this warning, it seems like it might be all of them. The warning for a missing sentinel (for a function with the sentinel attribute) changed from 1546 to 1547, and using a symbol marked as deprecated changed from 1215 and 1444 (depending on whether the symbol is a variable or a function) to 1216 and 1445.

Obviously this isn’t a catastrophe, but it does mean I have to go through all my code and update the warning numbers, which results in a rather silly patch:

diff --git a/hedley.h b/hedley.h
index d343075..d436897 100644
--- a/hedley.h
+++ b/hedley.h
@@ -851,6 +851,8 @@
 #  define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
 #  define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)")
+#  define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1216,1445")
 #  define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
@@ -920,6 +922,8 @@
 #  define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)")
 #  define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030))
+#  define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1098")
 #  define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)
@@ -1263,7 +1267,7 @@ HEDLEY_DIAGNOSTIC_POP
 #  define HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr))
 #if \
-  HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) || \
+  (HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(HEDLEY_PGI_VERSION)) || \
 #  define HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability(  (expr), (value), (probability))
 #  define HEDLEY_PREDICT_TRUE(expr, probability)   __builtin_expect_with_probability(!!(expr),    1   , (probability))
diff --git a/test/non-null.c b/test/non-null.c
index 0ac0ed2..48488e1 100644
--- a/test/non-null.c
+++ b/test/non-null.c
@@ -9,7 +9,9 @@
   #include <stdlib.h>
-#if defined(HEDLEY_PGI_VERSION)
+#  pragma diag_remark 1623
+#elif defined(HEDLEY_PGI_VERSION)
 #  pragma diag_remark 1622
 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)
 #  pragma error_messages(off,nonnullarg)
diff --git a/test/sentinel.c b/test/sentinel.c
index 0e2c492..18c3257 100644
--- a/test/sentinel.c
+++ b/test/sentinel.c
@@ -4,6 +4,8 @@
 #  pragma clang diagnostic warning "-Wsentinel"
 #elif defined(HEDLEY_INTEL_VERSION)
 #  pragma warning(disable:1881)
+#  pragma diag_remark 1547
 #elif defined(HEDLEY_PGI_VERSION)
 #  pragma diag_remark 1546
 #elif defined(HEDLEY_GNUC_VERSION)
diff --git a/test/warn-unused-result.c b/test/warn-unused-result.c
index 1d9437c..41dc795 100644
--- a/test/warn-unused-result.c
+++ b/test/warn-unused-result.c
@@ -12,6 +12,8 @@
     defined(HEDLEY_TI_CL7X_VERSION) || \
 #  pragma diag_remark 1490
+#  pragma diag_remark 1651
 #elif defined(HEDLEY_PGI_VERSION)
 #  pragma diag_remark 1650
 #elif defined(HEDLEY_GNUC_VERSION)
diff --git a/test/warn.c b/test/warn.c
index 67a677e..d2d8604 100644
--- a/test/warn.c
+++ b/test/warn.c
@@ -2,6 +2,8 @@
 #  pragma warning(disable:1028)
+#  pragma diag_remark 1106
 #elif defined(HEDLEY_PGI_VERSION)
 #  pragma diag_remark 1105

I have a feeling this is unintentional since it’s a pretty disruptive change with (AFAICT) no benefit. However, if it is unintentional and you’ll revert to the old diagnostic numbers in the next release I’ll need to update my code to only use the larger numbers for 20.7 instead of 20.7+.

Can you let me know whether the numbers will revert next release or if these are going to be the values for the foreseeable future?

Hi nemequ1729,

I asked our compiler engineering manager who doesn’t think this was intentional so will assign a compiler engineer to take a look. We issued TPR #28848, to track. Too early to give a timeline as to when/if this will be fixed.

Thanks for the report!

1 Like

Engineering has reviewed this but have decided that it best to not revert the error code numbering and instead move forward with the 20.7 numbering. Apologies that this will cause you some extra work, but given 20.7 was the first NV HPC Compiler, they wanted to make it the authoritative version.

1 Like


When the transition from PGI to NVIDA branding was first announced, I expressed some concerns I had at that time to I was told “one of our goals in this process is to break no makefiles or build systems as we transition the PGI compilers to NVIDIA branding”.

How do you reconcile that clearly articulated goal with the choice to retain the (likely unintentional) change to error code numbering and thus force “some extra work” to update makefiles and build systems?

Hi Paul,

For this particular case, we determined that it would be less disruptive overall to preserve the error number ordering across HPC SDK versions rather than having an outlier with 20.7.

Best Regards,


I am very sorry to hear that you rather have all NVIDIA HPC SDK versions be broken than just one.