Opened 10 months ago

Last modified 10 months ago

#13042 reopened Patch

putty: Fails to compile on GCC 14 (error: passing argument 1 of ‘next_int’ from incompatible pointer type [-Wincompatible-pointer-types])

Reported by: Christopher Fore Owned by:
Priority: normal Component: FileZilla Client
Keywords: Cc: Sam James
Component version: 3.66.4 Operating system type: Linux
Operating system version: Gentoo

Description

hen attempting to build the client using GCC 14, the following error (and warnings) occur:

unix/uxsftp.c: In function ‘read_from_file’:
unix/uxsftp.c:224:48: error: passing argument 1 of ‘next_int’ from incompatible pointer type [-Wincompatible-pointer-types]

224 | f->buffer_ = f->memory_ + next_int(&p);

| ~
| |
| const char

In file included from ./putty.h:2437,

from unix/uxsftp.c:17:

./fzsftp.h:31:28: note: expected ‘char ’ but argument is of type ‘const char

31 | uintptr_t next_int(char s);

|

unix/uxsftp.c:225:43: error: passing argument 1 of ‘next_int’ from incompatible pointer type [-Wincompatible-pointer-types]

225 | f->remaining_ = (int)next_int(&p);

| ~
| |
| const char

./fzsftp.h:31:28: note: expected ‘char ’ but argument is of type ‘const char

31 | uintptr_t next_int(char s);

|

unix/uxsftp.c:227:15: warning: passing argument 1 of ‘safefree’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

227 | sfree(s);

|

In file included from ./misc.h:9,

from ./putty.h:10:

./puttymem.h:21:15: note: expected ‘void *’ but argument is of type ‘const char *’

21 | void safefree(void *);

| ~

Patching the warning and error above results in another warning:

sftp.c: In function ‘sftp_alloc_request’:
sftp.c:138:18: warning: unused variable ‘i’ [-Wunused-variable]

138 | unsigned i = low + 1 + REQUEST_ID_OFFSET;

|

sftp.c: In function ‘fxp_got_status’:
sftp.c:220:11: warning: passing argument 1 of ‘safefree’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

220 | sfree(fxp_error_message);

|

In file included from misc.h:9,

from sftp.c:11:

puttymem.h:21:15: note: expected ‘void *’ but argument is of type ‘const char *’

21 | void safefree(void *);

| ~

sftp.c: In function ‘fxp_internal_error’:
sftp.c:262:11: warning: passing argument 1 of ‘safefree’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

262 | sfree(fxp_error_message);

|

puttymem.h:21:15: note: expected ‘void *’ but argument is of type ‘const char *’

21 | void safefree(void *);

| ~

The attached patch should correct these by removing the const attribute.

Attachments (1)

0001-putty-fix-compilation-and-warnings-on-GCC-14.patch (1.5 KB ) - added by Christopher Fore 10 months ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Tim Kosse, 10 months ago

Resolution: wontfix
Status: newclosed

GCC 14 isn't release yet. Please report regressions in development builds of GCC to the GCC developers.

in reply to:  1 comment:2 by Christopher Fore, 10 months ago

Replying to Tim Kosse:

GCC 14 isn't release yet. Please report regressions in development builds of GCC to the GCC developers.

This isn't a regression in GCC, rather they are simply being more strict about enforcing C99. Gentoo's been tracking C99 issues for about a year now if you'd like to look into it, here's their tracker:

https://bugs.gentoo.org/870412

comment:3 by Sam James, 10 months ago

GCC 14 will make several warnings error by default, see https://wiki.gentoo.org/wiki/Modern_C_porting. It's not a GCC bug.

comment:4 by Sam James, 10 months ago

Cc: Sam James added
Resolution: wontfix
Status: closedreopened
Note: See TracTickets for help on using tickets.