Hi!
All targets use the EH_RETURN_DATA_REGNO macro argument except for
NVPTX which uses the default.
The problem is that we get then -Wunused-but-set-variable warning
when building df-scan.cc for NVPTX target with GCC 16 (post r16-2258
PR44677) on:
unsigned int i;
/* Mark the registers that will contain data for the handler. */
for (i = 0; ; ++i)
{
unsigned regno = EH_RETURN_DATA_REGNO (i);
if (regno == INVALID_REGNUM)
break;
If it were multiple targets suffering from this, I'd think about
adding something to use i in loops like this, but as it is
just the default definition, the following patch fixes it by
using the argument.
Tested by building nvptx-none cross-compiler with GCC 16 2 days old
snapshot.
Ok for trunk?
2025-12-15 Jakub Jelinek <[email protected]>
PR middle-end/123115
* defaults.h (EH_RETURN_DATA_REGNO): Add void (N) to the macro
definition inside of a comma expression before INVALID_REGNUM.
--- gcc/defaults.h.jj 2025-08-05 08:19:26.667814010 +0200
+++ gcc/defaults.h 2025-12-15 11:33:16.656762266 +0100
@@ -390,7 +390,7 @@ see the files COPYING3 and COPYING.RUNTI
/* Provide defaults for stuff that may not be defined when using
sjlj exceptions. */
#ifndef EH_RETURN_DATA_REGNO
-#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
+#define EH_RETURN_DATA_REGNO(N) (void (N), INVALID_REGNUM)
#endif
/* Offset between the eh handler address and entry in eh tables. */
Jakub