https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65490
Bug ID: 65490
Summary: terminals.c:1266:21: warning: argument to ‘sizeof’ in
‘bzero’ call is the same expression as the destination
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
warning:
...
terminals.c:1266:21: warning: argument to ‘sizeof’ in ‘bzero’ call is the same
expression as the destination; did you mean to remove the addressof?
[-Wsizeof-pointer-memaccess]
...
terminals.c:
...
static int
child_setup_tty (int fd)
{
struct termios s;
int status;
/* ensure that s is filled with 0 */
bzero (&s, sizeof (&s));
/* Get the current terminal settings */
status = tcgetattr (fd, &s);
...
We should either fix bzero as the warning suggests, or remove bzero.
It not clear to me why bzero is needed before tcgetattr. Perhaps this is some
insurance against dodgy implementations of tcgetattr which do not set the full
struct s?