This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/65490] New: terminals.c:1266:21: warning: argument to âsizeofâ in âbzeroâ call is the same expression as the destination


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?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]