https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107314
Bug ID: 107314
Summary: New -Wsign-compare since r13-3360-g3b3083a598ca3f4b
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: jsm28 at gcc dot gnu.org
Target Milestone: ---
Reduced from grub package:
$ cat http.i
int port;
enum {
HTTP_PORT,
HTTP_MAX_CHUNK_SIZE = 0x80000000
}
http_establish_file() {
return 0 ? port : HTTP_PORT;
}
$ gcc http.i -c -Werror=sign-compare -O2
http.i: In function ‘http_establish_file’:
http.i:8:14: error: operand of ‘?:’ changes signedness from ‘int’ to ‘enum
<anonymous>’ due to unsignedness of other operand [-Werror=sign-compare]
8 | return 0 ? port : HTTP_PORT;
| ^~~~
cc1: some warnings being treated as errors