File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1829,8 +1829,23 @@ fdgrowtable(struct filedesc *fdp, int nfd)
18291829 M_FILEDESC , M_ZERO | M_WAITOK );
18301830 /* copy the old data */
18311831 ntable -> fdt_nfiles = nnfiles ;
1832+ /*
1833+ * GCC 12+ inlines fdgrowtable into fdinit/fdcopy/fdunshare and its
1834+ * Value Range Propagation (VRP) infers that onfiles could be negative,
1835+ * triggering false-positive -Wstringop-overflow and -Wrestrict warnings.
1836+ * At runtime fd_nfiles is always > 0 (guaranteed by KASSERT above).
1837+ * See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
1838+ */
1839+ #if __GNUC__ >= 12
1840+ #pragma GCC diagnostic push
1841+ #pragma GCC diagnostic ignored "-Wstringop-overflow"
1842+ #pragma GCC diagnostic ignored "-Wrestrict"
1843+ #endif
18321844 memcpy (ntable -> fdt_ofiles , otable -> fdt_ofiles ,
18331845 onfiles * sizeof (ntable -> fdt_ofiles [0 ]));
1846+ #if __GNUC__ >= 12
1847+ #pragma GCC diagnostic pop
1848+ #endif
18341849
18351850 /*
18361851 * Allocate a new map only if the old is not large enough. It will
You can’t perform that action at this time.
0 commit comments