Closed Peter-J-Jansen closed 5 months ago
Fixed by commit 873c8ba587be8404dd47cae0604a07ee3d9d385e.
Closing.
Here's a bunch I just ran into, on Debian 12, with gcc 12.2.0.
Using commit: https://github.com/SDL-Hercules-390/hyperion/commit/140a0cf89cff61e91b7bd9b1de5850b6c1ea9cd1
CC dat.lo
In file included from ../hercules.h:104,
from ../cpu.c:43:
../cpu.c: In function ‘s370_process_interrupt’:
../cpu.c:1876:29: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 9 has type ‘char *’ [-Wformat=]
1876 | "auto-" );
| ~~~~~~~ ^
| |
| char *
../msgenu.h:99:98: note: in definition of macro ‘PFWRITEMSG’
99 | #define PFWRITEMSG( pan, f, fmt, ... ) fwritemsg( __FILE__, __LINE__, __FUNCTION__, pan, f, fmt, ## __VA_ARGS__ )
| ^~~
../msgenu.h:108:36: note: in expansion of macro ‘PWRITEMSG’
108 | #define LOGMSG( fmt, ... ) PWRITEMSG( WRMSG_NORMAL, fmt, ## __VA_ARGS__ )
| ^~~~~~~~~
../msgenu.h:110:36: note: in expansion of macro ‘LOGMSG’
110 | #define WRMSG( id, sev, ... ) LOGMSG( #id "%s " id "\n", sev, ## __VA_ARGS__ )
| ^~~~~~
../cpu.c:1875:17: note: in expansion of macro ‘WRMSG’
1875 | WRMSG( HHC00826, "W", PTYPSTR( sysblk.pcpu ),
| ^~~~~
../cpu.c:1876:29: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
1876 | "auto-" );
| ^
../msgenu.h:99:98: note: in definition of macro ‘PFWRITEMSG’
99 | #define PFWRITEMSG( pan, f, fmt, ... ) fwritemsg( __FILE__, __LINE__, __FUNCTION__, pan, f, fmt, ## __VA_ARGS__ )
| ^~~
../msgenu.h:108:36: note: in expansion of macro ‘PWRITEMSG’
108 | #define LOGMSG( fmt, ... ) PWRITEMSG( WRMSG_NORMAL, fmt, ## __VA_ARGS__ )
| ^~~~~~~~~
../msgenu.h:110:36: note: in expansion of macro ‘LOGMSG’
110 | #define WRMSG( id, sev, ... ) LOGMSG( #id "%s " id "\n", sev, ## __VA_ARGS__ )
| ^~~~~~
../cpu.c:1875:17: note: in expansion of macro ‘WRMSG’
1875 | WRMSG( HHC00826, "W", PTYPSTR( sysblk.pcpu ),
| ^~~~~
../cpu.c: In function ‘s390_process_interrupt’:
../cpu.c:1876:29: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 9 has type ‘char *’ [-Wformat=]
1876 | "auto-" );
| ~~~~~~~ ^
| |
| char *
../msgenu.h:99:98: note: in definition of macro ‘PFWRITEMSG’
99 | #define PFWRITEMSG( pan, f, fmt, ... ) fwritemsg( __FILE__, __LINE__, __FUNCTION__, pan, f, fmt, ## __VA_ARGS__ )
| ^~~
../msgenu.h:108:36: note: in expansion of macro ‘PWRITEMSG’
108 | #define LOGMSG( fmt, ... ) PWRITEMSG( WRMSG_NORMAL, fmt, ## __VA_ARGS__ )
| ^~~~~~~~~
../msgenu.h:110:36: note: in expansion of macro ‘LOGMSG’
110 | #define WRMSG( id, sev, ... ) LOGMSG( #id "%s " id "\n", sev, ## __VA_ARGS__ )
| ^~~~~~
../cpu.c:1875:17: note: in expansion of macro ‘WRMSG’
1875 | WRMSG( HHC00826, "W", PTYPSTR( sysblk.pcpu ),
| ^~~~~
../cpu.c:1876:29: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
1876 | "auto-" );
| ^
../msgenu.h:99:98: note: in definition of macro ‘PFWRITEMSG’
99 | #define PFWRITEMSG( pan, f, fmt, ... ) fwritemsg( __FILE__, __LINE__, __FUNCTION__, pan, f, fmt, ## __VA_ARGS__ )
| ^~~
../msgenu.h:108:36: note: in expansion of macro ‘PWRITEMSG’
108 | #define LOGMSG( fmt, ... ) PWRITEMSG( WRMSG_NORMAL, fmt, ## __VA_ARGS__ )
| ^~~~~~~~~
../msgenu.h:110:36: note: in expansion of macro ‘LOGMSG’
110 | #define WRMSG( id, sev, ... ) LOGMSG( #id "%s " id "\n", sev, ## __VA_ARGS__ )
| ^~~~~~
../cpu.c:1875:17: note: in expansion of macro ‘WRMSG’
1875 | WRMSG( HHC00826, "W", PTYPSTR( sysblk.pcpu ),
| ^~~~~
../cpu.c: In function ‘z900_process_interrupt’:
../cpu.c:1876:29: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 9 has type ‘char *’ [-Wformat=]
1876 | "auto-" );
| ~~~~~~~ ^
| |
| char *
../msgenu.h:99:98: note: in definition of macro ‘PFWRITEMSG’
99 | #define PFWRITEMSG( pan, f, fmt, ... ) fwritemsg( __FILE__, __LINE__, __FUNCTION__, pan, f, fmt, ## __VA_ARGS__ )
| ^~~
../msgenu.h:108:36: note: in expansion of macro ‘PWRITEMSG’
108 | #define LOGMSG( fmt, ... ) PWRITEMSG( WRMSG_NORMAL, fmt, ## __VA_ARGS__ )
| ^~~~~~~~~
../msgenu.h:110:36: note: in expansion of macro ‘LOGMSG’
110 | #define WRMSG( id, sev, ... ) LOGMSG( #id "%s " id "\n", sev, ## __VA_ARGS__ )
| ^~~~~~
../cpu.c:1875:17: note: in expansion of macro ‘WRMSG’
1875 | WRMSG( HHC00826, "W", PTYPSTR( sysblk.pcpu ),
| ^~~~~
../cpu.c:1876:29: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
1876 | "auto-" );
| ^
../msgenu.h:99:98: note: in definition of macro ‘PFWRITEMSG’
99 | #define PFWRITEMSG( pan, f, fmt, ... ) fwritemsg( __FILE__, __LINE__, __FUNCTION__, pan, f, fmt, ## __VA_ARGS__ )
| ^~~
../msgenu.h:108:36: note: in expansion of macro ‘PWRITEMSG’
108 | #define LOGMSG( fmt, ... ) PWRITEMSG( WRMSG_NORMAL, fmt, ## __VA_ARGS__ )
| ^~~~~~~~~
../msgenu.h:110:36: note: in expansion of macro ‘LOGMSG’
110 | #define WRMSG( id, sev, ... ) LOGMSG( #id "%s " id "\n", sev, ## __VA_ARGS__ )
| ^~~~~~
../cpu.c:1875:17: note: in expansion of macro ‘WRMSG’
1875 | WRMSG( HHC00826, "W", PTYPSTR( sysblk.pcpu ),
| ^~~~~
Fix(es) committed. Please try again.
Fish,
That worked! Good work!
The only one I see now on that system is this (which I think we've seen before):
CC ckddasd.lo
../ckddasd.c: In function ‘PerformSubsystemFunction.constprop’:
../ckddasd.c:6016:9: warning: ‘orig_iobuf’ may be used uninitialized [-Wmaybe-uninitialized]
6016 | memmove( &orig_iobuf[0], &iobuf[0], dev->ckdssdlen );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ckddasd.c:5661:12: note: ‘orig_iobuf’ was declared here
5661 | BYTE* orig_iobuf;
| ^~~~~~~~~~
Bill
The only one I see now on that system is this (which I think we've seen before):
That's supposed to have been fixed by commit 873c8ba587be8404dd47cae0604a07ee3d9d385e! (And yes, I tested it. Both before the fix and again afterwards.)
What version of gcc are you using? Because as committed, the above fix (workaround) should apply to any gcc version > 11. Maybe we need to change it to some earlier version?
gcc 12.2
The diff for the commit you've mentioned shows some lines that to me look unchanged, for what it's worth.
The diff for the commit you've mentioned shows some lines that to me look unchanged, for what it's worth.
Really? Because that commit SHOULD show that for gcc >= 11.0.0, the "-Wmaybe-uninitialized" warning is being disabled:
Fish,
The warning is for lines outside the range being protected.
You're guarding lines 6755 - 6999, and the warnings are at 5661 and 6016..
CC ckddasd.lo ../ckddasd.c: In function ‘PerformSubsystemFunction.constprop’: ../ckddasd.c:6016:9: warning: ‘orig_iobuf’ may be used uninitialized [-Wmaybe-uninitialized] 6016 | memmove( &orig_iobuf[0], &iobuf[0], dev->ckdssdlen ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../ckddasd.c:5661:12: note: ‘orig_iobuf’ was declared here 5661 | BYTE* orig_iobuf; | ^~~~~~~~~~
You're guarding lines 6755 - 6999, and the warnings are at 5661 and 6016..
(Oops!) I missed that the first time. Sorry. I'll get that fixed right away. It's the same fix, I just need to wrap it around the PerformSubsystemFunction
too. Give me a minute.
Should be fixed now by commit 23c8c460aae3677e82ba43ceff79dc0961eac657.
When building with gcc version 11.4.0 under Ubuntu 22.04, some warnings show up; I assume they can be ignored though.
Cheers,
Peter