int             seen_userobj = 0;
 
        matched.ae_tag = 0;     /* Invalid type */
+       matched.ae_perm = 0;
        md >>= 6;       /* Normalize the bits for comparison */
 
        for (i = 0; i < fap->acl_cnt; i++) {
 
        xfs_alloc_rec_t         *rp;    /* pointer to btree records */
 
        ASSERT(INT_GET(recp->ar_blockcount, ARCH_CONVERT) > 0);
+
+       /*
+        * GCC doesn't understand the (arguably complex) control flow in
+        * this function and complains about uninitialized structure fields
+        * without this.
+        */
+       memset(&nrec, 0, sizeof(nrec));
+
        /*
         * If we made it to the root level, allocate a new root block
         * and we're done.
 
        int                     isdotdot;       /* entry is ".." */
        xfs_mount_t             *mp;            /* mount structure pointer */
        int                     namelen;        /* total name bytes */
-       xfs_ino_t               parent;         /* parent inode number */
+       xfs_ino_t               parent = 0;     /* parent inode number */
        int                     size=0;         /* total computed size */
 
        mp = dp->i_mount;
        int                     incr_isize;     /* total change in size */
        int                     new_isize;      /* di_size after adding name */
        int                     objchange;      /* changing to 8-byte inodes */
-       xfs_dir2_data_aoff_t    offset;         /* offset for new entry */
+       xfs_dir2_data_aoff_t    offset = 0;     /* offset for new entry */
        int                     old_isize;      /* di_size before adding name */
        int                     pick;           /* which algorithm to use */
        xfs_dir2_sf_t           *sfp;           /* shortform structure */
-       xfs_dir2_sf_entry_t     *sfep;          /* shortform entry */
+       xfs_dir2_sf_entry_t     *sfep = NULL;   /* shortform entry */
 
        xfs_dir2_trace_args("sf_addname", args);
        ASSERT(xfs_dir2_sf_lookup(args) == ENOENT);
 
        int                     ptr;    /* index in btree block for this rec */
        xfs_inobt_rec_t         *rp=NULL;       /* pointer to btree records */
 
+       /*
+        * GCC doesn't understand the (arguably complex) control flow in
+        * this function and complains about uninitialized structure fields
+        * without this.
+        */
+       memset(&nrec, 0, sizeof(nrec));
+
        /*
         * If we made it to the root level, allocate a new root block
         * and we're done.